Results 1 to 16 of 16

Thread: Qdialog with out min,max and close button,,,,,,,,,

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2012
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Qdialog with out min,max and close button,,,,,,,,,

    Hi.....

    Problem with close button.

    I have tried all the ways to hide the close button of my dialog.
    CustomizeWindowHint , Qt::WindowTitleHint , Qt::WindowMinMaxButtonsHint.
    all these three are not working for my dialog......

    any suggestions?

  2. #2
    Join Date
    Oct 2012
    Location
    Northbrook,IL
    Posts
    1

    Default Re: Qdialog with out min,max and close button,,,,,,,,,

    Hello,

    May I know what version are you using?
    It might be the same as what I had experienced.

  3. #3
    Join Date
    Aug 2012
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Qdialog with out min,max and close button,,,,,,,,,


    i am using Qt creator 2.5. and
    have qt 4.6

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qdialog with out min,max and close button,,,,,,,,,

    So you have tried "all the ways" but don't mention the obvious Qt::WindowCloseButtonHint. Did you look at the Window Flags Example code?

    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char **argv)
    4. {
    5. QApplication app(argc, argv);
    6.  
    7. QWidget w;
    8. // or QDialog w;
    9. w.setWindowTitle("Widget");
    10. Qt::WindowFlags f = w.windowFlags();
    11. f |= Qt::CustomizeWindowHint; // set the customise flag
    12. f &= ~(Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint); // unset the unwanted flags
    13. w.setWindowFlags(f);
    14. w.show();
    15.  
    16. QTimer::singleShot(30000, qApp, SLOT(quit()));
    17. return app.exec();
    18. }
    To copy to clipboard, switch view to plain text mode 

    Works as expected on Windows XP. Works on my Linux box with KDE window manager for removing the Close control. Unfortunately the window manager seem to ignore the min/max button hints: if you have a title bar you get these controls.
    Last edited by ChrisW67; 30th October 2012 at 08:45. Reason: updated contents
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

Similar Threads

  1. How to hide close button in QDialog?
    By grantbj74 in forum Newbie
    Replies: 3
    Last Post: 27th September 2011, 01:08
  2. QDialog not showing close button on Mac
    By manojmka in forum Qt Programming
    Replies: 2
    Last Post: 17th September 2008, 12:56
  3. Diasble close button on a QDialog
    By Krish_ng in forum Qt Programming
    Replies: 12
    Last Post: 17th July 2007, 04:23
  4. Replies: 1
    Last Post: 7th July 2007, 09:03
  5. showing close Button(x) in QDialog
    By vishal.chauhan in forum Newbie
    Replies: 6
    Last Post: 4th April 2007, 10:01

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.