@@ -698,6 +698,7 @@ void MainWindow::duqf_initUi()
698698 {
699699 DuMenu *trayMenu = new DuMenu (QString (STR_INTERNALNAME),this );
700700 QSettings settings;
701+
701702#ifdef Q_OS_LINUX
702703 QString trayIconType = settings.value (" appearance/trayIconType" , " light" ).toString ();
703704#else
@@ -732,7 +733,7 @@ void MainWindow::duqf_initUi()
732733 // drag window
733734 duqf_toolBarClicked = false ;
734735
735- #ifdef Q_OS_LINUX
736+ #ifndef Q_OS_WIN
736737 mainToolBar->installEventFilter (this );
737738#endif
738739
@@ -764,7 +765,6 @@ void MainWindow::duqf_initUi()
764765 minWidget->setObjectName (" windowButton" );
765766 mainToolBar->layout ()->setAlignment (minWidget, Qt::AlignTop);
766767
767- #ifndef Q_OS_MAC
768768 m_maximizeAction = new QAction (this );
769769 QIcon maximizeIcon;
770770 maximizeIcon.addFile (" :/icons/maximize" , QSize (), QIcon::Normal, QIcon::Off);
@@ -776,7 +776,6 @@ void MainWindow::duqf_initUi()
776776 maxWidget->setFixedSize (24 ,24 );
777777 maxWidget->setObjectName (" windowButton" );
778778 mainToolBar->layout ()->setAlignment (maxWidget, Qt::AlignTop);
779- #endif // NOT MAC
780779
781780 m_closeAction = new QAction (this );
782781 m_closeAction->setIcon (QIcon (" :/icons/close-simple" ));
@@ -786,7 +785,7 @@ void MainWindow::duqf_initUi()
786785 closeWidget->setObjectName (" windowButton" );
787786 mainToolBar->layout ()->setAlignment (closeWidget, Qt::AlignTop);
788787
789- #endif // Not LINUX
788+ #endif // Not linux
790789
791790 // ===== STATUSBAR ======
792791
@@ -893,14 +892,19 @@ void MainWindow::duqf_initUi()
893892 DuApplication *app = qobject_cast<DuApplication*>(qApp);
894893 duqf_updateAvailable (app->updateInfo ());
895894
896- #ifndef Q_OS_LINUX
895+ #ifdef Q_OS_WIN
897896 connect (m_minimizeAction, &QAction::triggered, this , &MainWindow::minimizeTriggered);
898- #ifndef Q_OS_MAC
899897 connect (m_maximizeAction, &QAction::triggered, this , &MainWindow::maximizeTriggered);
900- #endif // Not mac
901898 connect (m_closeAction, &QAction::triggered, this , &MainWindow::close);
899+ #endif
900+
901+ #ifdef Q_OS_MAC
902+ connect (m_minimizeAction, &QAction::triggered, this , &QMainWindow::showMinimized);
903+ connect (m_maximizeAction, &QAction::triggered, this , &MainWindow::maximize);
904+ connect (m_closeAction, &QAction::triggered, this , &MainWindow::close);
905+ #endif
906+
902907 connect (qApp, &QCoreApplication::aboutToQuit, this , &MainWindow::onQuit);
903- #endif // Not linux
904908}
905909
906910void MainWindow::duqf_setStyle ()
@@ -1063,6 +1067,12 @@ void MainWindow::duqf_updateAvailable(QJsonObject updateInfo)
10631067 }
10641068}
10651069
1070+ void MainWindow::maximize (bool m)
1071+ {
1072+ if (m) showMaximized ();
1073+ else showNormal ();
1074+ }
1075+
10661076void MainWindow::log (DuQFLog m)
10671077{
10681078 QString message = m.message ();
0 commit comments