Only override MainWindow::nativeEvent for Windows
This commit is contained in:
parent
224d5d46c1
commit
d9d39d8e25
|
@ -1530,12 +1530,16 @@ void MainWindow::showEvent(QShowEvent *e) {
|
|||
|
||||
void MainWindow::closeEvent(QCloseEvent *e) {
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
Exit();
|
||||
#else
|
||||
if (!hidden_ && keep_running_ && e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||
SetHiddenInTray(true);
|
||||
}
|
||||
else {
|
||||
Exit();
|
||||
}
|
||||
#endif
|
||||
|
||||
QMainWindow::closeEvent(e);
|
||||
|
||||
|
@ -2745,25 +2749,21 @@ void MainWindow::Raise() {
|
|||
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) {
|
||||
#else
|
||||
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) {
|
||||
#endif
|
||||
|
||||
Q_UNUSED(eventType);
|
||||
Q_UNUSED(result);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (exit_count_ == 0 && message) {
|
||||
MSG *msg = static_cast<MSG*>(message);
|
||||
thumbbar_->HandleWinEvent(msg);
|
||||
#else
|
||||
Q_UNUSED(message);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
return QMainWindow::nativeEvent(eventType, message, result);
|
||||
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
void MainWindow::AutoCompleteTags() {
|
||||
|
||||
|
|
|
@ -117,10 +117,12 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||
void showEvent(QShowEvent *e) override;
|
||||
void closeEvent(QCloseEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||
#else
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// PlatformInterface
|
||||
|
|
Loading…
Reference in New Issue