diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/kernel.pri | 3 | ||||
-rw-r--r-- | src/gui/kernel/qplatformmenu.cpp | 55 | ||||
-rw-r--r-- | src/gui/kernel/qplatformmenu.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformsystemtrayicon.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformsystemtrayicon_qpa.cpp | 16 |
5 files changed, 77 insertions, 1 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index d9bcbf316f..e9e4a1d818 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -121,7 +121,8 @@ SOURCES += \ kernel/qplatformservices.cpp \ kernel/qplatformscreenpageflipper.cpp \ kernel/qplatformsystemtrayicon_qpa.cpp \ - kernel/qplatformsessionmanager.cpp + kernel/qplatformsessionmanager.cpp \ + kernel/qplatformmenu.cpp contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { HEADERS += \ diff --git a/src/gui/kernel/qplatformmenu.cpp b/src/gui/kernel/qplatformmenu.cpp new file mode 100644 index 0000000000..54c340abf9 --- /dev/null +++ b/src/gui/kernel/qplatformmenu.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Martin Graesslin <mgraesslin@kde.org> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformmenu.h" + +#include <qpa/qplatformtheme.h> +#include <private/qguiapplication_p.h> + +QT_BEGIN_NAMESPACE + +QPlatformMenuItem *QPlatformMenu::createMenuItem() const +{ + return QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem(); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h index 3485cc58dd..9326a2b3a1 100644 --- a/src/gui/kernel/qplatformmenu.h +++ b/src/gui/kernel/qplatformmenu.h @@ -116,6 +116,8 @@ public: virtual QPlatformMenuItem *menuItemAt(int position) const = 0; virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0; + + virtual QPlatformMenuItem *createMenuItem() const; Q_SIGNALS: void aboutToShow(); void aboutToHide(); diff --git a/src/gui/kernel/qplatformsystemtrayicon.h b/src/gui/kernel/qplatformsystemtrayicon.h index 2c05b1a7fa..6bad643c7c 100644 --- a/src/gui/kernel/qplatformsystemtrayicon.h +++ b/src/gui/kernel/qplatformsystemtrayicon.h @@ -83,6 +83,8 @@ public: virtual bool isSystemTrayAvailable() const = 0; virtual bool supportsMessages() const = 0; + virtual QPlatformMenu *createMenu() const; + Q_SIGNALS: void activated(QPlatformSystemTrayIcon::ActivationReason reason); void messageClicked(); diff --git a/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp b/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp index c4cec40a10..bc37f99210 100644 --- a/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp +++ b/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp @@ -159,6 +159,22 @@ QPlatformSystemTrayIcon::~QPlatformSystemTrayIcon() \sa activated() */ +/*! + This method is called in case there is no QPlatformMenu available when + updating the menu. This allows the abstraction to provide a menu for the + system tray icon even if normally a non-native menu is used. + + The default implementation returns a null pointer. + + \sa updateMenu() + \since 5.3 + */ + +QPlatformMenu *QPlatformSystemTrayIcon::createMenu() const +{ + return Q_NULLPTR; +} + QT_END_NAMESPACE #include "moc_qplatformsystemtrayicon.cpp" |