diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2017-03-02 10:37:19 +0100 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2017-04-18 14:31:52 +0000 |
commit | 6462f299ed188b3c3494d99d21e6563e37bd78e5 (patch) | |
tree | 373b4bfcb57698474217404a2395d183e8eb031b /src/gui/kernel/qplatformmenu.cpp | |
parent | df252fc2051a6d2939c77244e74aca4a115d7cce (diff) |
Make platform menu tag/setTag not be pure virtual
Reasons:
* Tag means nothing to the platform, tag is something
the Qt side code will store and then restore, but it's meaningless
for the platform, since it can be either the pointer to an
action (qmenu.cpp) or an item count (qcombobox.cpp)
* Since it's meaningless to the platform you don't know what
to do when trying to implement a platform, this shows in how
the field was being initialized, some initialized to this,
some initialized to 0
On a followup commit we will remove the virtual tag but first
need to fix up other QPAs that don't live in the main repo
Change-Id: I15ac83f3bf7e4c741153d31ac761dbbe6f4b1b52
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformmenu.cpp')
-rw-r--r-- | src/gui/kernel/qplatformmenu.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformmenu.cpp b/src/gui/kernel/qplatformmenu.cpp index 1eb146dd0f..0d76f2039d 100644 --- a/src/gui/kernel/qplatformmenu.cpp +++ b/src/gui/kernel/qplatformmenu.cpp @@ -45,6 +45,37 @@ QT_BEGIN_NAMESPACE +QPlatformMenuItem::QPlatformMenuItem() +{ + m_tag = reinterpret_cast<quintptr>(this); +} + +void QPlatformMenuItem::setTag(quintptr tag) +{ + m_tag = tag; +} + +quintptr QPlatformMenuItem::tag() const +{ + return m_tag; +} + +QPlatformMenu::QPlatformMenu() +{ + m_tag = reinterpret_cast<quintptr>(this); +} + +void QPlatformMenu::setTag(quintptr tag) +{ + m_tag = tag; +} + +quintptr QPlatformMenu::tag() const +{ + return m_tag; + +} + QPlatformMenuItem *QPlatformMenu::createMenuItem() const { return QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem(); |