c++ - QtMainWindow initialized event -
i need start job when qmainwindow
, widgets initialized , rendered.
how can catch such event?
i see 2 ways of doing this.
sophisticated:
void mainwindow::showevent(qshowevent *e) { qmainwindow::showevent(e); static bool firststart = true; if (firststart) { emit startjob(); firststart = false; } }
and easy 1 (suitable only, if show main window right after creating):
mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent) { ... qtimer::singleshot(500, this, slot(job())); }
update:
like chris
said, showevent
more appropriate here, paintevent
.
Comments
Post a Comment