[Qt-interest] Accessing a non model dialog

Phil phillor at telstra.com
Tue Feb 16 05:50:47 CET 2010


Thank you for reading this.

I'm trying to access the widgets on a non model dialog from outside of the 
non modal class itself. This may sound a little confusing and I hope the 
following code may help explain what I'm trying to achieve.

A menu item in the parent class causes the non model diolag (ClassB) to be 
displayed using this code:

void ClassB::showDialog()
{
    display = new ClassB(this);

    display->show();
}

Once the dialog has displayed I can then update a text label with the 
following code, but only from within ClassB:

displayText("text", display); 

void  ClassB::displayText(QString str, ClassB *display)
{
    display->m_ui->label->setText(str);
}

The question is, how do I access the label from the parent class? I tried 
creating the display pointer in the parent's constructor and then passing it 
to ClassB but that doesn't work.

-- 
Regards,
Phil



More information about the Qt-interest-old mailing list