Avoid useless tray icon on Windows 7

Fixes #20247
This commit is contained in:
Nyall Dawson 2018-10-29 10:17:34 +10:00
parent c920688437
commit 908a058a3a
2 changed files with 2 additions and 21 deletions

View File

@ -59,7 +59,6 @@
#endif
#include <QStatusBar>
#include <QStringList>
#include <QSystemTrayIcon>
#include <QTcpSocket>
#include <QTextStream>
#include <QtGlobal>
@ -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 );
@ -1556,7 +1548,6 @@ QgisApp::~QgisApp()
delete mPythonUtils;
#endif
delete mTray;
delete mDataSourceManagerDialog;
qDeleteAll( mCustomDropHandlers );
qDeleteAll( mCustomLayoutDropHandlers );
@ -13989,15 +13980,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
{

View File

@ -36,7 +36,6 @@ class QStringList;
class QToolButton;
class QTcpSocket;
class QValidator;
class QSystemTrayIcon;
class QgisAppInterface;
class QgisAppStyleSheet;
@ -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;