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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -