summaryrefslogtreecommitdiff
path: root/src/qstyleplugin.cpp
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2012-05-10 15:35:50 +0200
committerMorten Johan Sørvig <morten.sorvig@nokia.com>2012-05-15 14:39:35 +0200
commit8a619f580b313c9373b816f059d91c208eb89400 (patch)
tree0a391abcc192a775d8192872cb1e773f6a691a1a /src/qstyleplugin.cpp
parentf92f1b727626c4f7b0b99f0e1e28a34d35e58530 (diff)
downloadqtquickcontrols-8a619f580b313c9373b816f059d91c208eb89400.tar.gz
Port menus to Qt 5.
Copy over qtmenu and qtmenuitem from the Qt 4 branch. Register types in qstyleplugin.cpp. Delete Menu.qml MenuItem.qml - no longer in use and replaced by C++ code. Some porting was necessary, in particular changing QtMenuBase's base class from QObject to QtQuickItem. Bugs: On OS X the menu bar is displayed only ~50% if the time. Other platforms are not tested. Context menus do not work. Change-Id: I4e9cc6952ec1c70dc28cfda2352ba9962b539b17 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/qstyleplugin.cpp')
-rw-r--r--src/qstyleplugin.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qstyleplugin.cpp b/src/qstyleplugin.cpp
index 3263e51a..e39b7369 100644
--- a/src/qstyleplugin.cpp
+++ b/src/qstyleplugin.cpp
@@ -41,6 +41,9 @@
#include "qstyleplugin.h"
#include "qstyleitem.h"
#include "qrangemodel.h"
+#include "qtmenu.h"
+#include "qtmenubar.h"
+#include "qwindowitem.h"
#include "qwindowitem.h"
#include "qdesktopitem.h"
#include "qwheelarea.h"
@@ -83,10 +86,16 @@ void StylePlugin::registerTypes(const char *uri)
qmlRegisterType<QRangeModel>(uri, 0, 2, "RangeModel");
qmlRegisterType<QWheelArea>(uri, 0, 2, "WheelArea");
+ qmlRegisterType<QtMenu>(uri, 0, 2, "Menu");
+ qmlRegisterType<QtMenuBar>(uri, 0, 2, "MenuBar");
+ qmlRegisterType<QtMenuItem>(uri, 0, 2, "MenuItem");
+ qmlRegisterType<QtMenuSeparator>(uri, 0, 2, "Separator");
+
qmlRegisterType<QFileSystemModel>(uri, 0, 2, "FileSystemModel");
qmlRegisterType<QtSplitterBase>(uri, 0, 2, "Splitter");
- qmlRegisterType<QWindowItem>("QtQuick", 2, 0, "Window");
+ qmlRegisterType<QWindowItem>("QtQuick", 2, 0, "Window"); // override built-in Window
+ qmlRegisterUncreatableType<QtMenuBase>("uri", 0, 1, "NativeMenuBase", QLatin1String("Do not create objects of type NativeMenuBase"));
qmlRegisterUncreatableType<QDesktopItem>(uri, 0,2,"Desktop", QLatin1String("Do not create objects of type Desktop"));
}