Results 1 to 6 of 6

Thread: Reimplementation Minimize button

  1. #1
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Reimplementation Minimize button

    Hi Folks,

    I try to reimplement the minimize button by doing this in the slot connected to the button

    Qt Code:
    1. void MainWindow::slotMinimizeWindow()
    2. {
    3. this->setWindowState(Qt::WindowMinimized);
    4. }
    To copy to clipboard, switch view to plain text mode 

    This works pretty well when the window was not full screen.

    If the window was full screen (Qt::WindowFullScreen), clicking the task bar restores the window in non full screen state (Qt::WindowNoState). In this case, when minimizing, the window seems to go into an intermediary state corresponding to the previous non full screen state of the window...

    Any advice would be appreciated

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

    Default Re: Reimplementation Minimize button

    Slot connected to what button? There's no exposed signal from the standard window minimise/restore/maximize controls (if they are present). What are you trying to do differently from the long accepted norms of behaviour for these window controls?

  3. #3
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reimplementation Minimize button

    Sorry, my question was not very clear.

    In fact, I have a frameless window with a QPushButton trying to behave like the minimize button. The clicked() signal of the QPushButton is connected to this slot:

    Qt Code:
    1. void MainWindow::slotMinimizeWindow()
    2. {
    3. this->setWindowState(Qt::WindowMinimized);
    4. }
    To copy to clipboard, switch view to plain text mode 

    Hope this helps to understand my question.

    Thanks

  4. #4
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reimplementation Minimize button

    I answer myself,
    Playing around WindowState is no the correct way to do the thing. Instead I used:
    Qt Code:
    1. void MainWindow::slotMinimizeWindow()
    2. {
    3. this->showMinimized();
    4. }
    To copy to clipboard, switch view to plain text mode 

    Still learning...

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Reimplementation Minimize button

    Since showMininized() is a slot, you can probably connect to it directly and don't need your slotMininizeWindow() anymore.

    Cheers,
    _

  6. #6
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reimplementation Minimize button

    Thanks for the advice.

Similar Threads

  1. QPlainTextEdit reimplementation
    By qt_developer in forum Qt Programming
    Replies: 2
    Last Post: 14th November 2012, 15:22
  2. Replies: 1
    Last Post: 5th September 2012, 07:16
  3. QApplication::notify reimplementation
    By sa5webber in forum Newbie
    Replies: 0
    Last Post: 30th August 2012, 23:00
  4. QHeaderView paintSection reimplementation
    By supergillis in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2008, 17:16
  5. keyPressEvent() reimplementation
    By aurelius in forum Newbie
    Replies: 5
    Last Post: 30th October 2008, 16:23

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.