I did NOT use qt designer to design the ui,I just use code to generate the myprog.cpp and myprog.h and main.cpp,
This is the important point.
quote:
NOW I wanna add init() function to make initailize some variations on running,so I generate another file called myprog.ui.h and put the follow code into it:
Whatever name you give your file, it's not important. The problem is elsewhere. Your method and declaration is fine too.
quote:
Then I compile the program and run it. THE textlabel did NOT display anything!!WHY?
Designer manual states that init() method is automatically called if present. Yes, right, but only for designer generated UI and NOT for hand generated ones.
What uic does looks like the following(edit: comments added to explain uic job):
code:
MyClass::MyClass( QObject * parent, const char * name )
: QWidget( parent, name )
{
if ( !name )
setNam
This is the important point.
quote:
NOW I wanna add init() function to make initailize some variations on running,so I generate another file called myprog.ui.h and put the follow code into it:
Whatever name you give your file, it's not important. The problem is elsewhere. Your method and declaration is fine too.
quote:
Then I compile the program and run it. THE textlabel did NOT display anything!!WHY?
Designer manual states that init() method is automatically called if present. Yes, right, but only for designer generated UI and NOT for hand generated ones.
What uic does looks like the following(edit: comments added to explain uic job):
code:
MyClass::MyClass( QObject * parent, const char * name )
: QWidget( parent, name )
{
if ( !name )
setNam