Toolbar customize dialog
-
You plan to create the contents of your dialog all yourself right?
If so you could also use simply QWidget/QFrame, but basically there is nothing wrong using QDialog for convenience ;) -
only if you want to be open for styling and/or frame border later on?
If not you're just fine with QDialog... -
if you need the dialog to be blocking you have to start your own QEventLoop.
To start and show the dialog call the exec() method:@
MyFrameDialog::MyFrameDialog(QWidget* parent) : QFrame(parent)
{
this->setWindowFlags( Qt::Dialog );
m_EventLoop = new QEventLoop(this);
}void MyFrameDialog::closeEvent(QCloseEvent* event)
{
QFrame::closeEvent(event);
if( event->isAccepted() )
m_EventLoop->exit();
}int MyFrameDialog::exec()
{
this->show();
//do other init stuff here (if needed)...
return m_EventLoop->exec();
}
@now connect every button which should close the dialog to the dialogs "close()":http://qt-project.org/doc/qt-4.8/qwidget.html#close slot.