Commit c8101b1e authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Fixed WGe navigator window.

parent 5a18721e
......@@ -145,9 +145,8 @@ void WGeQtWidget::action_resize(QResizeEvent* event)
WGeQt::~WGeQt()
{
debug_print("WGeQt::~WGeQt\n");
if (nav_shell) {
nav_shell->close();
if (nav_widget) {
nav_widget->close();
}
}
......@@ -184,7 +183,6 @@ void WGeQt::pop()
void WGeQtWidget::closeEvent(QCloseEvent* event)
{
debug_print("WGeQtWidget::closeEvent\n");
if (ge->modal) {
ge->terminated = 1;
debug_print("Shutting down...\n");
......@@ -201,7 +199,7 @@ WGeQt::WGeQt(QWidget* wge_parent_wid, void* wge_parent_ctx, char* wge_name,
int wge_modal = 0)
: WGe(wge_parent_ctx, wge_name, wge_filename, wge_scrollbar, wge_menu,
wge_navigator, wge_width, wge_height, x, y, object_name, wge_modal),
nav_shell(0), value_dialog(0)
value_dialog(0)
{
int window_width = 600;
int window_height = 500;
......@@ -273,21 +271,14 @@ WGeQt::WGeQt(QWidget* wge_parent_wid, void* wge_parent_ctx, char* wge_name,
toplevel->setLayout(graph_form);
toplevel->show();
debug_print("Should be visible now...\n");
if (navigator) {
// Create navigator popup
nav_shell = new QWidget();
nav_shell->setMinimumSize(200, 200);
nav_shell->setWindowTitle(fl("Navigator"));
nav_shell->setAttribute(Qt::WA_DeleteOnClose);
((GraphQt*)graph)->create_navigator(nav_shell);
QVBoxLayout* l = new QVBoxLayout(nav_shell);
l->addWidget(((GraphQt*)graph)->nav_widget);
nav_shell->setLayout(l);
nav_widget = ((GraphQt*)graph)->create_navigator();
nav_widget->setFixedSize(200, 200);
nav_widget->setWindowTitle(fl("Navigator"));
nav_widget->setAttribute(Qt::WA_DeleteOnClose);
nav_shell->show();
nav_widget->show();
graph->set_nav_background_color();
}
......
......@@ -49,8 +49,7 @@ class WGeQt : public WGe {
public:
QWidget* grow_widget;
QWidget* form_widget;
QWidget* nav_shell;
QWidget* nav_widget;
QWidget* nav_widget = NULL;
QLineEdit* value_input;
QWidget* value_dialog;
QWidget* message_dia_widget;
......
......@@ -217,7 +217,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(parent_wid, this, name, filename, 0, 0, 0, 0, 0, 0, 0,
return new WGeQt(parent_wid, this, name, filename, 0, 1, 1, 0, 0, 0, 0,
object_name, modal);
}
......
......@@ -117,10 +117,10 @@ void GraphQt::trace_timer_add(int time)
initOneShotTimer(trace_timerid, SLOT(trace_scan()),time);
}
int GraphQt::create_navigator(QWidget* parent)
QWidget* GraphQt::create_navigator()
{
nav_widget = grownavwidgetqt_new(grow_widget);
return 1;
return nav_widget;
}
Attr* GraphQt::attr_new(void* parent_ctx, attr_eType type, void* object,
......
......@@ -76,7 +76,7 @@ public:
void trace_timer_remove();
void trace_timer_add(int time);
int create_navigator(QWidget* parent);
QWidget* create_navigator();
Attr* attr_new(void* parent_ctx, attr_eType type, void* object,
attr_sItem* itemlist, int item_cnt);
void set_inputfocus(int focus);
......
......@@ -1990,7 +1990,7 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget,
add_expanding(vpaned1, palbox);
vpaned1->addWidget(colpal_main_widget);
((GraphQt*)graph)->create_navigator(vpaned1);
((GraphQt*)graph)->create_navigator();
add_expanding(vpaned2, vpaned1);
vpaned1->addWidget(((GraphQt*)graph)->nav_widget);
......
......@@ -860,14 +860,21 @@ int GlowDrawQt::event_handler(QEvent* event, QWidget* target)
sts = ctx->event_handler_nav(glow_eEvent_Exposure, 0, 0);
break;
}
case QEvent::Paint:
case QEvent::UpdateRequest: {
ctx->nav_clear();
sts = ctx->event_handler_nav(glow_eEvent_Exposure, 0, 0);
nav_wind->window->update();
break;
}
case QEvent::MouseMove: {
QPoint pos = QCursor::pos();
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
if (button1_pressed || button2_pressed || button3_pressed) {
sts = ctx->event_handler_nav(
glow_eEvent_ButtonMotion, pos.x(), pos.y());
glow_eEvent_ButtonMotion, mouseEvent->x(), mouseEvent->y());
} else {
sts = ctx->event_handler_nav(
glow_eEvent_CursorMotion, pos.x(), pos.y());
glow_eEvent_CursorMotion, mouseEvent->x(), mouseEvent->y());
}
break;
}
......
......@@ -221,8 +221,8 @@ XttGeQt::~XttGeQt()
if (confirm_widget) {
confirm_widget->close();
}
if (nav_shell) {
nav_shell->close();
if (nav_widget) {
nav_widget->close();
}
delete graph;
}
......@@ -261,7 +261,7 @@ XttGeQt::XttGeQt(QWidget* xg_parent_wid, void* xg_parent_ctx,
xg_navigator, xg_width, xg_height, x, y, scan_time, object_name,
use_default_access, access, options, color_theme, xg_command_cb,
xg_get_current_objects_cb, xg_is_authorized_cb, xg_keyboard_cb),
nav_shell(0), value_dialog(0)
value_dialog(0)
{
int window_width = 600;
int window_height = 500;
......@@ -365,16 +365,14 @@ XttGeQt::XttGeQt(QWidget* xg_parent_wid, void* xg_parent_ctx,
if (navigator) {
// Create navigator popup
nav_shell = new QWidget();
nav_shell->setFixedSize(200, 200);
nav_shell->setWindowTitle(fl("Navigator"));
nav_shell->setAttribute(Qt::WA_DeleteOnClose);
nav_widget = ((GraphQt*)graph)->create_navigator();
nav_widget->setFixedSize(200, 200);
nav_widget->setWindowTitle(fl("Navigator"));
nav_widget->setAttribute(Qt::WA_DeleteOnClose);
((GraphQt*)graph)->create_navigator(nav_shell);
nav_shell->layout()->addWidget(((GraphQt*)graph)->nav_widget);
nav_widget->show();
nav_shell->show();
((Graph*)graph)->set_nav_background_color();
graph->set_nav_background_color();
}
if (!(x == 0 && y == 0)) {
......
......@@ -50,8 +50,7 @@ public:
XttGeQtWidget* toplevel;
QWidget* grow_widget;
QWidget* form_widget;
QWidget* nav_shell;
QWidget* nav_widget;
QWidget* nav_widget = NULL;
QWidget* graph_form;
QLineEdit* value_input;
QWidget* value_dialog;
......
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