PDA

View Full Version : Reimplementation Minimize button



clousque
6th May 2014, 15:17
Hi Folks,

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



void MainWindow::slotMinimizeWindow()
{
this->setWindowState(Qt::WindowMinimized);
}


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

ChrisW67
7th May 2014, 09:01
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?

clousque
7th May 2014, 09:11
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:


void MainWindow::slotMinimizeWindow()
{
this->setWindowState(Qt::WindowMinimized);
}

Hope this helps to understand my question.

Thanks

clousque
13th May 2014, 15:15
I answer myself,
Playing around WindowState is no the correct way to do the thing. Instead I used:

void MainWindow::slotMinimizeWindow()
{
this->showMinimized();
}

Still learning...

anda_skoa
13th May 2014, 15:32
Since showMininized() is a slot, you can probably connect to it directly and don't need your slotMininizeWindow() anymore.

Cheers,
_

clousque
13th May 2014, 16:21
Thanks for the advice.