Commit 05e4a205 authored by Claes Sjöfors's avatar Claes Sjöfors

Merge branch 'master'

parents 280567e7 e47c76c0
......@@ -43,6 +43,7 @@
#include "wb_wge_qt.h"
#include <QApplication>
#include <QCloseEvent>
#include <QMenuBar>
#include <QMessageBox>
#include <QShortcut>
......@@ -146,9 +147,14 @@ void WGeQtWidget::action_resize(QResizeEvent* event)
WGeQt::~WGeQt()
{
if (close_cb) {
(close_cb)(this);
}
if (nav_widget) {
nav_widget->close();
}
delete graph;
delete toplevel;
}
void WGeQt::set_size(int width, int height)
......@@ -175,7 +181,7 @@ void WGeQtWidget::closeEvent(QCloseEvent* event)
} else {
delete ge;
}
QWidget::closeEvent(event);
event->ignore();
}
WGeQt::WGeQt(void* wge_parent_ctx, char* wge_name, char* wge_filename,
......@@ -199,7 +205,6 @@ WGeQt::WGeQt(void* wge_parent_ctx, char* wge_name, char* wge_filename,
// Qt
toplevel = new WGeQtWidget(this);
toplevel->setWindowTitle(fl(title));
toplevel->setAttribute(Qt::WA_DeleteOnClose);
CoWowQt::SetWindowIcon(toplevel);
......
......@@ -263,7 +263,7 @@ Ge* WNavQt::ge_new(char* graph_name, int nojournal)
WGe* WNavQt::wge_new(char* name, char* filename, char* object_name, int modal)
{
return new WGeQt(this, name, filename, 0, 1, 1, 0, 0, 0, 0, object_name,
return new WGeQt(this, name, filename, 0, 0, 0, 0, 0, 0, 0, object_name,
modal);
}
......
......@@ -281,19 +281,16 @@ void GlowDrawQt::event_handler(QEvent* event, QWidget* target)
switch (event->type()) {
case QEvent::KeyPress: {
QKeyEvent* keyEvent = ((QKeyEvent*)event);
int keysym;
keysym = keyEvent->key();
if (keysym >= Qt::Key_Space && keysym <= Qt::Key_AsciiTilde) {
char buff = QChar(keysym).toAscii();
if (keyEvent->key() >= Qt::Key_Space && keyEvent->key() <= Qt::Key_AsciiTilde) {
const char *buff = qPrintable(keyEvent->text());
if (keyEvent->modifiers() & Qt::ControlModifier) {
sts = ctx->event_handler(glow_eEvent_Key_CtrlAscii, 0, 0, buff, 0);
sts = ctx->event_handler(glow_eEvent_Key_CtrlAscii, 0, 0, buff[0], 0);
} else {
sts = ctx->event_handler(glow_eEvent_Key_Ascii, 0, 0, buff, 0);
sts = ctx->event_handler(glow_eEvent_Key_Ascii, 0, 0, buff[0], 0);
}
} else {
switch (keysym) {
switch (keyEvent->key()) {
case Qt::Key_Return:
case Qt::Key_Enter:
sts = ctx->event_handler(glow_eEvent_Key_Return, 0, 0, 0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment