Skip to content

Commit 3179b3b

Browse files
committed
Avoid useless tray icon on Windows 7
Fixes #20247 (cherry picked from commit 908a058)
1 parent c077fbc commit 3179b3b

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

src/app/qgisapp.cpp

+2-18
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
#endif
6060
#include <QStatusBar>
6161
#include <QStringList>
62-
#include <QSystemTrayIcon>
6362
#include <QTcpSocket>
6463
#include <QTextStream>
6564
#include <QtGlobal>
@@ -1362,13 +1361,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
13621361
QgsGui::instance()->nativePlatformInterface()->setApplicationBadgeCount( count );
13631362
} );
13641363

1365-
if ( !( QgsGui::nativePlatformInterface()->capabilities() & QgsNative::NativeDesktopNotifications ) )
1366-
{
1367-
mTray = new QSystemTrayIcon();
1368-
mTray->setIcon( QIcon( QgsApplication::appIconPath() ) );
1369-
mTray->hide();
1370-
}
1371-
13721364
// supposedly all actions have been added, now register them to the shortcut manager
13731365
QgsGui::shortcutsManager()->registerAllChildren( this );
13741366
QgsGui::shortcutsManager()->registerAllChildren( mSnappingWidget );
@@ -1556,7 +1548,6 @@ QgisApp::~QgisApp()
15561548
delete mPythonUtils;
15571549
#endif
15581550

1559-
delete mTray;
15601551
delete mDataSourceManagerDialog;
15611552
qDeleteAll( mCustomDropHandlers );
15621553
qDeleteAll( mCustomLayoutDropHandlers );
@@ -13983,15 +13974,8 @@ void QgisApp::showSystemNotification( const QString &title, const QString &messa
1398313974

1398413975
if ( !result.successful )
1398513976
{
13986-
// fallback - use system tray notification
13987-
if ( mTray )
13988-
{
13989-
// Menubar icon is hidden by default. Show to enable notification bubbles
13990-
mTray->show();
13991-
mTray->showMessage( title, message );
13992-
// Re-hide menubar icon
13993-
mTray->hide();
13994-
}
13977+
// fallback - use message bar
13978+
messageBar()->pushInfo( title, message );
1399513979
}
1399613980
else
1399713981
{

src/app/qgisapp.h

-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class QStringList;
3636
class QToolButton;
3737
class QTcpSocket;
3838
class QValidator;
39-
class QSystemTrayIcon;
4039

4140
class QgisAppInterface;
4241
class QgisAppStyleSheet;
@@ -2267,8 +2266,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
22672266
bool gestureEvent( QGestureEvent *event );
22682267
void tapAndHoldTriggered( QTapAndHoldGesture *gesture );
22692268

2270-
QSystemTrayIcon *mTray = nullptr;
2271-
22722269
QgsLocatorWidget *mLocatorWidget = nullptr;
22732270

22742271
QgsStatusBar *mStatusBar = nullptr;

0 commit comments

Comments
 (0)