hi, why do I have this console error?? thanks
Code:
//my is a pointer to MainForm class //I'm inside MyWidget constructor connect (my->pushButton21, SIGNAL (pressed()), this, SLOT (mySlot()) );
Printable View
hi, why do I have this console error?? thanks
Code:
//my is a pointer to MainForm class //I'm inside MyWidget constructor connect (my->pushButton21, SIGNAL (pressed()), this, SLOT (mySlot()) );
Maybe because my->pushButton21 is null?
ok. but why is it null? button21 is a button of mainform; how do I use it?
How do you create that "my" object? Maybe you create MyWidget before you initialize button21?Quote:
Originally Posted by mickey
hi, I don't understand qaht you want say.....the situation is this..
Could you post myMainForm constructor?
do u want this?
Code:
: MainForm( parent, name, fl ) { .............. }
Yes, do you initialize pushButton21 there?Quote:
Originally Posted by mickey
what do you mean? I insert butt21 from designer....Quote:
Originally Posted by jacek
In that case maybe this is wrong:Quote:
Originally Posted by mickey
What happens when you use dynamic_cast?Code:
my = (myMainForm*) this->topLevelWidget();
Code:
my = dynamic_cast< myMainForm*>( topLevelWidget() ); Q_CHECK_PTR( my );
a rutime error!!! and application is closed...
and without casting (my way) Q_CHECK_PTR( my ); doens't get any arror...
but my is:
Code:
myMainForm* my;
This means that topLevelWidget() might return some other widget than myMainForm.Quote:
Originally Posted by mickey
hi, using that bellow
it print the follow pointerCode:
myw = (myMainForm*) this->topLevelWidget();
so myw in MyWidget point to mainForm.....have you any idea? thanksCode:
my_mainfom in myWidget 0012E388 mainfom this in MainForm 0012E388 my_mainfom this in myMainForm 0012E388
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.Quote:
Originally Posted by mikro
ooops. sorry, hadn't realized that.:o