-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Qt: Fixing restore from system tray behaviour of main window #11859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When restoring the main window from the system tray, it always was in minimized state (at least on Windows). This patch should fix this. The window should restore to the same state as it was at the moment of minimizing it into the tray.
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be tested in linux too. BTW see #941.
src/qt/bitcoingui.cpp
Outdated
| { | ||
| QTimer::singleShot(0, this, SLOT(showMaximized())); | ||
| } | ||
| else if (wsevt->oldState() & Qt::WindowFullScreen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove fullscreen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
src/qt/bitcoingui.cpp
Outdated
| } | ||
| } | ||
| #endif | ||
| QMainWindow::changeEvent(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought, it makes senses to reorder. But I see, it makes no sense. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could have some reason, otherwise it's unrelated to your goal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was, that theoretically we don't know what QMainWindow::changeEvent does. So if I want to add something "on top" of the default behaviour, I have to do it after that and not before. But this is kind of a academical thought. To be honest, I am not a Qt expert.
* Removing unnecessary handling of full screen state handling * Restoring original order of calling parent's changeEvent before own implementation
|
Besides Windows 10, I also have testetd on Kubuntu 16.04 (Plasma) and Ubuntu 16.04 (Gnome) . Seems to be fine to me. However, on Gnome there is no system tray. So if you minimize to tray, you loose visual reference to your application. But this is nothing that this patch introduces, it is a conceptual problem that we have already. Failed CI test seems not to be related to my changes. Sporadic errors maybe? Could you please run the tests again? |
|
I've restarted the travis build. |
|
@laanwj me too, about an hour ago. Was it still failing? |
Yes.
Yes we've had so much problems with this feature in the past... If it turns out it's just not possible to do this reliably with Qt it'd be better to remove it. |
Only linux, or all? |
|
Meanwhile I also read a about some past tray icon issues with different OSes. Seems that Qt can't do it right everywhere. Anyway, I have the impression, that minimizing to tray is a common thing to do on Windows. However, on Linux this is not the case (see GNOME). On Mac I don't know. What about keeping the minimize to tray feature only on Windows? |
It's already disabled on MacOSX, along with the other window options: #ifdef Q_OS_MAC
/* remove Window tab on Mac */
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
#endif
Sounds good to me - but I'm not sure whether any Linux users use it, I don't at least... |
|
Can reproduce the issue on Windows 8.1. OSX does not do minimise to tray... |
|
I have made an additional change that hides the tray icon for non-Windows systems, disables the "Hide tray icon" and "Minimize to tray" options on the Settings' Winwow tab and sets the according settings in the OptionsModel (removing them from the configuration file). On Windows, evertything works as before. On other systems, no tray icon is visible, and no tray icon settings are available. The "Minimize on close" option still exists on all OSes. Should I create a new PR, or should I just add those changes to this one? |
|
Probably best to do so as a new PR, as the change is not directly pertinent to this one.
|
| { | ||
| if (wsevt->oldState() & Qt::WindowMaximized) | ||
| { | ||
| QTimer::singleShot(0, this, SLOT(showMaximized())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried qApp->processEvents(); instead of the singleshot()?
|
Needs squash and linux testing. |
|
Last reply from author is some time last year, closing and adding "Up for grabs" (let me know if you start work againand I should reopen). |
When restoring the main window from the system tray, it always was in minimized state (at least on Windows). This patch should fix this. The window should restore to the same state as it was at the moment of minimizing it into the tray.
May be related to issue #8225
To reproduce the bug do following under Windows:
The main window's taskbar icon appears, but the window itself is not restored to its original size.
Expected behaviour: the window should appear.