February 19, 2012

MrVirtualCoder MrVirtualCod..
Lab Rat
6 posts

Newbie Question, Main Function?

 

I’m aware that the main function (main()) is the first to get executed.

I’ve written a function which is to check whether a process is running or not, but I want it to be the first thing to execute BEFORE the construction of my GUI — getting loaded into memory.
Calling several GUI objects within the main function, obviously, doesn’t work since they are declared after the main function.

Where am I supposed to call my function, so that it executes firstly?

5 replies

February 19, 2012

shoyeb shoyeb
Lab Rat
99 posts

where u have written ur function, can u please provide some code, so that i can know where is ur problem….

 Signature 

There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

February 19, 2012

MrVirtualCoder MrVirtualCod..
Lab Rat
6 posts
shoyeb wrote:
where u have written ur function, can u please provide some code, so that i can know where is ur problem….

[pre-]Declared within my header (“mainwindow.h”) and also within my GUI deceleration file (“mainwindow.cpp).

February 19, 2012

Jeroentje@home Jeroentje@ho..
Hobby Entomologist
235 posts

Well, if you used designer, I would suggest checking the process before the SetupUi(this) stuff. Or maybe in the main() before the creation of your MainWindow class.
greetz

 Signature 

Greetz, Jeroen

February 19, 2012

MrVirtualCoder MrVirtualCod..
Lab Rat
6 posts

Jeroentje@home wrote:
Well, if you used designer, I would suggest checking the process before the SetupUi(this) stuff. Or maybe in the main() before the creation of your MainWindow class.
greetz

I can’t believe I didn’t see that—thanks for the help!

Got it working now :D

February 20, 2012

shoyeb shoyeb
Lab Rat
99 posts

please mark your thread as solved…

 Signature 

There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

 
  ‹‹ Qt mobility multimedia (qml) and Windows      [SOLVED]Is there a way to define a separate set of icons for the same QActions used in QMenuBar and QToolBar? ››

You must log in to post a reply. Not a member yet? Register here!