hi, why do I have this console error?? thanks
Qt Code:
//my is a pointer to MainForm class //I'm inside MyWidget constructor connect (my->pushButton21, SIGNAL (pressed()), this, SLOT (mySlot()) );To copy to clipboard, switch view to plain text mode
hi, why do I have this console error?? thanks
Qt Code:
//my is a pointer to MainForm class //I'm inside MyWidget constructor connect (my->pushButton21, SIGNAL (pressed()), this, SLOT (mySlot()) );To copy to clipboard, switch view to plain text mode
Regards
Maybe because my->pushButton21 is null?
ok. but why is it null? button21 is a button of mainform; how do I use it?
Regards
How do you create that "my" object? Maybe you create MyWidget before you initialize button21?Originally Posted by mickey
hi, I don't understand qaht you want say.....the situation is this..
Qt Code:
my = (myMainForm*) this->topLevelWidget(); connect (w->pushButton21, SIGNAL (pressed()), this, SLOT (myStartTimer()) ); }To copy to clipboard, switch view to plain text mode
Regards
Could you post myMainForm constructor?
do u want this?
Qt Code:
: MainForm( parent, name, fl ) { .............. }To copy to clipboard, switch view to plain text mode
Regards
Yes, do you initialize pushButton21 there?Originally Posted by mickey
what do you mean? I insert butt21 from designer....Originally Posted by jacek
Regards
In that case maybe this is wrong:Originally Posted by mickey
What happens when you use dynamic_cast?Qt Code:
my = (myMainForm*) this->topLevelWidget();To copy to clipboard, switch view to plain text mode
Qt Code:
my = dynamic_cast< myMainForm*>( topLevelWidget() ); Q_CHECK_PTR( my );To copy to clipboard, switch view to plain text mode
a rutime error!!! and application is closed...
and without casting (my way) Q_CHECK_PTR( my ); doens't get any arror...
but my is:
Regards
This means that topLevelWidget() might return some other widget than myMainForm.Originally Posted by mickey
hi, using that bellow
it print the follow pointerQt Code:
myw = (myMainForm*) this->topLevelWidget();To copy to clipboard, switch view to plain text mode
so myw in MyWidget point to mainForm.....have you any idea? thanksQt Code:
my_mainfom in myWidget 0012E388 mainfom this in MainForm 0012E388 my_mainfom this in myMainForm 0012E388To copy to clipboard, switch view to plain text mode
Regards
if you created the window in the designer you have to call setupUi( this ); first thing in your classes constructor. Afterwards your pushbutton should exist and you can try to connect it.
He's using Qt3, there is no such thing as setupUi() there.Originally Posted by mikro
ooops. sorry, hadn't realized that.![]()
Bookmarks