That didn't help either
I also tried accepting and/or ignoring events and also didn't work, the window is still not hidden from the taskbar and the client area not painted.
That didn't help either
I also tried accepting and/or ignoring events and also didn't work, the window is still not hidden from the taskbar and the client area not painted.
]Qt Code:
{ { //Now check to see if the window is minimised if (isMinimized()) { hide (); } } }To copy to clipboard, switch view to plain text mode
Is this what you did?
EDIT: This is what you need to do. You have to let QDialog handle the change event. You must not accept nor ignore the event. Just hide your window.
regards
Last edited by marcel; 17th April 2007 at 08:21.
aLiNuSh (17th April 2007)
Maybe... I tried so many different combinations I can't remember anymore.
Anyways I tried it now and it does the same thing... when I push the minimize button the window minimizes to the taskbar and the taskbar "button for the window" disappears and appears again quickly, and then when I maximize it, the window shows on the screen but the client area is not painted. Obviously it has to be something with some of the events not being forwarded for default processing... i just don't know what I'm missing here...![]()
![]()
Could you show me the actual code? The one that you last tried![]()
I just closed Notepad++ and deleted the code... basically I've tried reimplementing changeEvent () or event () sometimes accepting or rejecting the events, sometimes returning true or false or QWidget::changeEvent ()/event() and other different combinations.
I lost 4 hours on this stupid thing and still haven't got it working.
Anyways thanks for the assistance and maybe when I'll feel masochist enough I'll retry it :P
We're from the same country BTW
LE: tried the edited one too.. same thing![]()
Last edited by aLiNuSh; 17th April 2007 at 09:13.
Hi !
I also have the problem with the systrayicon and minimize
so i try following ...
Qt Code:
// Overload original event-handler: { // Check if Window-State changed to minimize ... { //Now check to see if the window is minimised if (isMinimized()) { // Call the Hide Slot after 250ms // to prozess other events .... qApp->processEvents(); evt->ignore(); } } // Call original-handler (in this case QMainWindow ...) }To copy to clipboard, switch view to plain text mode
... this work's on windows !
Use the below code it might be helpful to you.......
Qt Code:
//System tray icon action context menu connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide())); connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized())); connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal())); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); //ToolbarAction(itemExit).icon(), ToolbarAction(itemExit).text(), parent); cmenu.addAction(tr("Show"), this, SLOT(show())); cmenu.addAction(tr("Hide"), this, SLOT(hide())); cmenu.addSeparator(); cmenu.addAction(minimizeAction); cmenu.addAction(maximizeAction); cmenu.addAction(restoreAction); cmenu.addAction(quitAction);To copy to clipboard, switch view to plain text mode
Hi, here is a solution, and I think it works quite well in my application:
In the dialog's slot that connects with the activated() signal of the QSystemTrayIcon object, use the setParent() function as:
Qt Code:
{ setParent(NULL, Qt::Window); showNormal(); sysTrayIcon->hide(); } }To copy to clipboard, switch view to plain text mode
And in the dialog's event() function:
Qt Code:
{ if (isMinimized()) { setParent(tmp, Qt::SubWindow); sysTrayIcon->show(); e->ignore(); qDebug()<<"event() called"; } else { e->accept(); } } }To copy to clipboard, switch view to plain text mode
Here, 'tmp' is an empty QWidget serving as a provisional 'parent' of the dialog, so that the dialog can be hidden from task-bar when minimized. In fact, you can just pass NULL as the first argument for the 'parent' widget, but in this case probably the re-stored window would exhibit slightly different with the original window size.
Bookmarks