Results 1 to 5 of 5

Thread: window buttons

  1. #1
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    61
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default window buttons

    How to disconnect buttons (setEnabled(false)) close, maximize and minimize of QMainWindow? Or make the window size fixed.

  2. #2
    Join Date
    Oct 2011
    Location
    Germany
    Posts
    27
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: window buttons

    Qt Code:
    1. setWindowFlags ( Qt::WindowFlags type )
    To copy to clipboard, switch view to plain text mode 
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein

  3. #3
    Join Date
    Nov 2009
    Posts
    61
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: window buttons

    Quote Originally Posted by jaca View Post
    How to disconnect buttons (setEnabled(false)) close, maximize and minimize of QMainWindow? Or make the window size fixed.
    I don't know if it's possible to do what you want to. If you call setWindowFlags(Qt::CustomizeWindowHint) you remove all buttons and a title bar from a window but you still can resize it. Each flag from Qt namespace simply adds a button one by one and other window features. You should read this:
    http://doc.qt.nokia.com/4.7-snapshot...indowType-enum

    Perhaps there is a lower level hard coding fulfil this but I don't know about it.

  4. #4
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    61
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: window buttons

    Works well doing:
    Qt Code:
    1. setWindowFlags( Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::MSWindowsFixedSizeDialogHint);
    To copy to clipboard, switch view to plain text mode 
    But, using the class QMainWindow some event is enabled and you can resize the window. An attached image shows where the event occurs.
    programa.png

  5. #5
    Join Date
    Nov 2009
    Posts
    61
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: window buttons

    Hi. Good job with what you have achieved so far . In your example though I still could still resize a window. I have also found the function setFixedSize(windoWidth, windowHeigth). If you use it as follows:

    MainWindow w;
    w.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint ); // or whatever other flags
    w.setFixedSize(w.width(),w.height());
    w.show();

    You may have your window fixed but I still have seen the "resize" icon at the window's corner.

    Reference:
    http://stackoverflow.com/questions/6...e-a-fixed-size
    Last edited by ZikO; 12th August 2012 at 03:04.

  6. The following user says thank you to ZikO for this useful post:

    jaca (12th August 2012)

Similar Threads

  1. Replies: 1
    Last Post: 14th July 2012, 08:59
  2. Replies: 6
    Last Post: 9th November 2011, 04:31
  3. GraphicsView / Scene window minimize maximize buttons
    By erikusa in forum Qt Programming
    Replies: 0
    Last Post: 16th December 2010, 00:47
  4. Custom Window Title Buttons / Colors
    By Sven in forum Qt Programming
    Replies: 7
    Last Post: 27th September 2010, 09:31
  5. Main window with custom buttons ?
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2006, 06:32

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.