Did you initialize your ui and did you set the pointer guiClass right? Can we see the implementation?
EDIT: why do you don't use signals and slots? Any particular reasons for that. Because your case seems to be classical case for using signals.
Did you initialize your ui and did you set the pointer guiClass right? Can we see the implementation?
EDIT: why do you don't use signals and slots? Any particular reasons for that. Because your case seems to be classical case for using signals.
Last edited by Lykurg; 28th November 2009 at 21:44. Reason: updated contents
Put a BP on the "wrong part" and check the values of guiclass and ui.
You do initialise guiClass in anotherClass don't you?
.
.
Thank you !
Did you initialize your ui and did you set the pointer guiClass right? Can we see the implementation?Qt Code:
{ ui->setupUi(this); //this->ui->progressBar->setValue(80); // IT WORKS, but it is in guiClass anotherClass *anotherclass = new anotherClass(this); anotherclass->anything(); } guiClass ::~guiClass () { delete ui; }To copy to clipboard, switch view to plain text mode
@Lykurg : I don't use SIGNALS and SLOTS because I don't know how to use them
Moreover, I'd prefer to do it without signals and slots.
@fatjuicymole : what is a BP ?
PS: I'm a beginner.
BP = Breakpoint
Where do you initialise guiClass in anotherClass?
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
I knew it! you haven't set the pointer guiClass in anotherClass. So you accessing a null pointer!
Qt Code:
Q_OBJECT public: void anything(); guiClass *guiClass; void setBackPointer(guiClass *p) {guiClass = p;} // <- add }; // and then { ui->setupUi(this); anotherClass *anotherclass = new anotherClass(this); anotherclass->setBackPointer(this); // <- add anotherclass->anything(); }To copy to clipboard, switch view to plain text mode
you can also use the parent of your constructor for setting the back pointer, but you really should learn signal and sots...
fitzy (29th November 2009)
You're right !
I didn't set the pointer guiClass in anotherClass.
Thank you so much !
Bookmarks