Toolbar customize dialog



  • Hi

    Have a nice day,I had requirement to develop toolbar customize dialog use in Qt i decide to use QDialog widget for it if some one have better experience or idea about it please share with me

    Thanks


  • Moderators

    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 ;)



  • yes content of dialog is create by my self if I used QFrame, it had advantages compare with QDialog i havn't any idea about QFrame because i am still not use QFrame. Thanks for your reply


  • Moderators

    only if you want to be open for styling and/or frame border later on?
    If not you're just fine with QDialog...



  • According to your answer and consider with my future developments i think QFrame is most suitable for my work thanks for your reply :)


  • Moderators

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.