Navigation Menu

Skip to content

Commit

Permalink
Avoid useless tray icon on Windows 7
Browse files Browse the repository at this point in the history
Fixes #20247

(cherry picked from commit 908a058)
  • Loading branch information
nyalldawson committed Oct 29, 2018
1 parent c077fbc commit 3179b3b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
20 changes: 2 additions & 18 deletions src/app/qgisapp.cpp
Expand Up @@ -59,7 +59,6 @@
#endif
#include <QStatusBar>
#include <QStringList>
#include <QSystemTrayIcon>
#include <QTcpSocket>
#include <QTextStream>
#include <QtGlobal>
Expand Down Expand Up @@ -1362,13 +1361,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
QgsGui::instance()->nativePlatformInterface()->setApplicationBadgeCount( count );
} );

if ( !( QgsGui::nativePlatformInterface()->capabilities() & QgsNative::NativeDesktopNotifications ) )
{
mTray = new QSystemTrayIcon();
mTray->setIcon( QIcon( QgsApplication::appIconPath() ) );
mTray->hide();
}

// supposedly all actions have been added, now register them to the shortcut manager
QgsGui::shortcutsManager()->registerAllChildren( this );
QgsGui::shortcutsManager()->registerAllChildren( mSnappingWidget );
Expand Down Expand Up @@ -1556,7 +1548,6 @@ QgisApp::~QgisApp()
delete mPythonUtils;
#endif

delete mTray;
delete mDataSourceManagerDialog;
qDeleteAll( mCustomDropHandlers );
qDeleteAll( mCustomLayoutDropHandlers );
Expand Down Expand Up @@ -13983,15 +13974,8 @@ void QgisApp::showSystemNotification( const QString &title, const QString &messa

if ( !result.successful )
{
// fallback - use system tray notification
if ( mTray )
{
// Menubar icon is hidden by default. Show to enable notification bubbles
mTray->show();
mTray->showMessage( title, message );
// Re-hide menubar icon
mTray->hide();
}
// fallback - use message bar
messageBar()->pushInfo( title, message );
}
else
{
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgisapp.h
Expand Up @@ -36,7 +36,6 @@ class QStringList;
class QToolButton;
class QTcpSocket;
class QValidator;
class QSystemTrayIcon;

class QgisAppInterface;
class QgisAppStyleSheet;
Expand Down Expand Up @@ -2267,8 +2266,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
bool gestureEvent( QGestureEvent *event );
void tapAndHoldTriggered( QTapAndHoldGesture *gesture );

QSystemTrayIcon *mTray = nullptr;

QgsLocatorWidget *mLocatorWidget = nullptr;

QgsStatusBar *mStatusBar = nullptr;
Expand Down

0 comments on commit 3179b3b

Please sign in to comment.