Results 1 to 6 of 6

Thread: Mac titlebar buttons Issue.

  1. #1
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Mac titlebar buttons Issue.

    Hi,
    I need to create a window on MAC with just a Close button enabled and minimize and maximize buttons disabled.
    but what i am getting is a window with maximize button enabled and close and minimize button diabled.

    I have tried some variations with setWindowFlags() but of no avail.

    Please help....!

    GK

  2. #2
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Mac titlebar buttons Issue.

    Isn't there a way?

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mac titiebar buttons Issue.

    I tried in the Windows Flags example, and I could get a Close button without minimize or maximize button using -
    Qt::Window | Qt::WindowSystemMenuHint
    but in this u WONT HAVE min/ max buttons... i am not sure if u want them on the window yet disabled....

    Hope this is what u want

  4. #4
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Mac titlebar buttons Issue.

    This does not work for me.
    I want it on MAC. When i use setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint);
    only minimize button is disabled but not the maximized button. I have treid all combinatinos from WindowFlags example but Maximine button on MAC is not disabled...
    Does anybody know a native MAC API to disable maximize button on title bar?

    Help...

    GK

  5. #5
    Join Date
    May 2009
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Mac titlebar buttons Issue.

    This may be a little late, but you need to clear the default Windows Hint first. The following will enable the Close and Maximize button, and disable the Minimize button:

    Qt Code:
    1. setWindowFlags(windowFlags() | Qt::CustomizeWindowHint);
    To copy to clipboard, switch view to plain text mode 

    Now...I too need to find a way to disable the Maximize button. Here are some of the methods I've tried and none of the them were successful for me...

    Qt Code:
    1. Qt::WindowFlags flag = windowFlags() | Qt::CustomizeWindowHint;
    2. //flag ^= Qt::WindowMaximizeButtonHint;
    3. //flag &= ~Qt::WindowMinMaxButtonsHint;
    4. //flag &= ~Qt::WindowMinimizeButtonHint;
    5. //flag &= ~Qt::WindowMaximizeButtonHint;
    6. //flag |= Qt::WindowSystemMenuHint;
    7. setWindowFlags(flag);
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    May 2009
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Mac titlebar buttons Issue.

    Actually, I found a solution to disable the Maximize button thanks to sir_johann in this post:

    http://www.qtcentre.org/forum/f-qt-p...dow--3563.html

    I was using Qt Designer and it did not behave as I expected it to. It was much easier and more reliable to set this attributes programmatically. Therefore, to disable the "Maximize" button on Mac, you need to clear the Maxmize flag and set a fixed size for the widget:

    Qt Code:
    1. Qt::WindowFlags flag = windowFlags() | Qt::CustomizeWindowHint;
    2. flag ^= Qt::WindowMaximizeButtonHint;
    3. setWindowFlags(flag);
    4. setFixedSize(200, 200);
    To copy to clipboard, switch view to plain text mode 

    and the Maximize button will become disabled.
    Last edited by kyue; 9th July 2009 at 22:02.

Similar Threads

  1. Styling QDockWidget's titlebar buttons
    By THRESHE in forum Qt Programming
    Replies: 7
    Last Post: 16th July 2008, 12:30
  2. Replies: 9
    Last Post: 9th May 2006, 19:53

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.