summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/controls/plugin.cpp20
-rw-r--r--src/controls/plugin.pri18
-rw-r--r--src/controls/qquickmenu.cpp (renamed from src/controls/qtmenu.cpp)134
-rw-r--r--src/controls/qquickmenu_p.h (renamed from src/controls/qtmenu_p.h)58
-rw-r--r--src/controls/qquickmenubar.cpp (renamed from src/controls/qtmenubar.cpp)32
-rw-r--r--src/controls/qquickmenubar_p.h (renamed from src/controls/qtmenubar_p.h)26
-rw-r--r--src/controls/qquickmenuitem.cpp (renamed from src/controls/qtmenuitem.cpp)126
-rw-r--r--src/controls/qquickmenuitem_p.h (renamed from src/controls/qtmenuitem_p.h)56
-rw-r--r--src/controls/qquickmenuitemcontainer_p.h (renamed from src/controls/qtmenuitemcontainer_p.h)26
-rw-r--r--src/controls/qquickmenupopupwindow.cpp (renamed from src/controls/qtmenupopupwindow.cpp)39
-rw-r--r--src/controls/qquickmenupopupwindow_p.h (renamed from src/controls/qtmenupopupwindow_p.h)10
11 files changed, 272 insertions, 273 deletions
diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp
index 98d81e42..93fa6677 100644
--- a/src/controls/plugin.cpp
+++ b/src/controls/plugin.cpp
@@ -41,8 +41,8 @@
#include "qquickaction_p.h"
#include "qquickexclusivegroup_p.h"
-#include "qtmenu_p.h"
-#include "qtmenubar_p.h"
+#include "qquickmenu_p.h"
+#include "qquickmenubar_p.h"
#include "qtstack_p.h"
#include <qimage.h>
@@ -88,14 +88,14 @@ void QtQuickControlsPlugin::registerTypes(const char *uri)
{
qmlRegisterType<QQuickAction>(uri, 1, 0, "Action");
qmlRegisterType<QQuickExclusiveGroup>(uri, 1, 0, "ExclusiveGroup");
- qmlRegisterType<QtMenu>(uri, 1, 0, "MenuPrivate");
- qmlRegisterType<QtMenuBar>(uri, 1, 0, "MenuBarPrivate");
- qmlRegisterType<QtMenuItem>(uri, 1, 0, "MenuItem");
- qmlRegisterUncreatableType<QtMenuItemType>(uri, 1, 0, "MenuItemType",
- QLatin1String("Do not create objects of type MenuItemType"));
- qmlRegisterType<QtMenuSeparator>(uri, 1, 0, "MenuSeparator");
- qmlRegisterUncreatableType<QtMenuBase>(uri, 1, 0, "MenuBase",
- QLatin1String("Do not create objects of type MenuBase"));
+ qmlRegisterType<QQuickMenu>(uri, 1, 0, "MenuPrivate");
+ qmlRegisterType<QQuickMenuBar>(uri, 1, 0, "MenuBarPrivate");
+ qmlRegisterType<QQuickMenuItem>(uri, 1, 0, "MenuItem");
+ qmlRegisterUncreatableType<QQuickMenuItemType>(uri, 1, 0, "MenuItemType",
+ QLatin1String("Do not create objects of type MenuItemType"));
+ qmlRegisterType<QQuickMenuSeparator>(uri, 1, 0, "MenuSeparator");
+ qmlRegisterUncreatableType<QQuickMenuBase>(uri, 1, 0, "MenuBase",
+ QLatin1String("Do not create objects of type MenuBase"));
qmlRegisterUncreatableType<QtStack>(uri, 1, 0, "Stack", QLatin1String("Do not create objects of type Stack"));
}
diff --git a/src/controls/plugin.pri b/src/controls/plugin.pri
index 1658a390..b66b6a4d 100644
--- a/src/controls/plugin.pri
+++ b/src/controls/plugin.pri
@@ -1,19 +1,19 @@
HEADERS += \
$$PWD/qquickaction_p.h \
$$PWD/qquickexclusivegroup_p.h \
- $$PWD/qtmenu_p.h \
- $$PWD/qtmenubar_p.h \
- $$PWD/qtmenuitem_p.h \
- $$PWD/qtmenuitemcontainer_p.h \
- $$PWD/qtmenupopupwindow_p.h \
+ $$PWD/qquickmenu_p.h \
+ $$PWD/qquickmenubar_p.h \
+ $$PWD/qquickmenuitem_p.h \
+ $$PWD/qquickmenuitemcontainer_p.h \
+ $$PWD/qquickmenupopupwindow_p.h \
$$PWD/qtstack_p.h
SOURCES += \
$$PWD/plugin.cpp \
$$PWD/qquickaction.cpp \
$$PWD/qquickexclusivegroup.cpp \
- $$PWD/qtmenu.cpp \
- $$PWD/qtmenubar.cpp \
- $$PWD/qtmenuitem.cpp \
- $$PWD/qtmenupopupwindow.cpp \
+ $$PWD/qquickmenu.cpp \
+ $$PWD/qquickmenubar.cpp \
+ $$PWD/qquickmenuitem.cpp \
+ $$PWD/qquickmenupopupwindow.cpp \
$$PWD/qtstack.cpp
diff --git a/src/controls/qtmenu.cpp b/src/controls/qquickmenu.cpp
index f40d4603..6da054a8 100644
--- a/src/controls/qtmenu.cpp
+++ b/src/controls/qquickmenu.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "qtmenu_p.h"
-#include "qtmenuitemcontainer_p.h"
-#include "qtmenupopupwindow_p.h"
+#include "qquickmenu_p.h"
+#include "qquickmenuitemcontainer_p.h"
+#include "qquickmenupopupwindow_p.h"
#include <qdebug.h>
#include <qabstractitemmodel.h>
@@ -54,13 +54,13 @@
QT_BEGIN_NAMESPACE
/*!
- \class QtMenu
+ \class QQuickMenu
\internal
*/
/*!
\qmltype MenuPrivate
- \instantiates QtMenu
+ \instantiates QQuickMenu
\internal
\inqmlmodule QtQuick.Controls 1.0
*/
@@ -234,8 +234,8 @@ QT_BEGIN_NAMESPACE
\sa insertItem()
*/
-QtMenu::QtMenu(QObject *parent)
- : QtMenuText(parent),
+QQuickMenu::QQuickMenu(QObject *parent)
+ : QQuickMenuText(parent),
m_itemsCount(0),
m_selectedIndex(-1),
m_parentWindow(0),
@@ -255,20 +255,20 @@ QtMenu::QtMenu(QObject *parent)
}
}
-QtMenu::~QtMenu()
+QQuickMenu::~QQuickMenu()
{
delete m_platformMenu;
m_platformMenu = 0;
}
-void QtMenu::updateText()
+void QQuickMenu::updateText()
{
if (m_platformMenu)
m_platformMenu->setText(this->text());
- QtMenuText::updateText();
+ QQuickMenuText::updateText();
}
-void QtMenu::setMinimumWidth(int w)
+void QQuickMenu::setMinimumWidth(int w)
{
if (w == m_minimumWidth)
return;
@@ -278,13 +278,13 @@ void QtMenu::setMinimumWidth(int w)
m_platformMenu->setMinimumWidth(w);
}
-void QtMenu::setFont(const QFont &arg)
+void QQuickMenu::setFont(const QFont &arg)
{
if (m_platformMenu)
m_platformMenu->setFont(arg);
}
-void QtMenu::setSelectedIndex(int index)
+void QQuickMenu::setSelectedIndex(int index)
{
if (m_selectedIndex == index)
return;
@@ -293,21 +293,21 @@ void QtMenu::setSelectedIndex(int index)
emit __selectedIndexChanged();
}
-void QtMenu::updateSelectedIndex()
+void QQuickMenu::updateSelectedIndex()
{
- if (QtMenuItem *menuItem = qobject_cast<QtMenuItem*>(sender())) {
+ if (QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem*>(sender())) {
int index = indexOfMenuItem(menuItem);
setSelectedIndex(index);
}
}
-QtMenuItems QtMenu::menuItems()
+QQuickMenuItems QQuickMenu::menuItems()
{
- return QtMenuItems(this, 0, &QtMenu::append_menuItems, &QtMenu::count_menuItems,
- &QtMenu::at_menuItems, &QtMenu::clear_menuItems);
+ return QQuickMenuItems(this, 0, &QQuickMenu::append_menuItems, &QQuickMenu::count_menuItems,
+ &QQuickMenu::at_menuItems, &QQuickMenu::clear_menuItems);
}
-QQuickWindow *QtMenu::findParentWindow()
+QQuickWindow *QQuickMenu::findParentWindow()
{
if (!m_parentWindow) {
QQuickItem *parentAsItem = qobject_cast<QQuickItem *>(parent());
@@ -317,7 +317,7 @@ QQuickWindow *QtMenu::findParentWindow()
return m_parentWindow;
}
-void QtMenu::popup()
+void QQuickMenu::popup()
{
QPoint mousePos = QCursor::pos();
if (QQuickWindow *parentWindow = findParentWindow())
@@ -326,7 +326,7 @@ void QtMenu::popup()
__popup(mousePos.x(), mousePos.y());
}
-void QtMenu::__popup(qreal x, qreal y, int atItemIndex)
+void QQuickMenu::__popup(qreal x, qreal y, int atItemIndex)
{
if (popupVisible()) {
__closeMenu();
@@ -338,7 +338,7 @@ void QtMenu::__popup(qreal x, qreal y, int atItemIndex)
setPopupVisible(true);
- QtMenuBase *atItem = menuItemAtIndex(atItemIndex);
+ QQuickMenuBase *atItem = menuItemAtIndex(atItemIndex);
QQuickWindow *parentWindow = findParentWindow();
@@ -348,7 +348,7 @@ void QtMenu::__popup(qreal x, qreal y, int atItemIndex)
screenPosition = visualItem()->mapToScene(screenPosition);
m_platformMenu->showPopup(parentWindow, screenPosition.toPoint(), atItem ? atItem->platformItem() : 0);
} else {
- m_popupWindow = new QtMenuPopupWindow();
+ m_popupWindow = new QQuickMenuPopupWindow();
if (visualItem())
m_popupWindow->setParentItem(visualItem());
else
@@ -363,13 +363,13 @@ void QtMenu::__popup(qreal x, qreal y, int atItemIndex)
}
}
-void QtMenu::setMenuContentItem(QQuickItem *item)
+void QQuickMenu::setMenuContentItem(QQuickItem *item)
{
if (m_menuContentItem != item)
m_menuContentItem = item;
}
-void QtMenu::setPopupVisible(bool v)
+void QQuickMenu::setPopupVisible(bool v)
{
if (m_popupVisible != v) {
m_popupVisible = v;
@@ -377,7 +377,7 @@ void QtMenu::setPopupVisible(bool v)
}
}
-void QtMenu::__closeMenu()
+void QQuickMenu::__closeMenu()
{
setPopupVisible(false);
if (m_popupWindow)
@@ -386,21 +386,21 @@ void QtMenu::__closeMenu()
emit __menuClosed();
}
-void QtMenu::__dismissMenu()
+void QQuickMenu::__dismissMenu()
{
- QtMenuPopupWindow *topMenuWindow = m_popupWindow;
+ QQuickMenuPopupWindow *topMenuWindow = m_popupWindow;
while (topMenuWindow) {
- QtMenuPopupWindow *pw = qobject_cast<QtMenuPopupWindow *>(topMenuWindow->transientParent());
+ QQuickMenuPopupWindow *pw = qobject_cast<QQuickMenuPopupWindow *>(topMenuWindow->transientParent());
if (!pw)
topMenuWindow->dismissMenu();
topMenuWindow = pw;
}
}
-void QtMenu::windowVisibleChanged(bool v)
+void QQuickMenu::windowVisibleChanged(bool v)
{
if (!v) {
- if (qobject_cast<QtMenuPopupWindow *>(m_popupWindow->transientParent())) {
+ if (qobject_cast<QQuickMenuPopupWindow *>(m_popupWindow->transientParent())) {
m_popupWindow->transientParent()->setMouseGrabEnabled(true);
m_popupWindow->transientParent()->setKeyboardGrabEnabled(true);
}
@@ -410,12 +410,12 @@ void QtMenu::windowVisibleChanged(bool v)
}
}
-void QtMenu::itemIndexToListIndex(int itemIndex, int *listIndex, int *containerIndex) const
+void QQuickMenu::itemIndexToListIndex(int itemIndex, int *listIndex, int *containerIndex) const
{
*listIndex = -1;
- QtMenuItemContainer *container = 0;
+ QQuickMenuItemContainer *container = 0;
while (itemIndex >= 0 && ++*listIndex < m_menuItems.count())
- if ((container = qobject_cast<QtMenuItemContainer *>(m_menuItems[*listIndex])))
+ if ((container = qobject_cast<QQuickMenuItemContainer *>(m_menuItems[*listIndex])))
itemIndex -= container->items().count();
else
--itemIndex;
@@ -426,12 +426,12 @@ void QtMenu::itemIndexToListIndex(int itemIndex, int *listIndex, int *containerI
*containerIndex = -1;
}
-int QtMenu::itemIndexForListIndex(int listIndex) const
+int QQuickMenu::itemIndexForListIndex(int listIndex) const
{
int index = 0;
int i = 0;
while (i < listIndex && i < m_menuItems.count())
- if (QtMenuItemContainer *container = qobject_cast<QtMenuItemContainer *>(m_menuItems[i++]))
+ if (QQuickMenuItemContainer *container = qobject_cast<QQuickMenuItemContainer *>(m_menuItems[i++]))
index += container->items().count();
else
++index;
@@ -439,16 +439,16 @@ int QtMenu::itemIndexForListIndex(int listIndex) const
return index;
}
-QtMenuBase *QtMenu::nextMenuItem(QtMenu::MenuItemIterator *it) const
+QQuickMenuBase *QQuickMenu::nextMenuItem(QQuickMenu::MenuItemIterator *it) const
{
if (it->containerIndex != -1) {
- QtMenuItemContainer *container = qobject_cast<QtMenuItemContainer *>(m_menuItems[it->index]);
+ QQuickMenuItemContainer *container = qobject_cast<QQuickMenuItemContainer *>(m_menuItems[it->index]);
if (++it->containerIndex < container->items().count())
return container->items()[it->containerIndex];
}
if (++it->index < m_menuItems.count()) {
- if (QtMenuItemContainer *container = qobject_cast<QtMenuItemContainer *>(m_menuItems[it->index])) {
+ if (QQuickMenuItemContainer *container = qobject_cast<QQuickMenuItemContainer *>(m_menuItems[it->index])) {
it->containerIndex = 0;
return container->items()[0];
} else {
@@ -460,20 +460,20 @@ QtMenuBase *QtMenu::nextMenuItem(QtMenu::MenuItemIterator *it) const
return 0;
}
-QtMenuBase *QtMenu::menuItemAtIndex(int index) const
+QQuickMenuBase *QQuickMenu::menuItemAtIndex(int index) const
{
if (0 <= index && index < m_itemsCount) {
if (!m_containersCount) {
return m_menuItems[index];
} else if (m_containersCount == 1 && m_menuItems.count() == 1) {
- QtMenuItemContainer *container = qobject_cast<QtMenuItemContainer *>(m_menuItems[0]);
+ QQuickMenuItemContainer *container = qobject_cast<QQuickMenuItemContainer *>(m_menuItems[0]);
return container->items()[index];
} else {
int containerIndex;
int i;
itemIndexToListIndex(index, &i, &containerIndex);
if (containerIndex != -1) {
- QtMenuItemContainer *container = qobject_cast<QtMenuItemContainer *>(m_menuItems[i]);
+ QQuickMenuItemContainer *container = qobject_cast<QQuickMenuItemContainer *>(m_menuItems[i]);
return container->items()[containerIndex];
} else {
return m_menuItems[i];
@@ -484,7 +484,7 @@ QtMenuBase *QtMenu::menuItemAtIndex(int index) const
return 0;
}
-bool QtMenu::contains(QtMenuBase *item)
+bool QQuickMenu::contains(QQuickMenuBase *item)
{
if (item->container())
return item->container()->items().contains(item);
@@ -492,7 +492,7 @@ bool QtMenu::contains(QtMenuBase *item)
return m_menuItems.contains(item);
}
-int QtMenu::indexOfMenuItem(QtMenuBase *item) const
+int QQuickMenu::indexOfMenuItem(QQuickMenuBase *item) const
{
if (!item)
return -1;
@@ -508,37 +508,37 @@ int QtMenu::indexOfMenuItem(QtMenuBase *item) const
}
}
-QtMenuItem *QtMenu::addItem(QString title)
+QQuickMenuItem *QQuickMenu::addItem(QString title)
{
return insertItem(m_itemsCount, title);
}
-QtMenuItem *QtMenu::insertItem(int index, QString title)
+QQuickMenuItem *QQuickMenu::insertItem(int index, QString title)
{
- QtMenuItem *item = new QtMenuItem(this);
+ QQuickMenuItem *item = new QQuickMenuItem(this);
item->setText(title);
insertItem(index, item);
return item;
}
-void QtMenu::addSeparator()
+void QQuickMenu::addSeparator()
{
insertSeparator(m_itemsCount);
}
-void QtMenu::insertSeparator(int index)
+void QQuickMenu::insertSeparator(int index)
{
- QtMenuSeparator *item = new QtMenuSeparator(this);
+ QQuickMenuSeparator *item = new QQuickMenuSeparator(this);
insertItem(index, item);
}
-void QtMenu::insertItem(int index, QtMenuBase *menuItem)
+void QQuickMenu::insertItem(int index, QQuickMenuBase *menuItem)
{
if (!menuItem)
return;
int itemIndex;
if (m_containersCount) {
- QtMenuItemContainer *container = menuItem->parent() != this ? m_containers[menuItem->parent()] : 0;
+ QQuickMenuItemContainer *container = menuItem->parent() != this ? m_containers[menuItem->parent()] : 0;
if (container) {
container->insertItem(index, menuItem);
itemIndex = itemIndexForListIndex(m_menuItems.indexOf(container)) + index;
@@ -555,13 +555,13 @@ void QtMenu::insertItem(int index, QtMenuBase *menuItem)
emit itemsChanged();
}
-void QtMenu::removeItem(QtMenuBase *menuItem)
+void QQuickMenu::removeItem(QQuickMenuBase *menuItem)
{
if (!menuItem)
return;
menuItem->setParentMenu(0);
- QtMenuItemContainer *container = menuItem->parent() != this ? m_containers[menuItem->parent()] : 0;
+ QQuickMenuItemContainer *container = menuItem->parent() != this ? m_containers[menuItem->parent()] : 0;
if (container)
container->removeItem(menuItem);
else
@@ -571,7 +571,7 @@ void QtMenu::removeItem(QtMenuBase *menuItem)
emit itemsChanged();
}
-void QtMenu::clear()
+void QQuickMenu::clear()
{
m_containers.clear();
m_containersCount = 0;
@@ -581,7 +581,7 @@ void QtMenu::clear()
m_itemsCount = 0;
}
-void QtMenu::setupMenuItem(QtMenuBase *item, int platformIndex)
+void QQuickMenu::setupMenuItem(QQuickMenuBase *item, int platformIndex)
{
item->setParentMenu(this);
if (m_platformMenu) {
@@ -593,22 +593,22 @@ void QtMenu::setupMenuItem(QtMenuBase *item, int platformIndex)
++m_itemsCount;
}
-void QtMenu::append_menuItems(QtMenuItems *list, QObject *o)
+void QQuickMenu::append_menuItems(QQuickMenuItems *list, QObject *o)
{
- if (QtMenu *menu = qobject_cast<QtMenu *>(list->object)) {
+ if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(list->object)) {
Q_ASSERT(o->parent() == menu);
- if (QtMenuBase *menuItem = qobject_cast<QtMenuBase *>(o)) {
+ if (QQuickMenuBase *menuItem = qobject_cast<QQuickMenuBase *>(o)) {
menu->m_menuItems.append(menuItem);
menu->setupMenuItem(menuItem);
} else {
- QtMenuItemContainer *menuItemContainer = new QtMenuItemContainer(menu);
+ QQuickMenuItemContainer *menuItemContainer = new QQuickMenuItemContainer(menu);
menu->m_menuItems.append(menuItemContainer);
menu->m_containers.insert(o, menuItemContainer);
menuItemContainer->setParentMenu(menu);
++menu->m_containersCount;
foreach (QObject *child, o->children()) {
- if (QtMenuBase *item = qobject_cast<QtMenuBase *>(child)) {
+ if (QQuickMenuBase *item = qobject_cast<QQuickMenuBase *>(child)) {
menuItemContainer->insertItem(-1, item);
menu->setupMenuItem(item);
}
@@ -617,25 +617,25 @@ void QtMenu::append_menuItems(QtMenuItems *list, QObject *o)
}
}
-int QtMenu::count_menuItems(QtMenuItems *list)
+int QQuickMenu::count_menuItems(QQuickMenuItems *list)
{
- if (QtMenu *menu = qobject_cast<QtMenu *>(list->object))
+ if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(list->object))
return menu->m_itemsCount;
return 0;
}
-QObject *QtMenu::at_menuItems(QtMenuItems *list, int index)
+QObject *QQuickMenu::at_menuItems(QQuickMenuItems *list, int index)
{
- if (QtMenu *menu = qobject_cast<QtMenu *>(list->object))
+ if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(list->object))
return menu->menuItemAtIndex(index);
return 0;
}
-void QtMenu::clear_menuItems(QtMenuItems *list)
+void QQuickMenu::clear_menuItems(QQuickMenuItems *list)
{
- if (QtMenu *menu = qobject_cast<QtMenu *>(list->object))
+ if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(list->object))
menu->clear();
}
diff --git a/src/controls/qtmenu_p.h b/src/controls/qquickmenu_p.h
index a258c131..d2017d45 100644
--- a/src/controls/qtmenu_p.h
+++ b/src/controls/qquickmenu_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QTMENU_P_H
-#define QTMENU_P_H
+#ifndef QQUICKMENU_P_H
+#define QQUICKMENU_P_H
-#include "qtmenuitem_p.h"
+#include "qquickmenuitem_p.h"
#include <QtCore/qglobal.h>
#include <QtCore/qvariant.h>
@@ -52,13 +52,13 @@
QT_BEGIN_NAMESPACE
class QPlatformMenu;
-class QtMenuPopupWindow;
-class QtMenuItemContainer;
+class QQuickMenuPopupWindow;
+class QQuickMenuItemContainer;
class QQuickWindow;
-typedef QQmlListProperty<QObject> QtMenuItems;
+typedef QQmlListProperty<QObject> QQuickMenuItems;
-class QtMenu : public QtMenuText
+class QQuickMenu : public QQuickMenuText
{
Q_OBJECT
Q_PROPERTY(QString title READ text WRITE setText NOTIFY titleChanged)
@@ -73,13 +73,13 @@ class QtMenu : public QtMenuText
public:
Q_INVOKABLE void popup();
- Q_INVOKABLE QtMenuItem *addItem(QString);
- Q_INVOKABLE QtMenuItem *insertItem(int, QString);
+ Q_INVOKABLE QQuickMenuItem *addItem(QString);
+ Q_INVOKABLE QQuickMenuItem *insertItem(int, QString);
Q_INVOKABLE void addSeparator();
Q_INVOKABLE void insertSeparator(int);
- Q_INVOKABLE void insertItem(int, QtMenuBase *);
- Q_INVOKABLE void removeItem(QtMenuBase *);
+ Q_INVOKABLE void insertItem(int, QQuickMenuBase *);
+ Q_INVOKABLE void removeItem(QQuickMenuBase *);
Q_INVOKABLE void clear();
Q_INVOKABLE void __popup(qreal x, qreal y, int atActionIndex = -1);
@@ -97,16 +97,16 @@ Q_SIGNALS:
void popupVisibleChanged();
public:
- QtMenu(QObject *parent = 0);
- virtual ~QtMenu();
+ QQuickMenu(QObject *parent = 0);
+ virtual ~QQuickMenu();
int selectedIndex() const { return m_selectedIndex; }
void setSelectedIndex(int index);
- QtMenuItems menuItems();
- QtMenuBase *menuItemAtIndex(int index) const;
- bool contains(QtMenuBase *);
- int indexOfMenuItem(QtMenuBase *) const;
+ QQuickMenuItems menuItems();
+ QQuickMenuBase *menuItemAtIndex(int index) const;
+ bool contains(QQuickMenuBase *);
+ int indexOfMenuItem(QQuickMenuBase *) const;
QPlatformMenu *platformMenu() const { return m_platformMenu; }
@@ -118,7 +118,7 @@ public:
QQuickItem *menuContentItem() const { return m_menuContentItem; }
bool popupVisible() const { return m_popupVisible; }
- QtMenuItemType::MenuItemType type() { return QtMenuItemType::Menu; }
+ QQuickMenuItemType::MenuItemType type() { return QQuickMenuItemType::Menu; }
bool isNative() { return m_platformMenu != 0; }
protected Q_SLOTS:
@@ -142,23 +142,23 @@ private:
int index, containerIndex;
};
- QtMenuBase *nextMenuItem(MenuItemIterator *) const;
+ QQuickMenuBase *nextMenuItem(MenuItemIterator *) const;
- static void append_menuItems(QtMenuItems *list, QObject *o);
- static int count_menuItems(QtMenuItems *list);
- static QObject *at_menuItems(QtMenuItems *list, int index);
- static void clear_menuItems(QtMenuItems *list);
- void setupMenuItem(QtMenuBase *item, int platformIndex = -1);
+ static void append_menuItems(QQuickMenuItems *list, QObject *o);
+ static int count_menuItems(QQuickMenuItems *list);
+ static QObject *at_menuItems(QQuickMenuItems *list, int index);
+ static void clear_menuItems(QQuickMenuItems *list);
+ void setupMenuItem(QQuickMenuBase *item, int platformIndex = -1);
QPlatformMenu *m_platformMenu;
- QList<QtMenuBase *> m_menuItems;
- QHash<QObject *, QtMenuItemContainer *> m_containers;
+ QList<QQuickMenuBase *> m_menuItems;
+ QHash<QObject *, QQuickMenuItemContainer *> m_containers;
int m_itemsCount;
int m_selectedIndex;
int m_highlightedIndex;
QQuickWindow *m_parentWindow;
int m_minimumWidth;
- QtMenuPopupWindow *m_popupWindow;
+ QQuickMenuPopupWindow *m_popupWindow;
QQuickItem * m_menuContentItem;
bool m_popupVisible;
int m_containersCount;
@@ -166,6 +166,6 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QtMenu)
+QML_DECLARE_TYPE(QQuickMenu)
-#endif // QTMENU_P_H
+#endif // QQUICKMENU_P_H
diff --git a/src/controls/qtmenubar.cpp b/src/controls/qquickmenubar.cpp
index a8e4827b..e16cb8f0 100644
--- a/src/controls/qtmenubar.cpp
+++ b/src/controls/qquickmenubar.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qtmenubar_p.h"
+#include "qquickmenubar_p.h"
#include <private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformtheme.h>
@@ -50,13 +50,13 @@ QT_BEGIN_NAMESPACE
/*!
- \class QtMenuBar
+ \class QQuickMenuBar
\internal
*/
/*!
\qmltype MenuBarPrivate
- \instantiates QtMenuBar
+ \instantiates QQuickMenuBar
\internal
\inqmlmodule QtQuick.Controls 1.0
*/
@@ -70,27 +70,27 @@ QT_BEGIN_NAMESPACE
\sa Menu
*/
-QtMenuBar::QtMenuBar(QObject *parent)
+QQuickMenuBar::QQuickMenuBar(QObject *parent)
: QObject(parent), m_contentItem(0), m_parentWindow(0)
{
m_platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar();
}
-QtMenuBar::~QtMenuBar()
+QQuickMenuBar::~QQuickMenuBar()
{
}
-QQmlListProperty<QtMenu> QtMenuBar::menus()
+QQmlListProperty<QQuickMenu> QQuickMenuBar::menus()
{
- return QQmlListProperty<QtMenu>(this, 0, &QtMenuBar::append_menu, &QtMenuBar::count_menu, &QtMenuBar::at_menu, 0);
+ return QQmlListProperty<QQuickMenu>(this, 0, &QQuickMenuBar::append_menu, &QQuickMenuBar::count_menu, &QQuickMenuBar::at_menu, 0);
}
-bool QtMenuBar::isNative()
+bool QQuickMenuBar::isNative()
{
return m_platformMenuBar != 0;
}
-void QtMenuBar::setContentItem(QQuickItem *item)
+void QQuickMenuBar::setContentItem(QQuickItem *item)
{
if (item != m_contentItem) {
m_contentItem = item;
@@ -98,7 +98,7 @@ void QtMenuBar::setContentItem(QQuickItem *item)
}
}
-void QtMenuBar::setParentWindow(QQuickWindow *newParentWindow)
+void QQuickMenuBar::setParentWindow(QQuickWindow *newParentWindow)
{
if (newParentWindow != m_parentWindow) {
m_parentWindow = newParentWindow;
@@ -107,9 +107,9 @@ void QtMenuBar::setParentWindow(QQuickWindow *newParentWindow)
}
}
-void QtMenuBar::append_menu(QQmlListProperty<QtMenu> *list, QtMenu *menu)
+void QQuickMenuBar::append_menu(QQmlListProperty<QQuickMenu> *list, QQuickMenu *menu)
{
- if (QtMenuBar *menuBar = qobject_cast<QtMenuBar *>(list->object)) {
+ if (QQuickMenuBar *menuBar = qobject_cast<QQuickMenuBar *>(list->object)) {
menu->setParent(menuBar);
menuBar->m_menus.append(menu);
@@ -120,16 +120,16 @@ void QtMenuBar::append_menu(QQmlListProperty<QtMenu> *list, QtMenu *menu)
}
}
-int QtMenuBar::count_menu(QQmlListProperty<QtMenu> *list)
+int QQuickMenuBar::count_menu(QQmlListProperty<QQuickMenu> *list)
{
- if (QtMenuBar *menuBar = qobject_cast<QtMenuBar *>(list->object))
+ if (QQuickMenuBar *menuBar = qobject_cast<QQuickMenuBar *>(list->object))
return menuBar->m_menus.size();
return 0;
}
-QtMenu *QtMenuBar::at_menu(QQmlListProperty<QtMenu> *list, int index)
+QQuickMenu *QQuickMenuBar::at_menu(QQmlListProperty<QQuickMenu> *list, int index)
{
- QtMenuBar *menuBar = qobject_cast<QtMenuBar *>(list->object);
+ QQuickMenuBar *menuBar = qobject_cast<QQuickMenuBar *>(list->object);
if (menuBar && 0 <= index && index < menuBar->m_menus.size())
return menuBar->m_menus[index];
return 0;
diff --git a/src/controls/qtmenubar_p.h b/src/controls/qquickmenubar_p.h
index 9e353952..c1aeece8 100644
--- a/src/controls/qtmenubar_p.h
+++ b/src/controls/qquickmenubar_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QTMENUBAR_P_H
-#define QTMENUBAR_P_H
+#ifndef QQUICKMENUBAR_P_H
+#define QQUICKMENUBAR_P_H
-#include "qtmenu_p.h"
+#include "qquickmenu_p.h"
#include <QtCore/qobject.h>
#include <QtQuick/qquickitem.h>
@@ -52,11 +52,11 @@ QT_BEGIN_NAMESPACE
class QPlatformMenuBar;
class QQuickItem;
-class QtMenuBar: public QObject
+class QQuickMenuBar: public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<QtMenu> menus READ menus NOTIFY menusChanged)
+ Q_PROPERTY(QQmlListProperty<QQuickMenu> menus READ menus NOTIFY menusChanged)
Q_CLASSINFO("DefaultProperty", "menus")
Q_PROPERTY(QQuickItem *__contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged)
@@ -69,10 +69,10 @@ Q_SIGNALS:
void contentItemChanged();
public:
- QtMenuBar(QObject *parent = 0);
- ~QtMenuBar();
+ QQuickMenuBar(QObject *parent = 0);
+ ~QQuickMenuBar();
- QQmlListProperty<QtMenu> menus();
+ QQmlListProperty<QQuickMenu> menus();
bool isNative();
@@ -83,12 +83,12 @@ public:
void setParentWindow(QQuickWindow *);
private:
- static void append_menu(QQmlListProperty<QtMenu> *list, QtMenu *menu);
- static int count_menu(QQmlListProperty<QtMenu> *list);
- static QtMenu *at_menu(QQmlListProperty<QtMenu> *list, int index);
+ static void append_menu(QQmlListProperty<QQuickMenu> *list, QQuickMenu *menu);
+ static int count_menu(QQmlListProperty<QQuickMenu> *list);
+ static QQuickMenu *at_menu(QQmlListProperty<QQuickMenu> *list, int index);
private:
- QList<QtMenu *> m_menus;
+ QList<QQuickMenu *> m_menus;
QPlatformMenuBar *m_platformMenuBar;
QQuickItem *m_contentItem;
QQuickWindow *m_parentWindow;
@@ -96,4 +96,4 @@ private:
QT_END_NAMESPACE
-#endif //QTMENUBAR_P_H
+#endif // QQUICKMENUBAR_P_H
diff --git a/src/controls/qtmenuitem.cpp b/src/controls/qquickmenuitem.cpp
index 400fe2c9..f27c80d9 100644
--- a/src/controls/qtmenuitem.cpp
+++ b/src/controls/qquickmenuitem.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include "qtmenuitem_p.h"
+#include "qquickmenuitem_p.h"
#include "qquickaction_p.h"
-#include "qtmenu_p.h"
-#include "qtmenuitemcontainer_p.h"
+#include "qquickmenu_p.h"
+#include "qquickmenuitemcontainer_p.h"
#include <private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformtheme.h>
@@ -51,13 +51,13 @@
QT_BEGIN_NAMESPACE
-QtMenuBase::QtMenuBase(QObject *parent)
+QQuickMenuBase::QQuickMenuBase(QObject *parent)
: QObject(parent), m_visible(true), m_parentMenu(0), m_container(0), m_visualItem(0)
{
m_platformItem = QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem();
}
-QtMenuBase::~QtMenuBase()
+QQuickMenuBase::~QQuickMenuBase()
{
setParentMenu(0);
if (m_platformItem) {
@@ -66,7 +66,7 @@ QtMenuBase::~QtMenuBase()
}
}
-void QtMenuBase::setVisible(bool v)
+void QQuickMenuBase::setVisible(bool v)
{
if (v != m_visible) {
m_visible = v;
@@ -80,12 +80,12 @@ void QtMenuBase::setVisible(bool v)
}
}
-QtMenu *QtMenuBase::parentMenu() const
+QQuickMenu *QQuickMenuBase::parentMenu() const
{
return m_parentMenu;
}
-void QtMenuBase::setParentMenu(QtMenu *parentMenu)
+void QQuickMenuBase::setParentMenu(QQuickMenu *parentMenu)
{
if (m_parentMenu && m_parentMenu->platformMenu())
m_parentMenu->platformMenu()->removeMenuItem(m_platformItem);
@@ -93,37 +93,37 @@ void QtMenuBase::setParentMenu(QtMenu *parentMenu)
m_parentMenu = parentMenu;
}
-QtMenuItemContainer *QtMenuBase::container() const
+QQuickMenuItemContainer *QQuickMenuBase::container() const
{
return m_container;
}
-void QtMenuBase::setContainer(QtMenuItemContainer *c)
+void QQuickMenuBase::setContainer(QQuickMenuItemContainer *c)
{
m_container = c;
}
-void QtMenuBase::syncWithPlatformMenu()
+void QQuickMenuBase::syncWithPlatformMenu()
{
- QtMenu *menu = parentMenu();
+ QQuickMenu *menu = parentMenu();
if (menu && menu->platformMenu() && platformItem()
&& menu->contains(this)) // If not, it'll be added later and then sync'ed
menu->platformMenu()->syncMenuItem(platformItem());
}
-QQuickItem *QtMenuBase::visualItem() const
+QQuickItem *QQuickMenuBase::visualItem() const
{
return m_visualItem;
}
-void QtMenuBase::setVisualItem(QQuickItem *item)
+void QQuickMenuBase::setVisualItem(QQuickItem *item)
{
m_visualItem = item;
}
/*!
\qmltype MenuSeparator
- \instantiates QtMenuSeparator
+ \instantiates QQuickMenuSeparator
\inqmlmodule QtQuick.Controls 1.0
\ingroup menus
\brief MenuSeparator provides a separator for items inside a menu.
@@ -143,15 +143,15 @@ void QtMenuBase::setVisualItem(QQuickItem *item)
This property is read-only and constant, and its value is \l MenuItemType.Separator.
*/
-QtMenuSeparator::QtMenuSeparator(QObject *parent)
- : QtMenuBase(parent)
+QQuickMenuSeparator::QQuickMenuSeparator(QObject *parent)
+ : QQuickMenuBase(parent)
{
if (platformItem())
platformItem()->setIsSeparator(true);
}
-QtMenuText::QtMenuText(QObject *parent)
- : QtMenuBase(parent), m_action(new QQuickAction(this))
+QQuickMenuText::QQuickMenuText(QObject *parent)
+ : QQuickMenuBase(parent), m_action(new QQuickAction(this))
{
connect(m_action, SIGNAL(enabledChanged()), this, SLOT(updateEnabled()));
connect(m_action, SIGNAL(textChanged()), this, SLOT(updateText()));
@@ -161,57 +161,57 @@ QtMenuText::QtMenuText(QObject *parent)
connect(m_action, SIGNAL(iconSourceChanged()), this, SIGNAL(iconSourceChanged()));
}
-QtMenuText::~QtMenuText()
+QQuickMenuText::~QQuickMenuText()
{
delete m_action;
}
-bool QtMenuText::enabled() const
+bool QQuickMenuText::enabled() const
{
return action()->isEnabled();
}
-void QtMenuText::setEnabled(bool e)
+void QQuickMenuText::setEnabled(bool e)
{
action()->setEnabled(e);
}
-QString QtMenuText::text() const
+QString QQuickMenuText::text() const
{
return m_action->text();
}
-void QtMenuText::setText(const QString &t)
+void QQuickMenuText::setText(const QString &t)
{
m_action->setText(t);
}
-QUrl QtMenuText::iconSource() const
+QUrl QQuickMenuText::iconSource() const
{
return m_action->iconSource();
}
-void QtMenuText::setIconSource(const QUrl &iconSource)
+void QQuickMenuText::setIconSource(const QUrl &iconSource)
{
m_action->setIconSource(iconSource);
}
-QString QtMenuText::iconName() const
+QString QQuickMenuText::iconName() const
{
return m_action->iconName();
}
-void QtMenuText::setIconName(const QString &iconName)
+void QQuickMenuText::setIconName(const QString &iconName)
{
m_action->setIconName(iconName);
}
-QIcon QtMenuText::icon() const
+QIcon QQuickMenuText::icon() const
{
return m_action->icon();
}
-void QtMenuText::updateText()
+void QQuickMenuText::updateText()
{
if (platformItem()) {
platformItem()->setText(text());
@@ -220,7 +220,7 @@ void QtMenuText::updateText()
emit __textChanged();
}
-void QtMenuText::updateEnabled()
+void QQuickMenuText::updateEnabled()
{
if (platformItem()) {
platformItem()->setEnabled(enabled());
@@ -229,7 +229,7 @@ void QtMenuText::updateEnabled()
emit enabledChanged();
}
-void QtMenuText::updateIcon()
+void QQuickMenuText::updateIcon()
{
if (platformItem()) {
platformItem()->setIcon(icon());
@@ -240,7 +240,7 @@ void QtMenuText::updateIcon()
/*!
\qmltype MenuItem
- \instantiates QtMenuItem
+ \instantiates QQuickMenuItem
\ingroup menus
\inqmlmodule QtQuick.Controls 1.0
\brief MenuItem provides an item to add in a menu or a menu bar.
@@ -394,8 +394,8 @@ void QtMenuText::updateIcon()
Defaults to \c null, meaning no action is bound to the menu item.
*/
-QtMenuItem::QtMenuItem(QObject *parent)
- : QtMenuText(parent), m_boundAction(0)
+QQuickMenuItem::QQuickMenuItem(QObject *parent)
+ : QQuickMenuText(parent), m_boundAction(0)
{
connect(this, SIGNAL(__textChanged()), this, SIGNAL(textChanged()));
@@ -405,21 +405,21 @@ QtMenuItem::QtMenuItem(QObject *parent)
connect(platformItem(), SIGNAL(activated()), this, SLOT(trigger()));
}
-QtMenuItem::~QtMenuItem()
+QQuickMenuItem::~QQuickMenuItem()
{
unbindFromAction(m_boundAction);
if (platformItem())
disconnect(platformItem(), SIGNAL(activated()), this, SLOT(trigger()));
}
-void QtMenuItem::setParentMenu(QtMenu *parentMenu)
+void QQuickMenuItem::setParentMenu(QQuickMenu *parentMenu)
{
- QtMenuText::setParentMenu(parentMenu);
+ QQuickMenuText::setParentMenu(parentMenu);
if (parentMenu)
connect(this, SIGNAL(triggered()), parentMenu, SLOT(updateSelectedIndex()));
}
-void QtMenuItem::bindToAction(QQuickAction *action)
+void QQuickMenuItem::bindToAction(QQuickAction *action)
{
m_boundAction = action;
@@ -447,7 +447,7 @@ void QtMenuItem::bindToAction(QQuickAction *action)
}
}
-void QtMenuItem::unbindFromAction(QObject *o)
+void QQuickMenuItem::unbindFromAction(QObject *o)
{
if (!o)
return;
@@ -474,14 +474,14 @@ void QtMenuItem::unbindFromAction(QObject *o)
disconnect(action, SIGNAL(iconSourceChanged()), this, SIGNAL(iconSourceChanged()));
}
-QQuickAction *QtMenuItem::action() const
+QQuickAction *QQuickMenuItem::action() const
{
if (m_boundAction)
return m_boundAction;
- return QtMenuText::action();
+ return QQuickMenuText::action();
}
-void QtMenuItem::setBoundAction(QQuickAction *a)
+void QQuickMenuItem::setBoundAction(QQuickAction *a)
{
if (a == m_boundAction)
return;
@@ -497,50 +497,50 @@ void QtMenuItem::setBoundAction(QQuickAction *a)
emit actionChanged();
}
-QString QtMenuItem::text() const
+QString QQuickMenuItem::text() const
{
- QString ownText = QtMenuText::text();
+ QString ownText = QQuickMenuText::text();
if (!ownText.isEmpty())
return ownText;
return m_boundAction ? m_boundAction->text() : QString();
}
-QUrl QtMenuItem::iconSource() const
+QUrl QQuickMenuItem::iconSource() const
{
- QUrl ownIconSource = QtMenuText::iconSource();
+ QUrl ownIconSource = QQuickMenuText::iconSource();
if (!ownIconSource.isEmpty())
return ownIconSource;
return m_boundAction ? m_boundAction->iconSource() : QUrl();
}
-QString QtMenuItem::iconName() const
+QString QQuickMenuItem::iconName() const
{
- QString ownIconName = QtMenuText::iconName();
+ QString ownIconName = QQuickMenuText::iconName();
if (!ownIconName.isEmpty())
return ownIconName;
return m_boundAction ? m_boundAction->iconName() : QString();
}
-QIcon QtMenuItem::icon() const
+QIcon QQuickMenuItem::icon() const
{
- QIcon ownIcon = QtMenuText::icon();
+ QIcon ownIcon = QQuickMenuText::icon();
if (!ownIcon.isNull())
return ownIcon;
return m_boundAction ? m_boundAction->icon() : QIcon();
}
-QString QtMenuItem::shortcut() const
+QString QQuickMenuItem::shortcut() const
{
return action()->shortcut();
}
-void QtMenuItem::setShortcut(const QString &shortcut)
+void QQuickMenuItem::setShortcut(const QString &shortcut)
{
if (!m_boundAction)
action()->setShortcut(shortcut);
}
-void QtMenuItem::updateShortcut()
+void QQuickMenuItem::updateShortcut()
{
if (platformItem()) {
platformItem()->setShortcut(QKeySequence(shortcut()));
@@ -549,29 +549,29 @@ void QtMenuItem::updateShortcut()
emit shortcutChanged();
}
-bool QtMenuItem::checkable() const
+bool QQuickMenuItem::checkable() const
{
return action()->isCheckable();
}
-void QtMenuItem::setCheckable(bool checkable)
+void QQuickMenuItem::setCheckable(bool checkable)
{
if (!m_boundAction)
action()->setCheckable(checkable);
}
-bool QtMenuItem::checked() const
+bool QQuickMenuItem::checked() const
{
return action()->isChecked();
}
-void QtMenuItem::setChecked(bool checked)
+void QQuickMenuItem::setChecked(bool checked)
{
if (!m_boundAction)
action()->setChecked(checked);
}
-void QtMenuItem::updateChecked()
+void QQuickMenuItem::updateChecked()
{
bool checked = this->checked();
if (platformItem()) {
@@ -582,24 +582,24 @@ void QtMenuItem::updateChecked()
emit toggled(checked);
}
-QQuickExclusiveGroup *QtMenuItem::exclusiveGroup() const
+QQuickExclusiveGroup *QQuickMenuItem::exclusiveGroup() const
{
return action()->exclusiveGroup();
}
-void QtMenuItem::setExclusiveGroup(QQuickExclusiveGroup *eg)
+void QQuickMenuItem::setExclusiveGroup(QQuickExclusiveGroup *eg)
{
if (!m_boundAction)
action()->setExclusiveGroup(eg);
}
-void QtMenuItem::setEnabled(bool enabled)
+void QQuickMenuItem::setEnabled(bool enabled)
{
if (!m_boundAction)
action()->setEnabled(enabled);
}
-void QtMenuItem::trigger()
+void QQuickMenuItem::trigger()
{
action()->trigger();
}
diff --git a/src/controls/qtmenuitem_p.h b/src/controls/qquickmenuitem_p.h
index f2036911..61229685 100644
--- a/src/controls/qtmenuitem_p.h
+++ b/src/controls/qquickmenuitem_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QTMENUITEM_P_H
-#define QTMENUITEM_P_H
+#ifndef QQUICKMENUITEM_P_H
+#define QQUICKMENUITEM_P_H
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
@@ -56,10 +56,10 @@ class QPlatformMenuItem;
class QQuickItem;
class QQuickAction;
class QQuickExclusiveGroup;
-class QtMenu;
-class QtMenuItemContainer;
+class QQuickMenu;
+class QQuickMenuItemContainer;
-class QtMenuItemType
+class QQuickMenuItemType
{
Q_GADGET
Q_ENUMS(MenuItemType)
@@ -72,13 +72,13 @@ public:
};
};
-class QtMenuBase: public QObject
+class QQuickMenuBase: public QObject
{
Q_OBJECT
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
- Q_PROPERTY(QtMenuItemType::MenuItemType type READ type CONSTANT)
+ Q_PROPERTY(QQuickMenuItemType::MenuItemType type READ type CONSTANT)
- Q_PROPERTY(QtMenu *__parentMenu READ parentMenu CONSTANT)
+ Q_PROPERTY(QQuickMenu *__parentMenu READ parentMenu CONSTANT)
Q_PROPERTY(bool __isNative READ isNative CONSTANT)
Q_PROPERTY(QQuickItem *__visualItem READ visualItem WRITE setVisualItem)
@@ -86,17 +86,17 @@ Q_SIGNALS:
void visibleChanged();
public:
- QtMenuBase(QObject *parent = 0);
- ~QtMenuBase();
+ QQuickMenuBase(QObject *parent = 0);
+ ~QQuickMenuBase();
bool visible() const { return m_visible; }
void setVisible(bool);
- QtMenu *parentMenu() const;
- virtual void setParentMenu(QtMenu *parentMenu);
+ QQuickMenu *parentMenu() const;
+ virtual void setParentMenu(QQuickMenu *parentMenu);
- QtMenuItemContainer *container() const;
- void setContainer(QtMenuItemContainer *);
+ QQuickMenuItemContainer *container() const;
+ void setContainer(QQuickMenuItemContainer *);
inline QPlatformMenuItem *platformItem() { return m_platformItem; }
void syncWithPlatformMenu();
@@ -104,27 +104,27 @@ public:
QQuickItem *visualItem() const;
void setVisualItem(QQuickItem *item);
- virtual QtMenuItemType::MenuItemType type() { return QtMenuItemType::Item; }
+ virtual QQuickMenuItemType::MenuItemType type() { return QQuickMenuItemType::Item; }
virtual bool isNative() { return m_platformItem != 0; }
private:
bool m_visible;
- QtMenu *m_parentMenu;
- QtMenuItemContainer *m_container;
+ QQuickMenu *m_parentMenu;
+ QQuickMenuItemContainer *m_container;
QPlatformMenuItem *m_platformItem;
QPointer<QQuickItem> m_visualItem;
};
-class QtMenuSeparator : public QtMenuBase
+class QQuickMenuSeparator : public QQuickMenuBase
{
Q_OBJECT
public:
- QtMenuSeparator(QObject *parent = 0);
+ QQuickMenuSeparator(QObject *parent = 0);
- QtMenuItemType::MenuItemType type() { return QtMenuItemType::Separator; }
+ QQuickMenuItemType::MenuItemType type() { return QQuickMenuItemType::Separator; }
};
-class QtMenuText: public QtMenuBase
+class QQuickMenuText : public QQuickMenuBase
{
Q_OBJECT
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
@@ -142,8 +142,8 @@ Q_SIGNALS:
void __iconChanged();
public:
- QtMenuText(QObject *parent = 0);
- ~QtMenuText();
+ QQuickMenuText(QObject *parent = 0);
+ ~QQuickMenuText();
bool enabled() const;
virtual void setEnabled(bool enabled);
@@ -171,7 +171,7 @@ private:
QQuickAction *m_action;
};
-class QtMenuItem: public QtMenuText
+class QQuickMenuItem : public QQuickMenuText
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
@@ -195,8 +195,8 @@ Q_SIGNALS:
void actionChanged();
public:
- QtMenuItem(QObject *parent = 0);
- ~QtMenuItem();
+ QQuickMenuItem(QObject *parent = 0);
+ ~QQuickMenuItem();
void setEnabled(bool enabled);
@@ -220,7 +220,7 @@ public:
QQuickExclusiveGroup *exclusiveGroup() const;
void setExclusiveGroup(QQuickExclusiveGroup *);
- void setParentMenu(QtMenu *parentMenu);
+ void setParentMenu(QQuickMenu *parentMenu);
protected Q_SLOTS:
void updateShortcut();
@@ -238,4 +238,4 @@ private:
QT_END_NAMESPACE
-#endif //QTMENUITEM_P_H
+#endif // QQUICKMENUITEM_P_H
diff --git a/src/controls/qtmenuitemcontainer_p.h b/src/controls/qquickmenuitemcontainer_p.h
index 2dbad6c6..11ac7495 100644
--- a/src/controls/qtmenuitemcontainer_p.h
+++ b/src/controls/qquickmenuitemcontainer_p.h
@@ -39,28 +39,28 @@
**
****************************************************************************/
-#ifndef QTMENUITEMSCONTAINER_P_H
-#define QTMENUITEMSCONTAINER_P_H
+#ifndef QQUICKMENUITEMCONTAINER_P_H
+#define QQUICKMENUITEMCONTAINER_P_H
-#include "qtmenuitem_p.h"
+#include "qquickmenuitem_p.h"
#include <QtCore/qlist.h>
QT_BEGIN_NAMESPACE
-class QtMenuItemContainer : public QtMenuBase
+class QQuickMenuItemContainer : public QQuickMenuBase
{
Q_OBJECT
public:
- explicit QtMenuItemContainer(QObject *parent = 0)
- : QtMenuBase(parent)
+ explicit QQuickMenuItemContainer(QObject *parent = 0)
+ : QQuickMenuBase(parent)
{ }
- ~QtMenuItemContainer()
+ ~QQuickMenuItemContainer()
{
clear();
}
- void insertItem(int index, QtMenuBase *item)
+ void insertItem(int index, QQuickMenuBase *item)
{
if (index == -1)
index = m_menuItems.count();
@@ -68,14 +68,14 @@ public:
item->setContainer(this);
}
- void removeItem(QtMenuBase *item)
+ void removeItem(QQuickMenuBase *item)
{
item->setParentMenu(0);
item->setContainer(0);
m_menuItems.removeOne(item);
}
- const QList<QPointer<QtMenuBase> > &items()
+ const QList<QPointer<QQuickMenuBase> > &items()
{
return m_menuItems;
}
@@ -83,7 +83,7 @@ public:
void clear()
{
while (!m_menuItems.empty()) {
- QtMenuBase *item = m_menuItems.takeFirst();
+ QQuickMenuBase *item = m_menuItems.takeFirst();
if (item) {
item->setParentMenu(0);
item->setContainer(0);
@@ -92,9 +92,9 @@ public:
}
private:
- QList<QPointer<QtMenuBase> > m_menuItems;
+ QList<QPointer<QQuickMenuBase> > m_menuItems;
};
QT_END_NAMESPACE
-#endif // QTMENUITEMCONTAINER_H
+#endif // QQUICKMENUITEMCONTAINER_P_H
diff --git a/src/controls/qtmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp
index a3f76aa0..a8f2a153 100644
--- a/src/controls/qtmenupopupwindow.cpp
+++ b/src/controls/qquickmenupopupwindow.cpp
@@ -39,8 +39,7 @@
**
****************************************************************************/
-#include "qtmenupopupwindow_p.h"
-#include "qtmenu_p.h"
+#include "qquickmenupopupwindow_p.h"
#include <qguiapplication.h>
#include <qquickitem.h>
@@ -48,7 +47,7 @@
QT_BEGIN_NAMESPACE
-QtMenuPopupWindow::QtMenuPopupWindow(QWindow *parent) :
+QQuickMenuPopupWindow::QQuickMenuPopupWindow(QWindow *parent) :
QQuickWindow(parent), m_mouseMoved(false), m_itemAt(0),
m_parentItem(0), m_menuContentItem(0)
{
@@ -56,7 +55,7 @@ QtMenuPopupWindow::QtMenuPopupWindow(QWindow *parent) :
setModality(Qt::WindowModal);
}
-void QtMenuPopupWindow::show()
+void QQuickMenuPopupWindow::show()
{
qreal posx = x();
qreal posy = y();
@@ -85,7 +84,7 @@ void QtMenuPopupWindow::show()
setPosition(posx, posy);
}
- if (!qobject_cast<QtMenuPopupWindow *>(transientParent())) // No need for parent menu windows
+ if (!qobject_cast<QQuickMenuPopupWindow *>(transientParent())) // No need for parent menu windows
if (QQuickWindow *w = qobject_cast<QQuickWindow *>(transientParent()))
if (QQuickItem *mg = w->mouseGrabberItem())
mg->ungrabMouse();
@@ -95,14 +94,14 @@ void QtMenuPopupWindow::show()
setKeyboardGrabEnabled(true);
}
-void QtMenuPopupWindow::setParentItem(QQuickItem *item)
+void QQuickMenuPopupWindow::setParentItem(QQuickItem *item)
{
m_parentItem = item;
if (m_parentItem)
setParentWindow(m_parentItem->window());
}
-void QtMenuPopupWindow::setMenuContentItem(QQuickItem *contentItem)
+void QQuickMenuPopupWindow::setMenuContentItem(QQuickItem *contentItem)
{
if (!contentItem)
return;
@@ -113,7 +112,7 @@ void QtMenuPopupWindow::setMenuContentItem(QQuickItem *contentItem)
m_menuContentItem = contentItem;
}
-void QtMenuPopupWindow::setItemAt(QQuickItem *menuItem)
+void QQuickMenuPopupWindow::setItemAt(QQuickItem *menuItem)
{
if (m_itemAt) {
disconnect(m_itemAt, SIGNAL(xChanged()), this, SLOT(updatePosition()));
@@ -128,17 +127,17 @@ void QtMenuPopupWindow::setItemAt(QQuickItem *menuItem)
}
}
-void QtMenuPopupWindow::setParentWindow(QQuickWindow *parentWindow)
+void QQuickMenuPopupWindow::setParentWindow(QQuickWindow *parentWindow)
{
setTransientParent(parentWindow);
if (parentWindow) {
connect(parentWindow, SIGNAL(destroyed()), this, SLOT(dismissMenu()));
- if (QtMenuPopupWindow *pw = qobject_cast<QtMenuPopupWindow *>(parentWindow))
+ if (QQuickMenuPopupWindow *pw = qobject_cast<QQuickMenuPopupWindow *>(parentWindow))
connect(pw, SIGNAL(menuDismissed()), this, SLOT(dismissMenu()));
}
}
-void QtMenuPopupWindow::setGeometry(int posx, int posy, int w, int h)
+void QQuickMenuPopupWindow::setGeometry(int posx, int posy, int w, int h)
{
QWindow *pw = transientParent();
if (!pw && m_parentItem )
@@ -148,7 +147,7 @@ void QtMenuPopupWindow::setGeometry(int posx, int posy, int w, int h)
QRect g = pw->screen()->availableVirtualGeometry();
if (posx + w > g.right()) {
- if (qobject_cast<QtMenuPopupWindow *>(transientParent())) {
+ if (qobject_cast<QQuickMenuPopupWindow *>(transientParent())) {
// reposition submenu window on the parent menu's left side
int submenuOverlap = pw->x() + pw->width() - posx;
posx -= pw->width() + w - 2 * submenuOverlap;
@@ -164,25 +163,25 @@ void QtMenuPopupWindow::setGeometry(int posx, int posy, int w, int h)
QQuickWindow::setGeometry(posx, posy, w, h);
}
-void QtMenuPopupWindow::dismissMenu()
+void QQuickMenuPopupWindow::dismissMenu()
{
emit menuDismissed();
close();
}
-void QtMenuPopupWindow::updateSize()
+void QQuickMenuPopupWindow::updateSize()
{
QSize contentSize = contentItem()->childrenRect().size().toSize();
setGeometry(position().x(), position().y(), contentSize.width(), contentSize.height());
}
-void QtMenuPopupWindow::updatePosition()
+void QQuickMenuPopupWindow::updatePosition()
{
QPointF newPos = position() + m_oldItemPos - m_itemAt->position();
setGeometry(newPos.x(), newPos.y(), width(), height());
}
-void QtMenuPopupWindow::mouseMoveEvent(QMouseEvent *e)
+void QQuickMenuPopupWindow::mouseMoveEvent(QMouseEvent *e)
{
QRect rect = QRect(QPoint(), size());
m_mouseMoved = true;
@@ -192,14 +191,14 @@ void QtMenuPopupWindow::mouseMoveEvent(QMouseEvent *e)
forwardEventToTransientParent(e);
}
-void QtMenuPopupWindow::mousePressEvent(QMouseEvent *e)
+void QQuickMenuPopupWindow::mousePressEvent(QMouseEvent *e)
{
QRect rect = QRect(QPoint(), size());
if (!rect.contains(e->pos()))
forwardEventToTransientParent(e);
}
-void QtMenuPopupWindow::mouseReleaseEvent(QMouseEvent *e)
+void QQuickMenuPopupWindow::mouseReleaseEvent(QMouseEvent *e)
{
QRect rect = QRect(QPoint(), size());
if (rect.contains(e->pos())) {
@@ -214,9 +213,9 @@ void QtMenuPopupWindow::mouseReleaseEvent(QMouseEvent *e)
}
}
-void QtMenuPopupWindow::forwardEventToTransientParent(QMouseEvent *e)
+void QQuickMenuPopupWindow::forwardEventToTransientParent(QMouseEvent *e)
{
- if (!qobject_cast<QtMenuPopupWindow*>(transientParent())
+ if (!qobject_cast<QQuickMenuPopupWindow*>(transientParent())
&& ((m_mouseMoved && e->type() == QEvent::MouseButtonRelease)
|| e->type() == QEvent::MouseButtonPress)) {
// Clicked outside any menu
diff --git a/src/controls/qtmenupopupwindow_p.h b/src/controls/qquickmenupopupwindow_p.h
index 8d432974..aead2bd8 100644
--- a/src/controls/qtmenupopupwindow_p.h
+++ b/src/controls/qquickmenupopupwindow_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QTMENUPOPUPWINDOW_H
-#define QTMENUPOPUPWINDOW_H
+#ifndef QQUICKMENUPOPUPWINDOW_H
+#define QQUICKMENUPOPUPWINDOW_H
#include <QtQuick/qquickwindow.h>
@@ -49,14 +49,14 @@ QT_BEGIN_NAMESPACE
class QEvent;
class QQuickItem;
-class QtMenuPopupWindow : public QQuickWindow
+class QQuickMenuPopupWindow : public QQuickWindow
{
Q_OBJECT
Q_PROPERTY(QQuickItem *contentItem READ menuContentItem WRITE setMenuContentItem)
Q_CLASSINFO("DefaultProperty", "contentItem")
Q_PROPERTY(QQuickItem *parentItem READ parentItem WRITE setParentItem)
public:
- QtMenuPopupWindow(QWindow *parent = 0);
+ QQuickMenuPopupWindow(QWindow *parent = 0);
QQuickItem *menuContentItem() const { return m_menuContentItem; }
void setMenuContentItem(QQuickItem *contentItem);
@@ -94,4 +94,4 @@ private:
QT_END_NAMESPACE
-#endif // QTMENUPOPUPWINDOW_H
+#endif // QQUICKMENUPOPUPWINDOW_H