Commit d259aa92 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: added a helper function to start a one-shot timer.

parent a4f39dc8
...@@ -50,8 +50,10 @@ ...@@ -50,8 +50,10 @@
#include <QTimer> #include <QTimer>
WGreQt::WGreQt(void* wg_parent_ctx, QWidget* wg_parent_wid, const char* name) WGreQt::WGreQt(void* wg_parent_ctx, QWidget* wg_parent_wid, const char* name)
: WGre(wg_parent_ctx, 0), trace_obj(0) : WGre(wg_parent_ctx, 0)
{ {
trace_obj = new WGreQtTraceObject(this);
trace_timerid = new QTimer(trace_obj);
ctx_init(); ctx_init();
debug_print("creating a scrolledflowwidgetqt\n"); debug_print("creating a scrolledflowwidgetqt\n");
form_widget = scrolledflowwidgetqt_new(init_flow, this, &flow_widget); form_widget = scrolledflowwidgetqt_new(init_flow, this, &flow_widget);
...@@ -81,11 +83,7 @@ void WGreQtTraceObject::trace_scan() ...@@ -81,11 +83,7 @@ void WGreQtTraceObject::trace_scan()
{ {
if (wgre->trace_started) { if (wgre->trace_started) {
flow_TraceScan(wgre->flow_ctx); flow_TraceScan(wgre->flow_ctx);
initOneShotTimer(wgre->trace_timerid, SLOT(trace_scan()), 500);
trace_timerid = new QTimer(this);
trace_timerid->setSingleShot(true);
connect(trace_timerid, SIGNAL(timeout()), this, SLOT(trace_scan()));
trace_timerid->start(500);
} }
} }
...@@ -99,7 +97,7 @@ void WGreQt::trace_stop() ...@@ -99,7 +97,7 @@ void WGreQt::trace_stop()
{ {
if (trace_started) { if (trace_started) {
trace_started = 0; trace_started = 0;
delete trace_obj; trace_timerid->stop();
} }
} }
......
...@@ -53,6 +53,8 @@ public: ...@@ -53,6 +53,8 @@ public:
QWidget* nav_shell; QWidget* nav_shell;
QWidget* nav_widget; QWidget* nav_widget;
QTimer* trace_timerid;
WGreQt(void* parent_ctx, QWidget* parent_wid, const char* name); WGreQt(void* parent_ctx, QWidget* parent_wid, const char* name);
~WGreQt(); ~WGreQt();
...@@ -80,7 +82,6 @@ public slots: ...@@ -80,7 +82,6 @@ public slots:
private: private:
WGreQt* wgre; WGreQt* wgre;
QTimer* trace_timerid;
}; };
#endif #endif
\ No newline at end of file
...@@ -171,17 +171,16 @@ void WNavQt::trace_start() ...@@ -171,17 +171,16 @@ void WNavQt::trace_start()
trace_obj->trace_scan(); trace_obj->trace_scan();
} }
void WNavQtTraceObject::trace_scan() WNavQtTraceObject::WNavQtTraceObject(WNavQt* parent) : QObject(), wnav(parent)
{ {
int time = 1000; trace_timerid = new QTimer(this);
}
void WNavQtTraceObject::trace_scan()
{
if (wnav->trace_started) { if (wnav->trace_started) {
brow_TraceScan(wnav->brow->ctx); brow_TraceScan(wnav->brow->ctx);
initOneShotTimer(trace_timerid, SLOT(trace_scan()), 1000);
trace_timerid = new QTimer(this);
trace_timerid->setSingleShot(true);
connect(trace_timerid, SIGNAL(timeout()), this, SLOT(trace_scan()));
trace_timerid->start(time);
} }
} }
......
...@@ -112,9 +112,7 @@ class WNavQtTraceObject : public QObject { ...@@ -112,9 +112,7 @@ class WNavQtTraceObject : public QObject {
Q_OBJECT Q_OBJECT
public: public:
WNavQtTraceObject(WNavQt* parent) : QObject(), wnav(parent) WNavQtTraceObject(WNavQt* parent);
{
}
public slots: public slots:
void trace_scan(); void trace_scan();
......
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QScrollArea> #include <QScrollArea>
#include <QTimer>
#include <QVBoxLayout> #include <QVBoxLayout>
#define WTT_PALETTE_WIDTH 160 #define WTT_PALETTE_WIDTH 160
...@@ -544,20 +543,12 @@ void WttQt::menu_setup() ...@@ -544,20 +543,12 @@ void WttQt::menu_setup()
void WttQt::set_selection_owner() void WttQt::set_selection_owner()
{ {
selection_timerid = new QTimer(); initOneShotTimer(selection_timerid, SLOT(set_selection_owner_proc()), 200);
selection_timerid->setSingleShot(true);
QObject::connect(selection_timerid, SIGNAL(timeout()), toplevel,
SLOT(set_selection_owner_proc()));
selection_timerid->start(200);
} }
void WttQt::set_palette_selection_owner() void WttQt::set_palette_selection_owner()
{ {
selection_timerid = new QTimer(); initOneShotTimer(selection_timerid, SLOT(set_palette_selection_owner_proc()), 200);
selection_timerid->setSingleShot(true);
QObject::connect(selection_timerid, SIGNAL(timeout()), toplevel,
SLOT(set_palette_selection_owner_proc()));
selection_timerid->start(200);
} }
void WttQtWidget::set_selection_owner_proc() void WttQtWidget::set_selection_owner_proc()
...@@ -565,7 +556,7 @@ void WttQtWidget::set_selection_owner_proc() ...@@ -565,7 +556,7 @@ void WttQtWidget::set_selection_owner_proc()
// Delay call to own selection, to make it possible to paste previous // Delay call to own selection, to make it possible to paste previous
// selection // selection
// to value inputwith MB2 // to value inputwith MB2
wtt->selection_timerid = 0; wtt->selection_timerid->stop();
if (wtt->focused_wnav) { if (wtt->focused_wnav) {
wtt->focused_wnav->set_selection_owner(); wtt->focused_wnav->set_selection_owner();
} }
...@@ -576,7 +567,7 @@ void WttQtWidget::set_palette_selection_owner_proc() ...@@ -576,7 +567,7 @@ void WttQtWidget::set_palette_selection_owner_proc()
// Delay call to own selection, to make it possible to paste previous // Delay call to own selection, to make it possible to paste previous
// selection // selection
// to value inputwith MB2 // to value inputwith MB2
wtt->selection_timerid = 0; wtt->selection_timerid->stop();
wtt->palette->set_selection_owner(); wtt->palette->set_selection_owner();
} }
...@@ -1735,7 +1726,7 @@ WttQt::WttQt(void* wt_parent_ctx, QWidget* wt_parent_wid, const char* wt_name, ...@@ -1735,7 +1726,7 @@ WttQt::WttQt(void* wt_parent_ctx, QWidget* wt_parent_wid, const char* wt_name,
: Wtt(wt_parent_ctx, wt_name, iconname, wt_wbctx, wt_volid, wt_volctx, : Wtt(wt_parent_ctx, wt_name, iconname, wt_wbctx, wt_volid, wt_volctx,
root_menu, status), root_menu, status),
boot_dia(0), options_form(0), set_focus_disabled(0), disfocus_timerid(0), boot_dia(0), options_form(0), set_focus_disabled(0), disfocus_timerid(0),
selection_timerid(0), avoid_deadlock(0), realized(0) avoid_deadlock(0), realized(0)
{ {
int window_width = 900; int window_width = 900;
int window_height = 800; int window_height = 800;
...@@ -1909,6 +1900,8 @@ WttQt::WttQt(void* wt_parent_ctx, QWidget* wt_parent_wid, const char* wt_name, ...@@ -1909,6 +1900,8 @@ WttQt::WttQt(void* wt_parent_ctx, QWidget* wt_parent_wid, const char* wt_name,
toplevel->setWindowTitle(fl(title)); toplevel->setWindowTitle(fl(title));
toplevel->setAttribute(Qt::WA_DeleteOnClose); toplevel->setAttribute(Qt::WA_DeleteOnClose);
selection_timerid = new QTimer(toplevel);
CoWowQt::SetWindowIcon(toplevel); CoWowQt::SetWindowIcon(toplevel);
QMenuBar* menu_bar = new QMenuBar(); QMenuBar* menu_bar = new QMenuBar();
...@@ -2322,10 +2315,6 @@ WttQt::~WttQt() ...@@ -2322,10 +2315,6 @@ WttQt::~WttQt()
(close_cb)(this); (close_cb)(this);
} }
if (selection_timerid) {
delete selection_timerid;
}
wnav->closing_down = 1; wnav->closing_down = 1;
wnavnode->closing_down = 1; wnavnode->closing_down = 1;
if (mcp) { if (mcp) {
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <QLayout> #include <QLayout>
#include <QMenu> #include <QMenu>
#include <QShowEvent> #include <QShowEvent>
#include <QTimer>
#include <QToolButton> #include <QToolButton>
void print_time(FILE* stream, int fulldate) void print_time(FILE* stream, int fulldate)
...@@ -358,4 +359,11 @@ QFrame* wrapInFrame(QFrame* widget) ...@@ -358,4 +359,11 @@ QFrame* wrapInFrame(QFrame* widget)
layout->addWidget(widget); layout->addWidget(widget);
frame->setLayout(layout); frame->setLayout(layout);
return frame; return frame;
} }
\ No newline at end of file
void initOneShotTimer(QTimer* timer, const char* slot, int time)
{
timer->setSingleShot(true);
QObject::connect(timer, SIGNAL(timeout()), timer->parent(), slot);
timer->start(time);
}
...@@ -110,4 +110,6 @@ void add_expanding(QLayout* layout, QLayout* widget); ...@@ -110,4 +110,6 @@ void add_expanding(QLayout* layout, QLayout* widget);
QFrame* wrapInFrame(QFrame* widget); QFrame* wrapInFrame(QFrame* widget);
void initOneShotTimer(QTimer* timer, const char* slot, int time);
#endif // QT_HELPERS_H #endif // QT_HELPERS_H
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <QMenuBar> #include <QMenuBar>
#include <QPalette> #include <QPalette>
#include <QPushButton> #include <QPushButton>
#include <QTimer>
#include <QVBoxLayout> #include <QVBoxLayout>
void RtMonQtWidget::closeEvent(QCloseEvent* event) void RtMonQtWidget::closeEvent(QCloseEvent* event)
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <QAction> #include <QAction>
#include <QLabel> #include <QLabel>
#include <QTimer>
#include <QWidget> #include <QWidget>
class RtMonQtWidget; class RtMonQtWidget;
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "flow_browwidget_qt.h" #include "flow_browwidget_qt.h"
#include <QApplication> #include <QApplication>
#include <QTimer>
NodelistNavQt::NodelistNavQt(void* nodelist_parent_ctx, NodelistNavQt::NodelistNavQt(void* nodelist_parent_ctx,
QWidget* nodelist_parent_wid, MsgWindow* nodelist_msg_window, QWidget* nodelist_parent_wid, MsgWindow* nodelist_msg_window,
...@@ -87,6 +88,12 @@ void NodelistNavQt::trace_start() ...@@ -87,6 +88,12 @@ void NodelistNavQt::trace_start()
trace_obj->trace_scan(); trace_obj->trace_scan();
} }
NodelistNavQtTraceObject::NodelistNavQtTraceObject(NodelistNavQt* parent)
: QWidget(), nodelistnav(parent)
{
trace_timerid = new QTimer(this);
}
void NodelistNavQtTraceObject::trace_scan() void NodelistNavQtTraceObject::trace_scan()
{ {
if (nodelistnav->trace_started) { if (nodelistnav->trace_started) {
...@@ -94,9 +101,6 @@ void NodelistNavQtTraceObject::trace_scan() ...@@ -94,9 +101,6 @@ void NodelistNavQtTraceObject::trace_scan()
brow_TraceScan(nodelistnav->brow->ctx); brow_TraceScan(nodelistnav->brow->ctx);
trace_timerid = new QTimer(); initOneShotTimer(trace_timerid, SLOT(trace_scan()), nodelistnav->scantime);
trace_timerid->setSingleShot(true);
connect(trace_timerid, SIGNAL(timeout()), this, SLOT(trace_scan()));
trace_timerid->start(nodelistnav->scantime);
} }
} }
\ No newline at end of file
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "cow_statusmon_nodelistnav.h" #include "cow_statusmon_nodelistnav.h"
#endif #endif
#include <QTimer>
#include <QWidget> #include <QWidget>
class NodelistNavQtTraceObject; class NodelistNavQtTraceObject;
...@@ -75,10 +74,7 @@ class NodelistNavQtTraceObject : public QWidget { ...@@ -75,10 +74,7 @@ class NodelistNavQtTraceObject : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
NodelistNavQtTraceObject(NodelistNavQt* parent) NodelistNavQtTraceObject(NodelistNavQt* parent);
: QWidget(), nodelistnav(parent)
{
}
public slots: public slots:
void trace_scan(); void trace_scan();
......
...@@ -537,6 +537,7 @@ CoWowTimer* CoWowQt::timer_new() ...@@ -537,6 +537,7 @@ CoWowTimer* CoWowQt::timer_new()
CoWowTimerQt::CoWowTimerQt() CoWowTimerQt::CoWowTimerQt()
{ {
object = new CoWowTimerQtObject(this); object = new CoWowTimerQtObject(this);
timer = new QTimer(object);
} }
CoWowTimerQt::~CoWowTimerQt() CoWowTimerQt::~CoWowTimerQt()
...@@ -549,10 +550,7 @@ void CoWowTimerQt::add(int time, void (*callback)(void*), void* data) ...@@ -549,10 +550,7 @@ void CoWowTimerQt::add(int time, void (*callback)(void*), void* data)
{ {
m_callback = callback; m_callback = callback;
m_data = data; m_data = data;
timer = new QTimer(object); initOneShotTimer(timer, SLOT(timer_cb()), time);
timer->setSingleShot(true);
QObject::connect(timer, SIGNAL(timeout()), object, SLOT(timer_cb()));
timer->start(time);
} }
void CoWowTimerQt::remove() void CoWowTimerQt::remove()
...@@ -605,10 +603,7 @@ void CoWowFocusTimerQt::disable(int time) ...@@ -605,10 +603,7 @@ void CoWowFocusTimerQt::disable(int time)
if (request_cnt > 1) { if (request_cnt > 1) {
request_cnt = 0; request_cnt = 0;
} }
timer = new QTimer(); initOneShotTimer(timer, SLOT(enable_set_focus()), time);
timer->setSingleShot(true);
connect(timer, SIGNAL(timeout()), this, SLOT(enable_set_focus()));
timer->start(time);
} }
int CoWowFocusTimerQt::disabled() int CoWowFocusTimerQt::disabled()
...@@ -624,12 +619,14 @@ void CoWowFocusTimerQt::enable_set_focus() ...@@ -624,12 +619,14 @@ void CoWowFocusTimerQt::enable_set_focus()
request_cnt = 0; request_cnt = 0;
} }
CoWowFocusTimerQt::CoWowFocusTimerQt() : set_focus_disabled(0), request_cnt(0)
{
timer = new QTimer(this);
}
CoWowFocusTimerQt::~CoWowFocusTimerQt() CoWowFocusTimerQt::~CoWowFocusTimerQt()
{ {
debug_print("CoWowFocusTimerQt::~CoWowFocusTimerQt\n"); debug_print("CoWowFocusTimerQt::~CoWowFocusTimerQt\n");
if (set_focus_disabled) {
delete timer;
}
} }
void CoWowQt::SetWindowIcon(QWidget* w) void CoWowQt::SetWindowIcon(QWidget* w)
...@@ -971,10 +968,7 @@ void CoWowQtObject::wait_cb() ...@@ -971,10 +968,7 @@ void CoWowQtObject::wait_cb()
void CoWowQt::Wait(float time) void CoWowQt::Wait(float time)
{ {
m_wait_timerid = new QTimer(object); initOneShotTimer(m_wait_timerid, SLOT(wait_cb()), int(time * 1000));
m_wait_timerid->setSingleShot(true);
QObject::connect(m_wait_timerid, SIGNAL(timeout()), object, SLOT(wait_cb()));
m_wait_timerid->start(int(time * 1000));
} }
void CoWowQt::CreateBrowPrintDialogQt(const char* title, void* brow_ctx, void CoWowQt::CreateBrowPrintDialogQt(const char* title, void* brow_ctx,
...@@ -1082,6 +1076,7 @@ void CoWowQt::update_title(QWidget* w, int editmode) ...@@ -1082,6 +1076,7 @@ void CoWowQt::update_title(QWidget* w, int editmode)
CoWowQt::CoWowQt(QWidget* parent) CoWowQt::CoWowQt(QWidget* parent)
{ {
object = new CoWowQtObject(parent); object = new CoWowQtObject(parent);
m_wait_timerid = new QTimer(object);
} }
CoWowQt::~CoWowQt() CoWowQt::~CoWowQt()
......
...@@ -99,10 +99,7 @@ class CoWowFocusTimerQt : public QObject { ...@@ -99,10 +99,7 @@ class CoWowFocusTimerQt : public QObject {
Q_OBJECT Q_OBJECT
public: public:
CoWowFocusTimerQt() : set_focus_disabled(0), request_cnt(0), timer(0) CoWowFocusTimerQt();
{
}
~CoWowFocusTimerQt(); ~CoWowFocusTimerQt();
void disable(int time); void disable(int time);
int disabled(); int disabled();
......
...@@ -45,15 +45,8 @@ static void scroll_callback(flow_sScroll* data) ...@@ -45,15 +45,8 @@ static void scroll_callback(flow_sScroll* data)
widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data; widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data;
QtScrollWidgetFlow* brow = ((QtScrollWidgetFlow*)scroll_data->parent); QtScrollWidgetFlow* brow = ((QtScrollWidgetFlow*)scroll_data->parent);
if (brow->scroll_timerid) { initOneShotTimer(brow->scroll_timerid, SLOT(scroll_callback_cb()), 200);
delete brow->scroll_timerid;
}
brow->scroll_timerid = new QTimer();
brow->scroll_timerid->setSingleShot(true);
QObject::connect(brow->scroll_timerid, SIGNAL(timeout()), brow,
SLOT(scroll_callback_cb()));
brow->scroll_timerid->start(200);
brow->scroll_data = *data; brow->scroll_data = *data;
} }
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <QApplication> #include <QApplication>
#include <QBitmap> #include <QBitmap>
#include <QKeyEvent> #include <QKeyEvent>
#include <QTimer>
#define DRAW_PRESS_PIX 9 #define DRAW_PRESS_PIX 9
...@@ -191,10 +192,6 @@ FlowDrawQt::~FlowDrawQt() ...@@ -191,10 +192,6 @@ FlowDrawQt::~FlowDrawQt()
basectx->set_nodraw(); basectx->set_nodraw();
delete basectx; delete basectx;
if (timer_id) {
delete timer_id;
}
} }
int FlowDrawQt::create_secondary_ctx(FlowCtx* flow_ctx, int FlowDrawQt::create_secondary_ctx(FlowCtx* flow_ctx,
...@@ -256,9 +253,10 @@ void FlowDrawQt::delete_secondary_ctx(FlowCtx* ctx) ...@@ -256,9 +253,10 @@ void FlowDrawQt::delete_secondary_ctx(FlowCtx* ctx)
FlowDrawQt::FlowDrawQt(QWidget* x_toplevel, void** flow_ctx, FlowDrawQt::FlowDrawQt(QWidget* x_toplevel, void** flow_ctx,
int (*init_proc)(QWidget* w, FlowCtx* ctx, void* client_data), int (*init_proc)(QWidget* w, FlowCtx* ctx, void* client_data),
void* client_data, flow_eCtxType type) void* client_data, flow_eCtxType type)
: toplevel(x_toplevel), nav_toplevel(0), window(0), nav_window(0), : toplevel(x_toplevel), nav_toplevel(0), window(0), nav_window(0), closing_down(0)
timer_id(0), closing_down(0)
{ {
timer_id = new QTimer(this);
if (type == flow_eCtxType_Brow) { if (type == flow_eCtxType_Brow) {
basectx = (FlowCtx*)new BrowCtx("Claes context", 20); basectx = (FlowCtx*)new BrowCtx("Claes context", 20);
} else { } else {
...@@ -1624,8 +1622,7 @@ bool FlowDrawQt::draw_timer_cb() ...@@ -1624,8 +1622,7 @@ bool FlowDrawQt::draw_timer_cb()
bool FlowDrawQt::event_timer_cb() bool FlowDrawQt::event_timer_cb()
{ {
delete timer_id; timer_id->stop();
timer_id = 0;
event_handler(last_event); event_handler(last_event);
return FALSE; return FALSE;
} }
...@@ -1633,8 +1630,7 @@ bool FlowDrawQt::event_timer_cb() ...@@ -1633,8 +1630,7 @@ bool FlowDrawQt::event_timer_cb()
void FlowDrawQt::cancel_event_timer() void FlowDrawQt::cancel_event_timer()
{ {
if (timer_id) { if (timer_id) {
delete timer_id; timer_id->stop();
timer_id = 0;
} }
} }
...@@ -1645,10 +1641,7 @@ void FlowDrawQt::event_timer(QMouseEvent *event) ...@@ -1645,10 +1641,7 @@ void FlowDrawQt::event_timer(QMouseEvent *event)
} }
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers()); last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
timer_id = new QTimer(); initOneShotTimer(timer_id, SLOT(event_timer_cb()), 200);
timer_id->setSingleShot(true);
connect(timer_id, SIGNAL(timeout()), this, SLOT(event_timer_cb()));
timer_id->start(200);
} }
void FlowDrawQt::set_timer( void FlowDrawQt::set_timer(
...@@ -1657,11 +1650,9 @@ void FlowDrawQt::set_timer( ...@@ -1657,11 +1650,9 @@ void FlowDrawQt::set_timer(
timer_cb = new flow_draw_sTimerCb(); timer_cb = new flow_draw_sTimerCb();
timer_cb->ctx = ctx; timer_cb->ctx = ctx;
timer_cb->callback_func = callback_func; timer_cb->callback_func = callback_func;
timer_cb->timer_id = new QTimer(this);
timer_cb->timer_id = new QTimer(); initOneShotTimer(timer_cb->timer_id, SLOT(draw_timer_cb()), time_ms);
timer_cb->timer_id->setSingleShot(true);
connect(timer_cb->timer_id, SIGNAL(timeout()), this, SLOT(draw_timer_cb()));
timer_cb->timer_id->start(time_ms);
*id = (void*)timer_cb; *id = (void*)timer_cb;
} }
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <QColor> #include <QColor>
#include <QEvent> #include <QEvent>
#include <QPainter> #include <QPainter>
#include <QTimer>
#include <QWidget> #include <QWidget>
typedef struct { typedef struct {
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#include "flow_scroll_widget_qt.h" #include "flow_scroll_widget_qt.h"
#include <QTimer>
void QtScrollWidgetFlow::createBuffer(QSize size) void QtScrollWidgetFlow::createBuffer(QSize size)
{ {
this->image = QImage(size, QImage::Format_RGB32); this->image = QImage(size, QImage::Format_RGB32);
...@@ -63,6 +65,7 @@ void QtScrollWidgetFlow::init(unsigned int eCtxType, ...@@ -63,6 +65,7 @@ void QtScrollWidgetFlow::init(unsigned int eCtxType,
this->init_proc = init_proc; this->init_proc = init_proc;
this->init_widget_proc = init_proc2; this->init_widget_proc = init_proc2;
this->client_data = client_data; this->client_data = client_data;
this->scroll_timerid = new QTimer(this);
} }
QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType, QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType,
...@@ -76,6 +79,7 @@ QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType, ...@@ -76,6 +79,7 @@ QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType,
this->init_proc = init_proc; this->init_proc = init_proc;
this->init_widget_proc = init_proc2; this->init_widget_proc = init_proc2;
this->client_data = client_data; this->client_data = client_data;
this->scroll_timerid = new QTimer(this);
QScrollArea* form = new QScrollArea(); QScrollArea* form = new QScrollArea();
scroll_h = form->horizontalScrollBar(); scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar(); scroll_v = form->verticalScrollBar();
...@@ -95,6 +99,7 @@ void QtScrollWidgetFlow::init(unsigned int eCtxType, QWidget* main) ...@@ -95,6 +99,7 @@ void QtScrollWidgetFlow::init(unsigned int eCtxType, QWidget* main)
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true); setMouseTracking(true);
this->ctxType = eCtxType; this->ctxType = eCtxType;
this->scroll_timerid = new QTimer(this);
is_navigator = 1; is_navigator = 1;
main_widget = main; main_widget = main;
} }
...@@ -104,7 +109,7 @@ void QtScrollWidgetFlow::scroll_callback_cb() ...@@ -104,7 +109,7 @@ void QtScrollWidgetFlow::scroll_callback_cb()
flow_sScroll* data = &this->scroll_data; flow_sScroll* data = &this->scroll_data;
widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data; widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data;
scroll_timerid = 0; scroll_timerid->stop();
if (data->total_width <= data->window_width) { if (data->total_width <= data->window_width) {
if (data->offset_x == 0) { if (data->offset_x == 0) {
...@@ -217,9 +222,6 @@ void QtScrollWidgetFlow::closeEvent(QCloseEvent* event) ...@@ -217,9 +222,6 @@ void QtScrollWidgetFlow::closeEvent(QCloseEvent* event)
debug_print("QtScrollWidgetFlow::closeEvent\n"); debug_print("QtScrollWidgetFlow::closeEvent\n");
if (!destroyed) { if (!destroyed) {
destroyed = 1; destroyed = 1;
if (scroll_timerid) {
delete scroll_timerid;
}
if (is_navigator && parent_ctx) { if (is_navigator && parent_ctx) {
if (!((QtScrollWidgetFlow*)main_widget)->destroyed) { if (!((QtScrollWidgetFlow*)main_widget)->destroyed) {
((FlowCtx*)parent_ctx)->no_nav = 1; ((FlowCtx*)parent_ctx)->no_nav = 1;
......
...@@ -44,15 +44,8 @@ static void scroll_callback(flow_sScroll* data) ...@@ -44,15 +44,8 @@ static void scroll_callback(flow_sScroll* data)
widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data; widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data;
QtScrollWidgetFlow* flow = ((QtScrollWidgetFlow*)scroll_data->parent); QtScrollWidgetFlow* flow = ((QtScrollWidgetFlow*)scroll_data->parent);
if (flow->scroll_timerid) { initOneShotTimer(flow->scroll_timerid, SLOT(scroll_callback_cb()), 200);
delete flow->scroll_timerid;
}
flow->scroll_timerid = new QTimer();
flow->scroll_timerid->setSingleShot(true);
QObject::connect(flow->scroll_timerid, SIGNAL(timeout()), flow,
SLOT(scroll_callback_cb()));
flow->scroll_timerid->start(200);
flow->scroll_data = *data; flow->scroll_data = *data;
} }
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#include "ge_attrnav_qt.h" #include "ge_attrnav_qt.h"
#include <QTimer>
AttrNavQt::AttrNavQt(void* xn_parent_ctx, QWidget* xn_parent_wid, AttrNavQt::AttrNavQt(void* xn_parent_ctx, QWidget* xn_parent_wid,
attr_eType xn_type, const char* xn_name, attr_sItem* xn_itemlist, attr_eType xn_type, const char* xn_name, attr_sItem* xn_itemlist,
int xn_item_cnt, QWidget** w, pwr_tStatus* status) int xn_item_cnt, QWidget** w, pwr_tStatus* status)
...@@ -75,23 +77,22 @@ void AttrNavQt::trace_start() ...@@ -75,23 +77,22 @@ void AttrNavQt::trace_start()
trace_obj->trace_scan(); trace_obj->trace_scan();
} }
AttrNavQtTraceObject::AttrNavQtTraceObject(AttrNavQt* parent) : QObject(), attrnav(parent)
{
trace_timerid = new QTimer(this);
}
AttrNavQtTraceObject::~AttrNavQtTraceObject() AttrNavQtTraceObject::~AttrNavQtTraceObject()
{ {
debug_print("AttrNavQtTraceObject::~AttrNavQtTraceObject\n"); debug_print("AttrNavQtTraceObject::~AttrNavQtTraceObject\n");
delete trace_timerid;
} }
void AttrNavQtTraceObject::trace_scan() void AttrNavQtTraceObject::trace_scan()
{ {
int time = 200;
if (attrnav->trace_started) { if (attrnav->trace_started) {
brow_TraceScan(attrnav->brow->ctx); brow_TraceScan(attrnav->brow->ctx);
trace_timerid = new QTimer(); initOneShotTimer(trace_timerid, SLOT(trace_scan()), 200);
trace_timerid->setSingleShot(true);
connect(trace_timerid, SIGNAL(timeout()), this, SLOT(trace_scan()));
trace_timerid->start(time);
} }
} }
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#endif #endif
#include <QObject> #include <QObject>
#include <QTimer>
#include <QWidget> #include <QWidget>
class AttrNavQtTraceObject; class AttrNavQtTraceObject;
...@@ -72,9 +71,7 @@ class AttrNavQtTraceObject : public QObject { ...@@ -72,9 +71,7 @@ class AttrNavQtTraceObject : public QObject {
Q_OBJECT Q_OBJECT
public: public:
AttrNavQtTraceObject(AttrNavQt* parent) : QObject(), attrnav(parent) AttrNavQtTraceObject(AttrNavQt* parent);
{
}
~AttrNavQtTraceObject(); ~AttrNavQtTraceObject();
public slots: public slots:
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include "ge_graph_qt.h" #include "ge_graph_qt.h"
#include "ge_attr_qt.h" #include "ge_attr_qt.h"
#include <QTimer>
GraphQt::GraphQt(void* xn_parent_ctx, QWidget* xn_parent_wid, GraphQt::GraphQt(void* xn_parent_ctx, QWidget* xn_parent_wid,
const char* xn_name, QWidget** w, pwr_tStatus* status, const char* xn_name, QWidget** w, pwr_tStatus* status,
const char* xn_default_path, graph_eMode graph_mode, int scrollbar, const char* xn_default_path, graph_eMode graph_mode, int scrollbar,
...@@ -53,6 +55,7 @@ GraphQt::GraphQt(void* xn_parent_ctx, QWidget* xn_parent_wid, ...@@ -53,6 +55,7 @@ GraphQt::GraphQt(void* xn_parent_ctx, QWidget* xn_parent_wid,
parent_wid(xn_parent_wid) parent_wid(xn_parent_wid)
{ {
trace_obj = new GraphQtTraceObject(this); trace_obj = new GraphQtTraceObject(this);
trace_timerid = new QTimer(trace_obj);
default_access = xn_default_access; default_access = xn_default_access;
if (scrollbar) { if (scrollbar) {
...@@ -105,8 +108,7 @@ GraphQt::~GraphQt() ...@@ -105,8 +108,7 @@ GraphQt::~GraphQt()
void GraphQt::trace_timer_remove() void GraphQt::trace_timer_remove()
{ {
delete trace_obj; delete trace_obj;
delete trace_timerid; trace_timerid->stop();
trace_timerid = 0;
} }
void GraphQtTraceObject::trace_scan() void GraphQtTraceObject::trace_scan()
...@@ -116,11 +118,7 @@ void GraphQtTraceObject::trace_scan() ...@@ -116,11 +118,7 @@ void GraphQtTraceObject::trace_scan()
void GraphQt::trace_timer_add(int time) void GraphQt::trace_timer_add(int time)
{ {
trace_timerid = new QTimer(); initOneShotTimer(trace_timerid, SLOT(trace_scan()),time);
trace_timerid->setSingleShot(true);
QObject::connect(
trace_timerid, SIGNAL(triggered()), trace_obj, SLOT(trace_scan()));
trace_timerid->start(time);
} }
int GraphQt::create_navigator(QWidget* parent) int GraphQt::create_navigator(QWidget* parent)
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "ge_graph.h" #include "ge_graph.h"
#endif #endif
#include <QTimer>
#include <QWidget> #include <QWidget>
class GraphQtTraceObject; class GraphQtTraceObject;
...@@ -113,7 +112,6 @@ public slots: ...@@ -113,7 +112,6 @@ public slots:
private: private:
GraphQt* graph; GraphQt* graph;
QTimer* trace_timerid;
}; };
#endif #endif
\ No newline at end of file
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "ge_subgraphs_qt.h" #include "ge_subgraphs_qt.h"
#include <QMenuBar> #include <QMenuBar>
#include <QTimer>
#include <QVBoxLayout> #include <QVBoxLayout>
void SubGraphsQtWidget::closeEvent(QCloseEvent* event) void SubGraphsQtWidget::closeEvent(QCloseEvent* event)
...@@ -185,17 +186,18 @@ void SubGraphsQt::trace_start() ...@@ -185,17 +186,18 @@ void SubGraphsQt::trace_start()
toplevel->trace_scan(); toplevel->trace_scan();
} }
void SubGraphsQtWidget::trace_scan() SubGraphsQtWidget::SubGraphsQtWidget(SubGraphsQt* parent_ctx, QWidget* parent)
: QWidget(), subgraphs(parent_ctx)
{ {
int time = 200; trace_timerid = new QTimer(this);
}
void SubGraphsQtWidget::trace_scan()
{
if (subgraphs->trace_started) { if (subgraphs->trace_started) {
brow_TraceScan(subgraphs->brow->ctx); brow_TraceScan(subgraphs->brow->ctx);
trace_timerid = new QTimer(this); initOneShotTimer(trace_timerid, SLOT(trace_scan()), 200);
trace_timerid->setSingleShot(true);
connect(trace_timerid, SIGNAL(timeout()), this, SLOT(trace_scan()));
trace_timerid->start(time);
} }
} }
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "ge_subgraphs.h" #include "ge_subgraphs.h"
#endif #endif
#include <QTimer>
#include <QWidget> #include <QWidget>
/*! \file ge_subgraphs_qt.h /*! \file ge_subgraphs_qt.h
...@@ -74,10 +73,7 @@ class SubGraphsQtWidget : public QWidget { ...@@ -74,10 +73,7 @@ class SubGraphsQtWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
SubGraphsQtWidget(SubGraphsQt* parent_ctx, QWidget* parent) SubGraphsQtWidget(SubGraphsQt* parent_ctx, QWidget* parent);
: QWidget(), subgraphs(parent_ctx)
{
}
protected: protected:
void focusInEvent(QFocusEvent* event); void focusInEvent(QFocusEvent* event);
......
...@@ -45,15 +45,8 @@ static void scroll_callback(glow_sScroll* data) ...@@ -45,15 +45,8 @@ static void scroll_callback(glow_sScroll* data)
widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data; widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data;
QtScrollWidgetGlow* colpal = ((QtScrollWidgetGlow*)scroll_data->parent); QtScrollWidgetGlow* colpal = ((QtScrollWidgetGlow*)scroll_data->parent);
if (colpal->scroll_timerid) { initOneShotTimer(colpal->scroll_timerid, SLOT(scroll_callback_cb()), 200);
delete colpal->scroll_timerid;
}
colpal->scroll_timerid = new QTimer();
colpal->scroll_timerid->setSingleShot(true);
QObject::connect(colpal->scroll_timerid, SIGNAL(timeout()), colpal,
SLOT(scroll_callback_cb()));
colpal->scroll_timerid->start(200);
colpal->scroll_data = *data; colpal->scroll_data = *data;
} }
......
...@@ -44,15 +44,8 @@ static void scroll_callback(glow_sScroll* data) ...@@ -44,15 +44,8 @@ static void scroll_callback(glow_sScroll* data)
widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data; widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data;
CurveWidgetQt* curve = ((CurveWidgetQt*)scroll_data->parent); CurveWidgetQt* curve = ((CurveWidgetQt*)scroll_data->parent);
if (curve->scroll_timerid) { initOneShotTimer(curve->scroll_timerid, SLOT(scroll_callback_cb()), 200);
delete curve->scroll_timerid;
}
curve->scroll_timerid = new QTimer();
curve->scroll_timerid->setSingleShot(true);
QObject::connect(curve->scroll_timerid, SIGNAL(timeout()), curve,
SLOT(scroll_callback_cb()));
curve->scroll_timerid->start(200);
curve->scroll_data = *data; curve->scroll_data = *data;
} }
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include <QColorDialog> #include <QColorDialog>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMouseEvent> #include <QMouseEvent>
#include <QTimer>
#define DRAW_PRESS_PIX 9 #define DRAW_PRESS_PIX 9
...@@ -303,10 +304,6 @@ GlowDrawQt::~GlowDrawQt() ...@@ -303,10 +304,6 @@ GlowDrawQt::~GlowDrawQt()
if (nav_wind->background_pixmap) { if (nav_wind->background_pixmap) {
delete nav_wind->background_pixmap; delete nav_wind->background_pixmap;
} }
if (timer_id) {
delete timer_id;
}
} }
int GlowDrawQt::init_nav(QWidget* nav_widget) int GlowDrawQt::init_nav(QWidget* nav_widget)
...@@ -327,8 +324,9 @@ int GlowDrawQt::init_nav(QWidget* nav_widget) ...@@ -327,8 +324,9 @@ int GlowDrawQt::init_nav(QWidget* nav_widget)
GlowDrawQt::GlowDrawQt(QWidget* toplevel, void** glow_ctx, GlowDrawQt::GlowDrawQt(QWidget* toplevel, void** glow_ctx,
int (*init_proc)(QWidget* w, GlowCtx* ctx, void* client_data), int (*init_proc)(QWidget* w, GlowCtx* ctx, void* client_data),
void* client_data, glow_eCtxType type) void* client_data, glow_eCtxType type)
: timer_id(0), click_sensitivity(0), closing_down(0) : click_sensitivity(0), closing_down(0)
{ {
timer_id = new QTimer(this);
m_wind = new DrawWindQt(); m_wind = new DrawWindQt();
nav_wind = new DrawWindQt(); nav_wind = new DrawWindQt();
nav_wind->is_nav = 1; nav_wind->is_nav = 1;
...@@ -1591,18 +1589,14 @@ bool GlowDrawQt::draw_timer_cb() ...@@ -1591,18 +1589,14 @@ bool GlowDrawQt::draw_timer_cb()
bool GlowDrawQt::event_timer_cb() bool GlowDrawQt::event_timer_cb()
{ {
delete timer_id; timer_id->stop();
timer_id = 0;
event_handler(last_event); event_handler(last_event);
return FALSE; return FALSE;
} }
void GlowDrawQt::cancel_event_timer() void GlowDrawQt::cancel_event_timer()
{ {
if (timer_id) { timer_id->stop();
delete timer_id;
timer_id = 0;
}
} }
void GlowDrawQt::event_timer(QMouseEvent *event) void GlowDrawQt::event_timer(QMouseEvent *event)
...@@ -1612,10 +1606,7 @@ void GlowDrawQt::event_timer(QMouseEvent *event) ...@@ -1612,10 +1606,7 @@ void GlowDrawQt::event_timer(QMouseEvent *event)
} }
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers()); last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
timer_id = new QTimer(); initOneShotTimer(timer_id, SLOT(event_timer_cb()), 200);
timer_id->setSingleShot(true);
QObject::connect(timer_id, SIGNAL(timeout()), this, SLOT(event_timer_cb()));
timer_id->start(200);
} }
void GlowDrawQt::set_timer(GlowCtx* paintertx, int time_ms, void GlowDrawQt::set_timer(GlowCtx* paintertx, int time_ms,
...@@ -1624,11 +1615,9 @@ void GlowDrawQt::set_timer(GlowCtx* paintertx, int time_ms, ...@@ -1624,11 +1615,9 @@ void GlowDrawQt::set_timer(GlowCtx* paintertx, int time_ms,
timer_cb = new glow_draw_sTimerCb(); timer_cb = new glow_draw_sTimerCb();
timer_cb->ctx = paintertx; timer_cb->ctx = paintertx;
timer_cb->callback_func = callback_func; timer_cb->callback_func = callback_func;
timer_cb->timer_id = new QTimer(this);
timer_cb->timer_id = new QTimer(); initOneShotTimer(timer_cb->timer_id, SLOT(draw_timer_cb()), time_ms);
timer_cb->timer_id->setSingleShot(true);
connect(timer_cb->timer_id, SIGNAL(timeout()), this, SLOT(draw_timer_cb()));
timer_cb->timer_id->start(time_ms);
*id = (void*)timer_cb; *id = (void*)timer_cb;
} }
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <QPixmap> #include <QPixmap>
#include <QPoint> #include <QPoint>
#include <QRect> #include <QRect>
#include <QTimer>
#include <QWidget> #include <QWidget>
#define DRAW_CLIP_SIZE 10 #define DRAW_CLIP_SIZE 10
......
...@@ -45,15 +45,8 @@ static void scroll_callback(glow_sScroll* data) ...@@ -45,15 +45,8 @@ static void scroll_callback(glow_sScroll* data)
widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data; widget_sScroll* scroll_data = (widget_sScroll*)data->scroll_data;
QtScrollWidgetGlow* grow = ((QtScrollWidgetGlow*)scroll_data->parent); QtScrollWidgetGlow* grow = ((QtScrollWidgetGlow*)scroll_data->parent);
if (grow->scroll_timerid) { initOneShotTimer(grow->scroll_timerid, SLOT(scroll_callback_cb()), 200);
delete grow->scroll_timerid;
}
grow->scroll_timerid = new QTimer();
grow->scroll_timerid->setSingleShot(true);
QObject::connect(grow->scroll_timerid, SIGNAL(timeout()), grow,
SLOT(scroll_callback_cb()));
grow->scroll_timerid->start(200);
grow->scroll_data = *data; grow->scroll_data = *data;
} }
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "glow_scroll_widget_qt.h" #include "glow_scroll_widget_qt.h"
#include <QPainter> #include <QPainter>
#include <QTimer>
void QtScrollWidgetGlow::createBuffer(QSize size) void QtScrollWidgetGlow::createBuffer(QSize size)
{ {
...@@ -65,6 +66,7 @@ void QtScrollWidgetGlow::init(unsigned int eCtxType, ...@@ -65,6 +66,7 @@ void QtScrollWidgetGlow::init(unsigned int eCtxType,
this->init_proc = init_proc; this->init_proc = init_proc;
this->init_widget_proc = init_proc2; this->init_widget_proc = init_proc2;
this->client_data = client_data; this->client_data = client_data;
this->scroll_timerid = new QTimer(this);
} }
QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType, QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType,
...@@ -78,6 +80,7 @@ QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType, ...@@ -78,6 +80,7 @@ QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType,
this->init_proc = init_proc; this->init_proc = init_proc;
this->init_widget_proc = init_proc2; this->init_widget_proc = init_proc2;
this->client_data = client_data; this->client_data = client_data;
this->scroll_timerid = new QTimer(this);
QScrollArea* form = new QScrollArea(); QScrollArea* form = new QScrollArea();
scroll_h = form->horizontalScrollBar(); scroll_h = form->horizontalScrollBar();
...@@ -98,6 +101,7 @@ void QtScrollWidgetGlow::init(unsigned int eCtxType, QWidget* main) ...@@ -98,6 +101,7 @@ void QtScrollWidgetGlow::init(unsigned int eCtxType, QWidget* main)
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true); setMouseTracking(true);
this->ctxType = eCtxType; this->ctxType = eCtxType;
this->scroll_timerid = new QTimer(this);
is_navigator = 1; is_navigator = 1;
main_widget = main; main_widget = main;
} }
...@@ -252,6 +256,7 @@ void QtScrollWidgetGlow::handleEvent(QEvent* event) ...@@ -252,6 +256,7 @@ void QtScrollWidgetGlow::handleEvent(QEvent* event)
bool QtScrollWidgetGlow::event(QEvent* event) bool QtScrollWidgetGlow::event(QEvent* event)
{ {
if (event->type() == QEvent::Resize) { if (event->type() == QEvent::Resize) {
emit resize_signal((QResizeEvent*)event);
createBuffer(((QResizeEvent*)event)->size()); createBuffer(((QResizeEvent*)event)->size());
} }
if (!is_realized if (!is_realized
......
...@@ -112,6 +112,9 @@ public slots: ...@@ -112,6 +112,9 @@ public slots:
void scroll_h_action(int value); void scroll_h_action(int value);
void scroll_v_action(int value); void scroll_v_action(int value);
void scroll_callback_cb(); void scroll_callback_cb();
signals:
void resize_signal(QResizeEvent*);
}; };
#endif // GLOW_SCROLL_WIDGET_QT_H #endif // GLOW_SCROLL_WIDGET_QT_H
\ No newline at end of file
...@@ -49,12 +49,13 @@ ...@@ -49,12 +49,13 @@
#include "xtt_methodtoolbar_qt.h" #include "xtt_methodtoolbar_qt.h"
#include "xtt_xnav.h" #include "xtt_xnav.h"
#include <QTimer>
XttMethodToolbarQt::XttMethodToolbarQt(void* parent_ctx, void* xnav, XttMethodToolbarQt::XttMethodToolbarQt(void* parent_ctx, void* xnav,
unsigned int op_method_mask, unsigned int mnt_method_mask, unsigned int op_method_mask, unsigned int mnt_method_mask,
const char* tooltip_suffix) const char* tooltip_suffix)
: XttMethodToolbar( : XttMethodToolbar(
parent_ctx, xnav, op_method_mask, mnt_method_mask, tooltip_suffix), parent_ctx, xnav, op_method_mask, mnt_method_mask, tooltip_suffix)
m_timerid(0)
{ {
for (int i = 0; i < 64; i++) { for (int i = 0; i < 64; i++) {
m_cb[i].mt = this; m_cb[i].mt = this;
...@@ -62,14 +63,12 @@ XttMethodToolbarQt::XttMethodToolbarQt(void* parent_ctx, void* xnav, ...@@ -62,14 +63,12 @@ XttMethodToolbarQt::XttMethodToolbarQt(void* parent_ctx, void* xnav,
} }
object = new XttMethodToolbarQtObject(this); object = new XttMethodToolbarQtObject(this);
m_timerid = new QTimer(object);
} }
XttMethodToolbarQt::~XttMethodToolbarQt() XttMethodToolbarQt::~XttMethodToolbarQt()
{ {
debug_print("XttMethodToolbarQt::~XttMethodToolbarQt\n"); debug_print("XttMethodToolbarQt::~XttMethodToolbarQt\n");
if (m_timerid) {
delete m_timerid;
}
if (m_toolbar_w) { if (m_toolbar_w) {
delete m_toolbar_w; delete m_toolbar_w;
} }
...@@ -157,20 +156,12 @@ QWidget* XttMethodToolbarQt::build() ...@@ -157,20 +156,12 @@ QWidget* XttMethodToolbarQt::build()
void XttMethodToolbarQt::set_sensitive() void XttMethodToolbarQt::set_sensitive()
{ {
if (m_timerid) { initOneShotTimer(m_timerid, SLOT(set_sensitive_cb()), 400);
delete m_timerid;
}
m_timerid = new QTimer(object);
m_timerid->setSingleShot(true);
QObject::connect(
m_timerid, SIGNAL(triggered()), object, SLOT(set_sensitive_cb()));
m_timerid->start(400);
} }
void XttMethodToolbarQtObject::set_sensitive_cb() void XttMethodToolbarQtObject::set_sensitive_cb()
{ {
toolbar->m_timerid = 0; toolbar->m_timerid->stop();
toolbar->set_current_sensitive(); toolbar->set_current_sensitive();
} }
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include "xtt_methodtoolbar.h" #include "xtt_methodtoolbar.h"
#include <QAction> #include <QAction>
#include <QTimer>
#include <QToolBar> #include <QToolBar>
class XttMethodToolbarQt; class XttMethodToolbarQt;
......
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