PDA

View Full Version : optionDialog



mickey
24th February 2006, 14:30
Hi,
I have a optAction in Mainform that calls an optionDialog (designed from qtDesigner).
In optionDialog when I pusk on save button start the SLOT saveOptions()
I like to do this inside optiondialog.ui.h file:


#include <qfile.h>
#include <mainform.h>
class MainForm;

void optionDialog::saveOptions()
{
MainForm* m;
m->toolBox->show(); //access to mainform
}
But this don't compile. Is there a way?

zlatko
24th February 2006, 14:34
what error compiler give?

mickey
24th February 2006, 14:43
sorry it isn't error. But I must to retrieve this:

MainForm* m= (MainForm*) this->topLevelWidget();
but this->topLevelWidget() isn't what I want.....

zlatko
24th February 2006, 14:47
I think you need give pointer on MainForm object to your optionDialog and then use this pointer.

mickey
24th February 2006, 14:55
I prefer from optionDialog access to mainForm. In any way my problem is how to do....
thanks

zlatko
24th February 2006, 15:09
Subclass your optionDialog. And create it from mainForm class.



MainForm::MainForm()
{
optionDialogNew *optDIalog = new optionDialogNew(this);
}

****
void optionDialogNew::optionDialogNew(MainForm*pParent) : optionDialog
{
// some private class member
m_pParent = pParent;
}


void optionDialogNew::saveOptions()
{
m_pParent->toolBox->show(); //access to mainform
}