[Qt-interest] MDI Question

JD Guzman lostinthecode at googlemail.com
Wed Sep 16 15:02:48 CEST 2009


 Hello all,

I have a quick question.  I'm making a MDI app and am having a small issue
with Sub Windows.  From the main app window menu bar I create a sub window
using the following code.

void MainWindow::showPreferences()
{
Preferences *prefs = new Preferences;
ui->mdiArea->addSubWindow(prefs);
prefs->show();
}


This works fine and the windows shows inside the mdi area.  The prefs window
has a button box and the accepted and rejected signals are connected like
this:


void Preferences::connectActions()
{
QObject::connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
QObject::connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}

void Preferences::accept()
{
this->close();
}

void Preferences::reject()
{
this->close();
}


The problem is that when either the slot is called the window remains but
the contents (which at the moment is only the button box) disappear.  I then
have to press the "X" manually to fully close the window.  Furthermore if I
remove the ui->mdiArea->addSubWindow(prefs) call everything works as
expected, with the difference that the prefs window is no longer in the mdi
area.


Any ideas?


Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090916/a41899ab/attachment.html 


More information about the Qt-interest-old mailing list