Rajeshwar
Rajeshwar

Reputation: 11651

Qt - QDialog as a child does not have title bar

I notice that when using my QDialog as a child of my current QMainWindow , the title bar of the QDialog does not get displayed. However if the QDialog does not have a parent attached then title bar gets displayed. Any suggestions on how I can make the title bar appear when the QDialog is a child of my current form.I am on a Mac.

Mydialog.setParent(this); //The title bar will not show if a parent is set
if(Mydialog.exec() == QDialog::Accepted)
 {
    ....     
  }

How can I make the title bar of my Qdialog show with a parent attached to it.

Upvotes: 0

Views: 363

Answers (1)

Murphy
Murphy

Reputation: 3999

As @Mike said, you are supposed to construct the dialog object with the parent passed to the constructor instead of using QObject::setParent(), as many widget properties depend on the parent and it's properties and aren't changed when calling setParent(). Please try if this solves your title bar problem, too.

Upvotes: 1

Related Questions