Results 1 to 8 of 8

Thread: QDialog with Close, Maximize and Context Help Buttons

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    1
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QDialog with Close, Maximize and Context Help Buttons

    Hi everyone, I also had this problem.
    I found a easy solution here, sharing with you all.

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4. Dialog w;
    5. w.setWindowFlags(Qt::Window); // add this.
    6. w.show();
    7.  
    8. return a.exec();
    9. }
    To copy to clipboard, switch view to plain text mode 

    Best,

  2. #2
    Join Date
    Mar 2017
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QDialog with Close, Maximize and Context Help Buttons

    This helped, great thanks!

  3. #3
    Join Date
    May 2020
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDialog with Close, Maximize and Context Help Buttons

    To add a bit more information to chshlin's post:

    Note that you can find the complete selection of WindowFlags here:
    https://doc.qt.io/qt-5/qt.html#WindowType-enum

    Qt:: Window has this description:
    Indicates that the widget is a window, usually with a window system frame and a title bar, irrespective of whether the widget has a parent or not. Note that it is not possible to unset this flag if the widget does not have a parent.
    Qt:: Dialog (which seems to be the default for Dialogs) has this description:
    Indicates that the widget is a window that should be decorated as a dialog (i.e., typically no maximize or minimize buttons in the title bar). This is the default type for QDialog. If you want to use it as a modal dialog, it should be launched from another window, or have a parent and used with the QWidget::windowModality property. If you make it modal, the dialog will prevent other top-level windows in the application from getting any input. We refer to a top-level window that has a parent as a secondary window.
    From my testing it appears that you can set Qt ::Window as the window flag without affecting whether the dialog is modal (as in, you can set this flag and still prevent input to the window that showed the dialog).

    Hope that helps,

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.