Set hide to false when window is shown

This commit is contained in:
Jonas Kvinge
2020-10-05 19:08:09 +02:00
parent 8e21decb8d
commit 393a2e0ea0
2 changed files with 15 additions and 1 deletions

View File

@@ -1507,6 +1507,14 @@ void MainWindow::StopAfterCurrent() {
emit StopAfterToggled(app_->playlist_manager()->active()->stop_after_current()); emit StopAfterToggled(app_->playlist_manager()->active()->stop_after_current());
} }
void MainWindow::showEvent(QShowEvent *e) {
hidden_ = false;
QMainWindow::showEvent(e);
}
void MainWindow::closeEvent(QCloseEvent *e) { void MainWindow::closeEvent(QCloseEvent *e) {
if (!hidden_ && keep_running_ && e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable()) { if (!hidden_ && keep_running_ && e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable()) {
@@ -2211,9 +2219,11 @@ void MainWindow::CommandlineOptionsReceived(const quint32 instanceId, const QByt
raise(); raise();
show(); show();
activateWindow(); activateWindow();
hidden_ = false;
} }
else else
CommandlineOptionsReceived(options); CommandlineOptionsReceived(options);
} }
void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) { void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
@@ -2713,8 +2723,11 @@ void MainWindow::PlaylistCurrentChanged(const QModelIndex &proxy_current) {
} }
void MainWindow::Raise() { void MainWindow::Raise() {
show(); show();
activateWindow(); activateWindow();
hidden_ = false;
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View File

@@ -114,8 +114,9 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void CommandlineOptionsReceived(const CommandlineOptions &options); void CommandlineOptionsReceived(const CommandlineOptions &options);
protected: protected:
void keyPressEvent(QKeyEvent *e) override; void showEvent(QShowEvent *e) override;
void closeEvent(QCloseEvent *e) override; void closeEvent(QCloseEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override; bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
#else #else