Fix visibility incongruences
This commit is contained in:
parent
cac606186a
commit
16d09ace07
|
@ -1037,10 +1037,8 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
|
||||||
// Force the window to show in case somehow the config has tray and window set
|
// Force the window to show in case somehow the config has tray and window set
|
||||||
// to hide
|
// to hide
|
||||||
if (hidden && (!QSystemTrayIcon::isSystemTrayAvailable() || !tray_icon_ ||
|
if (hidden && (!QSystemTrayIcon::isSystemTrayAvailable() || !tray_icon_ ||
|
||||||
!tray_icon_->IsVisible())) {
|
!tray_icon_->IsVisible()))
|
||||||
settings_.setValue("hidden", false);
|
|
||||||
show();
|
show();
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QShortcut* close_window_shortcut = new QShortcut(this);
|
QShortcut* close_window_shortcut = new QShortcut(this);
|
||||||
|
@ -1432,6 +1430,7 @@ void MainWindow::VolumeWheelEvent(int delta) {
|
||||||
void MainWindow::ToggleShowHide() {
|
void MainWindow::ToggleShowHide() {
|
||||||
if (settings_.value("hidden").toBool()) {
|
if (settings_.value("hidden").toBool()) {
|
||||||
show();
|
show();
|
||||||
|
activateWindow();
|
||||||
SetHiddenInTray(false);
|
SetHiddenInTray(false);
|
||||||
} else if (isActiveWindow()) {
|
} else if (isActiveWindow()) {
|
||||||
hide();
|
hide();
|
||||||
|
@ -1466,9 +1465,17 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SetHiddenInTray(bool hidden) {
|
void MainWindow::hideEvent(QHideEvent* event) {
|
||||||
settings_.setValue("hidden", hidden);
|
settings_.setValue("hidden", true);
|
||||||
|
QMainWindow::hideEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::showEvent(QShowEvent* event) {
|
||||||
|
settings_.setValue("hidden", false);
|
||||||
|
QMainWindow::showEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::SetHiddenInTray(bool hidden) {
|
||||||
// Some window managers don't remember maximized state between calls to
|
// Some window managers don't remember maximized state between calls to
|
||||||
// hide() and show(), so we have to remember it ourself.
|
// hide() and show(), so we have to remember it ourself.
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
|
|
|
@ -131,10 +131,12 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
||||||
void CommandlineOptionsReceived(const CommandlineOptions& options);
|
void CommandlineOptionsReceived(const CommandlineOptions& options);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent*);
|
||||||
void changeEvent(QEvent*);
|
void changeEvent(QEvent*);
|
||||||
void resizeEvent(QResizeEvent*);
|
void resizeEvent(QResizeEvent*);
|
||||||
void closeEvent(QCloseEvent* event);
|
void closeEvent(QCloseEvent*);
|
||||||
|
void hideEvent(QHideEvent*);
|
||||||
|
void showEvent(QShowEvent*);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
bool winEvent(MSG* message, long* result);
|
bool winEvent(MSG* message, long* result);
|
||||||
|
|
Loading…
Reference in New Issue