summaryrefslogtreecommitdiff
path: root/src/controls
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-21 08:38:35 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-01-21 08:38:35 +0100
commitad964dd36a56dcd071bb3527ee4957c607365cce (patch)
tree1e916348677fa8ca974916b9f3e3fcb3a55d3b48 /src/controls
parente42603fd5b4efaa321dfc4417905510beafe288e (diff)
parent148faf6278186986d1ca6afcdea0c361bcbf199e (diff)
downloadqtquickcontrols-ad964dd36a56dcd071bb3527ee4957c607365cce.tar.gz
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/controls/qquickmenubar.cpp Change-Id: I4b036212b6dadded2c4d60dd07e91f629e80d9c2
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/Private/BasicTableView.qml4
-rw-r--r--src/controls/Private/ColumnMenuContent.qml2
-rw-r--r--src/controls/Private/ScrollBar.qml2
-rw-r--r--src/controls/Private/ScrollViewHelper.qml10
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp2
-rw-r--r--src/controls/Private/qquickstyleitem.cpp312
-rw-r--r--src/controls/ScrollView.qml2
-rw-r--r--src/controls/Styles/Base/images/spinner_large.pngbin8401 -> 4723 bytes
-rw-r--r--src/controls/Styles/Base/images/spinner_medium.pngbin2772 -> 1621 bytes
-rw-r--r--src/controls/Styles/Base/images/spinner_small.pngbin1810 -> 998 bytes
-rw-r--r--src/controls/doc/src/qtquickcontrols-tableview.qdoc2
-rw-r--r--src/controls/doc/src/qtquickcontrols-treeview.qdoc4
-rw-r--r--src/controls/plugin.cpp6
-rw-r--r--src/controls/qquickmenu.cpp132
-rw-r--r--src/controls/qquickmenu_p.h19
-rw-r--r--src/controls/qquickmenubar.cpp38
-rw-r--r--src/controls/qquickmenubar_p.h18
-rw-r--r--src/controls/qquickmenuitem.cpp58
-rw-r--r--src/controls/qquickmenuitem_p.h16
-rw-r--r--src/controls/qquickmenuitemcontainer_p.h2
-rw-r--r--src/controls/qquickmenupopupwindow.cpp32
-rw-r--r--src/controls/qquickmenupopupwindow_p.h13
22 files changed, 343 insertions, 331 deletions
diff --git a/src/controls/Private/BasicTableView.qml b/src/controls/Private/BasicTableView.qml
index 822086ee..afec226d 100644
--- a/src/controls/Private/BasicTableView.qml
+++ b/src/controls/Private/BasicTableView.qml
@@ -677,7 +677,7 @@ ScrollView {
onPositionChanged: {
if (drag.active && modelData.movable && pressed && columnCount > 1) { // only do this while dragging
for (var h = columnCount-1 ; h >= 0 ; --h) {
- if (drag.target.x + listView.contentX + headerRowDelegate.width/2 > headerRow.children[h].x) {
+ if (headerRow.children[h].visible && drag.target.x + headerRowDelegate.width/2 > headerRow.children[h].x) {
repeater.targetIndex = h
break
}
@@ -715,7 +715,7 @@ ScrollView {
}
parent: tableHeader
x: __implicitX
- property double __implicitX: headerRowDelegate.x - listView.contentX
+ property double __implicitX: headerRowDelegate.x
width: modelData.width
height: parent.height
sourceComponent: root.headerDelegate
diff --git a/src/controls/Private/ColumnMenuContent.qml b/src/controls/Private/ColumnMenuContent.qml
index 4d0f944d..d184524e 100644
--- a/src/controls/Private/ColumnMenuContent.qml
+++ b/src/controls/Private/ColumnMenuContent.qml
@@ -201,7 +201,7 @@ Item {
onPositionChanged: updateCurrentItem({ "x": mouse.x, "y": mouse.y })
onPressed: updateCurrentItem({ "x": mouse.x, "y": mouse.y })
onReleased: {
- if (currentItem.__menuItem.enabled) {
+ if (currentItem && currentItem.__menuItem.enabled) {
if (currentItem.styleData.type === MenuItemType.Menu) {
showCurrentItemSubMenu(true)
} else {
diff --git a/src/controls/Private/ScrollBar.qml b/src/controls/Private/ScrollBar.qml
index f6f5e26d..ca9c21cd 100644
--- a/src/controls/Private/ScrollBar.qml
+++ b/src/controls/Private/ScrollBar.qml
@@ -88,7 +88,7 @@ Item {
property int pageStep: internal.horizontal ? width : height
property bool scrollToClickposition: internal.scrollToClickPosition
anchors.fill: parent
- cursorShape: __panel.visible ? Qt.ArrowCursor : Qt.IBeamCursor // forces a cursor change
+ cursorShape: __panel && __panel.visible ? Qt.ArrowCursor : Qt.IBeamCursor // forces a cursor change
property bool autoincrement: false
property bool scrollToClickPosition: __style ? __style.scrollToClickedPosition : 0
diff --git a/src/controls/Private/ScrollViewHelper.qml b/src/controls/Private/ScrollViewHelper.qml
index d34aa555..24def4c9 100644
--- a/src/controls/Private/ScrollViewHelper.qml
+++ b/src/controls/Private/ScrollViewHelper.qml
@@ -58,10 +58,10 @@ Item {
property int verticalScrollBarPolicy: Qt.ScrollBarAsNeeded
- property int leftMargin: outerFrame ? root.__style.padding.left : 0
- property int rightMargin: outerFrame ? root.__style.padding.right : 0
- property int topMargin: outerFrame ? root.__style.padding.top : 0
- property int bottomMargin: outerFrame ? root.__style.padding.bottom : 0
+ property int leftMargin: outerFrame && root.__style ? root.__style.padding.left : 0
+ property int rightMargin: outerFrame && root.__style ? root.__style.padding.right : 0
+ property int topMargin: outerFrame && root.__style ? root.__style.padding.top : 0
+ property int bottomMargin: outerFrame && root.__style ? root.__style.padding.bottom : 0
anchors.fill: parent
@@ -101,7 +101,7 @@ Item {
Loader {
id: cornerFill
z: 1
- sourceComponent: __style.corner
+ sourceComponent: __style ? __style.corner : null
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: bottomMargin
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp
index 0f22f127..9e76cb07 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -120,7 +120,7 @@ QUrl QQuickControlSettings::makeStyleComponentUrl(const QString &controlStyleNam
{
QString styleFilePath = makeStyleComponentPath(controlStyleName, styleDirPath);
- if (styleDirPath.startsWith(QStringLiteral(":/")))
+ if (styleDirPath.startsWith(QLatin1String(":/")))
return QUrl(QStringLiteral("qrc") + styleFilePath);
return QUrl::fromLocalFile(styleFilePath);
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index 3cf8ebbe..c8be5685 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -284,9 +284,9 @@ void QQuickStyleItem::initStyleOption()
if (m_styleoption)
m_styleoption->state = 0;
- QString sizeHint = m_hints.value("size").toString();
- QPlatformTheme::Font platformFont = (sizeHint == "mini") ? QPlatformTheme::MiniFont :
- (sizeHint == "small") ? QPlatformTheme::SmallFont :
+ QString sizeHint = m_hints.value(QStringLiteral("size")).toString();
+ QPlatformTheme::Font platformFont = (sizeHint == QLatin1String("mini")) ? QPlatformTheme::MiniFont :
+ (sizeHint == QLatin1String("small")) ? QPlatformTheme::SmallFont :
QPlatformTheme::SystemFont;
bool needsResolvePalette = true;
@@ -298,10 +298,10 @@ void QQuickStyleItem::initStyleOption()
QStyleOptionButton *opt = qstyleoption_cast<QStyleOptionButton*>(m_styleoption);
opt->text = text();
- opt->icon = m_properties["icon"].value<QIcon>();
+ opt->icon = m_properties[QStringLiteral("icon")].value<QIcon>();
int e = qApp->style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, 0);
opt->iconSize = QSize(e, e);
- opt->features = (activeControl() == "default") ?
+ opt->features = activeControl() == QLatin1String("default") ?
QStyleOptionButton::DefaultButton :
QStyleOptionButton::None;
if (platformFont == QPlatformTheme::SystemFont)
@@ -309,11 +309,11 @@ void QQuickStyleItem::initStyleOption()
const QFont *font = QGuiApplicationPrivate::platformTheme()->font(platformFont);
if (font)
opt->fontMetrics = QFontMetrics(*font);
- QObject * menu = m_properties["menu"].value<QObject *>();
+ QObject * menu = m_properties[QStringLiteral("menu")].value<QObject *>();
if (menu) {
opt->features |= QStyleOptionButton::HasMenu;
#ifdef Q_OS_OSX
- if (style() == "mac") {
+ if (style() == QLatin1String("mac")) {
if (platformFont == QPlatformTheme::PushButtonFont)
menu->setProperty("__xOffset", 12);
else
@@ -337,7 +337,7 @@ void QQuickStyleItem::initStyleOption()
QStyleOptionViewItem *opt = qstyleoption_cast<QStyleOptionViewItem*>(m_styleoption);
opt->features = 0;
- if (activeControl() == "alternate")
+ if (activeControl() == QLatin1String("alternate"))
opt->features |= QStyleOptionViewItem::Alternate;
}
break;
@@ -375,9 +375,9 @@ void QQuickStyleItem::initStyleOption()
m_styleoption = new QStyleOption;
m_styleoption->state = QStyle::State_Item; // We don't want to fully support Win 95
- if (m_properties.value("hasChildren").toBool())
+ if (m_properties.value(QStringLiteral("hasChildren")).toBool())
m_styleoption->state |= QStyle::State_Children;
- if (m_properties.value("hasSibling").toBool()) // Even this one could go away
+ if (m_properties.value(QStringLiteral("hasSibling")).toBool()) // Even this one could go away
m_styleoption->state |= QStyle::State_Sibling;
if (m_on)
m_styleoption->state |= QStyle::State_Open;
@@ -389,17 +389,17 @@ void QQuickStyleItem::initStyleOption()
QStyleOptionHeader *opt = qstyleoption_cast<QStyleOptionHeader*>(m_styleoption);
opt->text = text();
- opt->textAlignment = static_cast<Qt::AlignmentFlag>(m_properties.value("textalignment").toInt());
- opt->sortIndicator = activeControl() == "down" ?
+ opt->textAlignment = static_cast<Qt::AlignmentFlag>(m_properties.value(QStringLiteral("textalignment")).toInt());
+ opt->sortIndicator = activeControl() == QLatin1String("down") ?
QStyleOptionHeader::SortDown
- : activeControl() == "up" ?
+ : activeControl() == QLatin1String("up") ?
QStyleOptionHeader::SortUp : QStyleOptionHeader::None;
- QString headerpos = m_properties.value("headerpos").toString();
- if (headerpos == "beginning")
+ QString headerpos = m_properties.value(QStringLiteral("headerpos")).toString();
+ if (headerpos == QLatin1String("beginning"))
opt->position = QStyleOptionHeader::Beginning;
- else if (headerpos == "end")
+ else if (headerpos == QLatin1String("end"))
opt->position = QStyleOptionHeader::End;
- else if (headerpos == "only")
+ else if (headerpos == QLatin1String("only"))
opt->position = QStyleOptionHeader::OnlyOneSection;
else
opt->position = QStyleOptionHeader::Middle;
@@ -417,9 +417,9 @@ void QQuickStyleItem::initStyleOption()
opt->state |= QStyle::State_AutoRaise;
opt->activeSubControls = QStyle::SC_ToolButton;
opt->text = text();
- opt->icon = m_properties["icon"].value<QIcon>();
+ opt->icon = m_properties[QStringLiteral("icon")].value<QIcon>();
- if (m_properties.value("menu").toBool()) {
+ if (m_properties.value(QStringLiteral("menu")).toBool()) {
opt->subControls |= QStyle::SC_ToolButtonMenu;
opt->features = QStyleOptionToolButton::HasMenu;
}
@@ -451,14 +451,14 @@ void QQuickStyleItem::initStyleOption()
QStyleOptionTab *opt = qstyleoption_cast<QStyleOptionTab*>(m_styleoption);
opt->text = text();
- if (m_properties.value("hasFrame").toBool())
+ if (m_properties.value(QStringLiteral("hasFrame")).toBool())
opt->features |= QStyleOptionTab::HasFrame;
- QString orientation = m_properties.value("orientation").toString();
- QString position = m_properties.value("tabpos").toString();
- QString selectedPosition = m_properties.value("selectedpos").toString();
+ QString orientation = m_properties.value(QStringLiteral("orientation")).toString();
+ QString position = m_properties.value(QStringLiteral("tabpos")).toString();
+ QString selectedPosition = m_properties.value(QStringLiteral("selectedpos")).toString();
- opt->shape = (orientation == "Bottom") ? QTabBar::RoundedSouth : QTabBar::RoundedNorth;
+ opt->shape = orientation == QLatin1String("Bottom") ? QTabBar::RoundedSouth : QTabBar::RoundedNorth;
if (position == QLatin1String("beginning"))
opt->position = QStyleOptionTab::Beginning;
else if (position == QLatin1String("end"))
@@ -500,8 +500,8 @@ void QQuickStyleItem::initStyleOption()
m_styleoption = new QStyleOptionTabWidgetFrame();
QStyleOptionTabWidgetFrame *opt = qstyleoption_cast<QStyleOptionTabWidgetFrame*>(m_styleoption);
- opt->selectedTabRect = m_properties["selectedTabRect"].toRect();
- opt->shape = m_properties["orientation"] == Qt::BottomEdge ? QTabBar::RoundedSouth : QTabBar::RoundedNorth;
+ opt->selectedTabRect = m_properties[QStringLiteral("selectedTabRect")].toRect();
+ opt->shape = m_properties[QStringLiteral("orientation")] == Qt::BottomEdge ? QTabBar::RoundedSouth : QTabBar::RoundedNorth;
if (minimum())
opt->selectedTabRect = QRect(value(), 0, minimum(), height());
opt->tabBarSize = QSize(minimum() , height());
@@ -525,7 +525,7 @@ void QQuickStyleItem::initStyleOption()
QStyleOptionMenuItem *opt = qstyleoption_cast<QStyleOptionMenuItem*>(m_styleoption);
opt->text = text();
opt->menuItemType = QStyleOptionMenuItem::Normal;
- setProperty("_q_showUnderlined", m_hints["showUnderlined"].toBool());
+ setProperty("_q_showUnderlined", m_hints[QStringLiteral("showUnderlined")].toBool());
if (const QFont *font = QGuiApplicationPrivate::platformTheme()->font(QPlatformTheme::MenuBarFont)) {
opt->font = *font;
@@ -550,9 +550,9 @@ void QQuickStyleItem::initStyleOption()
setProperty("_q_isComboBoxPopupItem", m_itemType == ComboBoxItem);
QQuickMenuItemType::MenuItemType type =
- static_cast<QQuickMenuItemType::MenuItemType>(m_properties["type"].toInt());
+ static_cast<QQuickMenuItemType::MenuItemType>(m_properties[QStringLiteral("type")].toInt());
if (type == QQuickMenuItemType::ScrollIndicator) {
- int scrollerDirection = m_properties["scrollerDirection"].toInt();
+ int scrollerDirection = m_properties[QStringLiteral("scrollerDirection")].toInt();
opt->menuItemType = QStyleOptionMenuItem::Scroller;
opt->state |= scrollerDirection == Qt::UpArrow ?
QStyle::State_UpArrow : QStyle::State_DownArrow;
@@ -566,21 +566,21 @@ void QQuickStyleItem::initStyleOption()
} else {
opt->menuItemType = QStyleOptionMenuItem::Normal;
- QString shortcut = m_properties["shortcut"].toString();
+ QString shortcut = m_properties[QStringLiteral("shortcut")].toString();
if (!shortcut.isEmpty()) {
opt->text += QLatin1Char('\t') + shortcut;
opt->tabWidth = qMax(opt->tabWidth, qRound(textWidth(shortcut)));
}
- if (m_properties["checkable"].toBool()) {
+ if (m_properties[QStringLiteral("checkable")].toBool()) {
opt->checked = on();
- QVariant exclusive = m_properties["exclusive"];
+ QVariant exclusive = m_properties[QStringLiteral("exclusive")];
opt->checkType = exclusive.toBool() ? QStyleOptionMenuItem::Exclusive :
QStyleOptionMenuItem::NonExclusive;
}
}
- if (m_properties["icon"].canConvert<QIcon>())
- opt->icon = m_properties["icon"].value<QIcon>();
+ if (m_properties[QStringLiteral("icon")].canConvert<QIcon>())
+ opt->icon = m_properties[QStringLiteral("icon")].value<QIcon>();
setProperty("_q_showUnderlined", m_hints["showUnderlined"].toBool());
if (const QFont *font = QGuiApplicationPrivate::platformTheme()->font(m_itemType == ComboBoxItem ? QPlatformTheme::ComboMenuItemFont : QPlatformTheme::MenuFont)) {
@@ -600,7 +600,7 @@ void QQuickStyleItem::initStyleOption()
QStyleOptionButton *opt = qstyleoption_cast<QStyleOptionButton*>(m_styleoption);
if (!on())
opt->state |= QStyle::State_Off;
- if (m_properties.value("partiallyChecked").toBool())
+ if (m_properties.value(QStringLiteral("partiallyChecked")).toBool())
opt->state |= QStyle::State_NoChange;
opt->text = text();
}
@@ -625,10 +625,11 @@ void QQuickStyleItem::initStyleOption()
if (font)
opt->fontMetrics = QFontMetrics(*font);
opt->currentText = text();
- opt->editable = m_properties["editable"].toBool();
+ opt->editable = m_properties[QStringLiteral("editable")].toBool();
#ifdef Q_OS_OSX
- if (m_properties["popup"].canConvert<QObject *>() && style() == "mac") {
- QObject *popup = m_properties["popup"].value<QObject *>();
+ if (m_properties[QStringLiteral("popup")].canConvert<QObject *>()
+ && style() == QLatin1String("mac")) {
+ QObject *popup = m_properties[QStringLiteral("popup")].value<QObject *>();
if (platformFont == QPlatformTheme::MiniFont) {
popup->setProperty("__xOffset", -2);
popup->setProperty("__yOffset", 5);
@@ -690,8 +691,8 @@ void QQuickStyleItem::initStyleOption()
opt->sliderValue = value();
opt->subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;
- opt->tickPosition = (activeControl() == "ticks" ?
- QSlider::TicksBelow : QSlider::NoTicks);
+ opt->tickPosition = activeControl() == QLatin1String("ticks") ?
+ QSlider::TicksBelow : QSlider::NoTicks;
if (opt->tickPosition != QSlider::NoTicks)
opt->subControls |= QStyle::SC_SliderTickmarks;
@@ -718,12 +719,12 @@ void QQuickStyleItem::initStyleOption()
opt->lineWidth = 1;
opt->subControls = QStyle::SC_GroupBoxLabel;
opt->features = 0;
- if (m_properties["sunken"].toBool()) { // Qt draws an ugly line here so I ignore it
+ if (m_properties[QStringLiteral("sunken")].toBool()) { // Qt draws an ugly line here so I ignore it
opt->subControls |= QStyle::SC_GroupBoxFrame;
} else {
opt->features |= QStyleOptionFrame::Flat;
}
- if (m_properties["checkable"].toBool())
+ if (m_properties[QStringLiteral("checkable")].toBool())
opt->subControls |= QStyle::SC_GroupBoxCheckBox;
}
@@ -805,9 +806,9 @@ void QQuickStyleItem::initStyleOption()
}
}
- if (sizeHint == "mini") {
+ if (sizeHint == QLatin1String("mini")) {
m_styleoption->state |= QStyle::State_Mini;
- } else if (sizeHint == "small") {
+ } else if (sizeHint == QLatin1String("small")) {
m_styleoption->state |= QStyle::State_Small;
}
@@ -888,7 +889,7 @@ QString QQuickStyleItem::style() const
style = style.toLower();
if (style.startsWith(QLatin1Char('q')))
style = style.right(style.length() - 1);
- if (style.endsWith("style"))
+ if (style.endsWith(QLatin1String("style")))
style = style.left(style.length() - 5);
return style;
}
@@ -902,10 +903,9 @@ QString QQuickStyleItem::hitTest(int px, int py)
qstyleoption_cast<QStyleOptionComplex*>(m_styleoption),
QPoint(px,py), 0);
if (subcontrol == QStyle::SC_SpinBoxUp)
- return "up";
+ return QStringLiteral("up");
else if (subcontrol == QStyle::SC_SpinBoxDown)
- return "down";
-
+ return QStringLiteral("down");
}
break;
@@ -914,32 +914,40 @@ QString QQuickStyleItem::hitTest(int px, int py)
qstyleoption_cast<QStyleOptionComplex*>(m_styleoption),
QPoint(px,py), 0);
if (subcontrol == QStyle::SC_SliderHandle)
- return "handle";
-
+ return QStringLiteral("handle");
}
break;
+
case ScrollBar: {
subcontrol = qApp->style()->hitTestComplexControl(QStyle::CC_ScrollBar,
qstyleoption_cast<QStyleOptionComplex*>(m_styleoption),
QPoint(px,py), 0);
- if (subcontrol == QStyle::SC_ScrollBarSlider)
- return "handle";
+ switch (subcontrol) {
+ case QStyle::SC_ScrollBarSlider:
+ return QStringLiteral("handle");
+
+ case QStyle::SC_ScrollBarSubLine:
+ return QStringLiteral("up");
+
+ case QStyle::SC_ScrollBarSubPage:
+ return QStringLiteral("upPage");
- if (subcontrol == QStyle::SC_ScrollBarSubLine)
- return "up";
- else if (subcontrol == QStyle::SC_ScrollBarSubPage)
- return "upPage";
+ case QStyle::SC_ScrollBarAddLine:
+ return QStringLiteral("down");
- if (subcontrol == QStyle::SC_ScrollBarAddLine)
- return "down";
- else if (subcontrol == QStyle::SC_ScrollBarAddPage)
- return "downPage";
+ case QStyle::SC_ScrollBarAddPage:
+ return QStringLiteral("downPage");
+
+ default:
+ break;
+ }
}
break;
+
default:
break;
}
- return "none";
+ return QStringLiteral("none");
}
QSize QQuickStyleItem::sizeFromContents(int width, int height)
@@ -955,7 +963,7 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
size = qApp->style()->sizeFromContents(QStyle::CT_CheckBox, m_styleoption, QSize(width,height));
break;
case ToolBar:
- size = QSize(200, style().contains("windows") ? 30 : 42);
+ size = QSize(200, style().contains(QLatin1String("windows")) ? 30 : 42);
break;
case ToolButton: {
QStyleOptionToolButton *btn = qstyleoption_cast<QStyleOptionToolButton*>(m_styleoption);
@@ -999,7 +1007,7 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
int newHeight = qMax(height, contentHeight);
size = qApp->style()->sizeFromContents(QStyle::CT_PushButton, m_styleoption, QSize(newWidth, newHeight)); }
#ifdef Q_OS_OSX
- if (style() == "mac") {
+ if (style() == QLatin1String("mac")) {
// Cancel out QMacStylePrivate::PushButton*Offset, or part of it
size -= QSize(7, 6);
}
@@ -1022,20 +1030,20 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
break;
case SpinBox:
#ifdef Q_OS_OSX
- if (style() == "mac") {
+ if (style() == QLatin1String("mac")) {
size = qApp->style()->sizeFromContents(QStyle::CT_SpinBox, m_styleoption, QSize(width, height + 5));
break;
}
#endif // fall through if not mac
case Edit:
#ifdef Q_OS_OSX
- if (style() =="mac") {
- QString sizeHint = m_hints.value("size").toString();
- if ((sizeHint == "small") || (sizeHint == "mini"))
+ if (style() == QLatin1String("mac")) {
+ QString sizeHint = m_hints.value(QStringLiteral("size")).toString();
+ if (sizeHint == QLatin1String("small") || sizeHint == QLatin1String("mini"))
size = QSize(width, 19);
else
size = QSize(width, 22);
- if (style() == "mac" && hints().value("rounded").toBool())
+ if (hints().value(QStringLiteral("rounded")).toBool())
size += QSize(4, 4);
} else
@@ -1069,7 +1077,7 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
case Header:
size = qApp->style()->sizeFromContents(QStyle::CT_HeaderSection, m_styleoption, QSize(width,height));
#ifdef Q_OS_OSX
- if (style() =="mac")
+ if (style() == QLatin1String("mac"))
size.setHeight(15);
#endif
break;
@@ -1120,7 +1128,7 @@ qreal QQuickStyleItem::baselineOffset()
case ComboBox:
if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(m_styleoption)) {
r = qApp->style()->subControlRect(QStyle::CC_ComboBox, combo, QStyle::SC_ComboBoxEditField);
- if (style() != QStringLiteral("mac"))
+ if (style() != QLatin1String("mac"))
r.adjust(0,0,0,1);
}
break;
@@ -1140,7 +1148,7 @@ qreal QQuickStyleItem::baselineOffset()
surplus++;
int result = r.top() + surplus/2 + fm.ascent();
#ifdef Q_OS_OSX
- if (style() == QStringLiteral("mac")) {
+ if (style() == QLatin1String("mac")) {
switch (m_itemType) {
case Button:
case Edit:
@@ -1200,47 +1208,47 @@ void QQuickStyleItem::updateRect()
int QQuickStyleItem::pixelMetric(const QString &metric)
{
- if (metric == "scrollbarExtent")
+ if (metric == QLatin1String("scrollbarExtent"))
return qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0 );
- else if (metric == "defaultframewidth")
+ else if (metric == QLatin1String("defaultframewidth"))
return qApp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption);
- else if (metric == "taboverlap")
+ else if (metric == QLatin1String("taboverlap"))
return qApp->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 );
- else if (metric == "tabbaseoverlap")
+ else if (metric == QLatin1String("tabbaseoverlap"))
return qApp->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, m_styleoption );
- else if (metric == "tabhspace")
+ else if (metric == QLatin1String("tabhspace"))
return qApp->style()->pixelMetric(QStyle::PM_TabBarTabHSpace, 0 );
- else if (metric == "indicatorwidth")
+ else if (metric == QLatin1String("indicatorwidth"))
return qApp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, 0 );
- else if (metric == "tabvspace")
+ else if (metric == QLatin1String("tabvspace"))
return qApp->style()->pixelMetric(QStyle::PM_TabBarTabVSpace, 0 );
- else if (metric == "tabbaseheight")
+ else if (metric == QLatin1String("tabbaseheight"))
return qApp->style()->pixelMetric(QStyle::PM_TabBarBaseHeight, 0 );
- else if (metric == "tabvshift")
+ else if (metric == QLatin1String("tabvshift"))
return qApp->style()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, 0 );
- else if (metric == "menubarhmargin")
+ else if (metric == QLatin1String("menubarhmargin"))
return qApp->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0 );
- else if (metric == "menubarvmargin")
+ else if (metric == QLatin1String("menubarvmargin"))
return qApp->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0 );
- else if (metric == "menubarpanelwidth")
+ else if (metric == QLatin1String("menubarpanelwidth"))
return qApp->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0 );
- else if (metric == "menubaritemspacing")
+ else if (metric == QLatin1String("menubaritemspacing"))
return qApp->style()->pixelMetric(QStyle::PM_MenuBarItemSpacing, 0 );
- else if (metric == "spacebelowmenubar")
+ else if (metric == QLatin1String("spacebelowmenubar"))
return qApp->style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, m_styleoption);
- else if (metric == "menuhmargin")
+ else if (metric == QLatin1String("menuhmargin"))
return qApp->style()->pixelMetric(QStyle::PM_MenuHMargin, 0 );
- else if (metric == "menuvmargin")
+ else if (metric == QLatin1String("menuvmargin"))
return qApp->style()->pixelMetric(QStyle::PM_MenuVMargin, 0 );
- else if (metric == "menupanelwidth")
+ else if (metric == QLatin1String("menupanelwidth"))
return qApp->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0 );
- else if (metric == "submenuoverlap")
+ else if (metric == QLatin1String("submenuoverlap"))
return qApp->style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0 );
- else if (metric == "splitterwidth")
+ else if (metric == QLatin1String("splitterwidth"))
return qApp->style()->pixelMetric(QStyle::PM_SplitterWidth, 0 );
- else if (metric == "scrollbarspacing")
+ else if (metric == QLatin1String("scrollbarspacing"))
return abs(qApp->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, 0 ));
- else if (metric == "treeviewindentation")
+ else if (metric == QLatin1String("treeviewindentation"))
return qApp->style()->pixelMetric(QStyle::PM_TreeViewIndentation, 0 );
return 0;
}
@@ -1248,30 +1256,30 @@ int QQuickStyleItem::pixelMetric(const QString &metric)
QVariant QQuickStyleItem::styleHint(const QString &metric)
{
initStyleOption();
- if (metric == "comboboxpopup") {
+ if (metric == QLatin1String("comboboxpopup")) {
return qApp->style()->styleHint(QStyle::SH_ComboBox_Popup, m_styleoption);
- } else if (metric == "highlightedTextColor") {
+ } else if (metric == QLatin1String("highlightedTextColor")) {
return m_styleoption->palette.highlightedText().color().name();
- } else if (metric == "textColor") {
+ } else if (metric == QLatin1String("textColor")) {
QPalette pal = m_styleoption->palette;
pal.setCurrentColorGroup(active()? QPalette::Active : QPalette::Inactive);
return pal.text().color().name();
- } else if (metric == "focuswidget") {
+ } else if (metric == QLatin1String("focuswidget")) {
return qApp->style()->styleHint(QStyle::SH_FocusFrame_AboveWidget);
- } else if (metric == "tabbaralignment") {
+ } else if (metric == QLatin1String("tabbaralignment")) {
int result = qApp->style()->styleHint(QStyle::SH_TabBar_Alignment);
if (result == Qt::AlignCenter)
- return "center";
- return "left";
- } else if (metric == "externalScrollBars") {
+ return QStringLiteral("center");
+ return QStringLiteral("left");
+ } else if (metric == QLatin1String("externalScrollBars")) {
return qApp->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents);
- } else if (metric == "scrollToClickPosition")
+ } else if (metric == QLatin1String("scrollToClickPosition"))
return qApp->style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition);
- else if (metric == "activateItemOnSingleClick")
+ else if (metric == QLatin1String("activateItemOnSingleClick"))
return qApp->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick);
- else if (metric == "submenupopupdelay")
+ else if (metric == QLatin1String("submenupopupdelay"))
return qApp->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, m_styleoption);
- else if (metric == "wheelScrollLines")
+ else if (metric == QLatin1String("wheelScrollLines"))
return qApp->wheelScrollLines();
return 0;
@@ -1316,76 +1324,76 @@ void QQuickStyleItem::setElementType(const QString &str)
}
// Only enable visible if the widget can animate
- if (str == "menu") {
+ if (str == QLatin1String("menu")) {
m_itemType = Menu;
- } else if (str == "menuitem") {
+ } else if (str == QLatin1String("menuitem")) {
m_itemType = MenuItem;
- } else if (str == "item" || str == "itemrow" || str == "header") {
+ } else if (str == QLatin1String("item") || str == QLatin1String("itemrow") || str == QLatin1String("header")) {
#ifdef Q_OS_OSX
m_font.setPointSize(11.0);
emit fontChanged();
#endif
- if (str == "header") {
+ if (str == QLatin1String("header")) {
m_itemType = Header;
} else {
- m_itemType = (str == "item") ? Item : ItemRow;
+ m_itemType = str == QLatin1String("item") ? Item : ItemRow;
}
- } else if (str == "itembranchindicator") {
+ } else if (str == QLatin1String("itembranchindicator")) {
m_itemType = ItemBranchIndicator;
- } else if (str == "groupbox") {
+ } else if (str == QLatin1String("groupbox")) {
m_itemType = GroupBox;
- } else if (str == "tab") {
+ } else if (str == QLatin1String("tab")) {
m_itemType = Tab;
- } else if (str == "tabframe") {
+ } else if (str == QLatin1String("tabframe")) {
m_itemType = TabFrame;
- } else if (str == "comboboxitem") {
+ } else if (str == QLatin1String("comboboxitem")) {
// Gtk uses qobject cast, hence we need to separate this from menuitem
// On mac, we temporarily use the menu item because it has more accurate
// palette.
m_itemType = ComboBoxItem;
- } else if (str == "toolbar") {
+ } else if (str == QLatin1String("toolbar")) {
m_itemType = ToolBar;
- } else if (str == "toolbutton") {
+ } else if (str == QLatin1String("toolbutton")) {
m_itemType = ToolButton;
- } else if (str == "slider") {
+ } else if (str == QLatin1String("slider")) {
m_itemType = Slider;
- } else if (str == "frame") {
+ } else if (str == QLatin1String("frame")) {
m_itemType = Frame;
- } else if (str == "combobox") {
+ } else if (str == QLatin1String("combobox")) {
m_itemType = ComboBox;
- } else if (str == "splitter") {
+ } else if (str == QLatin1String("splitter")) {
m_itemType = Splitter;
- } else if (str == "progressbar") {
+ } else if (str == QLatin1String("progressbar")) {
m_itemType = ProgressBar;
- } else if (str == "button") {
+ } else if (str == QLatin1String("button")) {
m_itemType = Button;
- } else if (str == "checkbox") {
+ } else if (str == QLatin1String("checkbox")) {
m_itemType = CheckBox;
- } else if (str == "radiobutton") {
+ } else if (str == QLatin1String("radiobutton")) {
m_itemType = RadioButton;
- } else if (str == "edit") {
+ } else if (str == QLatin1String("edit")) {
m_itemType = Edit;
- } else if (str == "spinbox") {
+ } else if (str == QLatin1String("spinbox")) {
m_itemType = SpinBox;
- } else if (str == "scrollbar") {
+ } else if (str == QLatin1String("scrollbar")) {
m_itemType = ScrollBar;
- } else if (str == "widget") {
+ } else if (str == QLatin1String("widget")) {
m_itemType = Widget;
- } else if (str == "focusframe") {
+ } else if (str == QLatin1String("focusframe")) {
m_itemType = FocusFrame;
- } else if (str == "focusrect") {
+ } else if (str == QLatin1String("focusrect")) {
m_itemType = FocusRect;
- } else if (str == "dial") {
+ } else if (str == QLatin1String("dial")) {
m_itemType = Dial;
- } else if (str == "statusbar") {
+ } else if (str == QLatin1String("statusbar")) {
m_itemType = StatusBar;
- } else if (str == "machelpbutton") {
+ } else if (str == QLatin1String("machelpbutton")) {
m_itemType = MacHelpButton;
- } else if (str == "scrollareacorner") {
+ } else if (str == QLatin1String("scrollareacorner")) {
m_itemType = ScrollAreaCorner;
- } else if (str == "menubar") {
+ } else if (str == QLatin1String("menubar")) {
m_itemType = MenuBar;
- } else if (str == "menubaritem") {
+ } else if (str == QLatin1String("menubaritem")) {
m_itemType = MenuBarItem;
} else {
m_itemType = Undefined;
@@ -1500,7 +1508,7 @@ void QQuickStyleItem::paint(QPainter *painter)
switch (m_itemType) {
case Button:
#ifdef Q_OS_OSX
- if (style() == "mac") {
+ if (style() == QLatin1String("mac")) {
// Add back what was substracted in sizeFromContents()
m_styleoption->rect.adjust(-4, -2, 3, 4);
}
@@ -1517,7 +1525,7 @@ void QQuickStyleItem::paint(QPainter *painter)
pixmap.fill(Qt::transparent);
QPainter pixpainter(&pixmap);
qApp->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, m_styleoption, &pixpainter);
- if ((style() == "mac" || !qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected)) && selected()) {
+ if ((style() == QLatin1String("mac") || !qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected)) && selected()) {
QPalette pal = QApplication::palette("QAbstractItemView");
pal.setCurrentColorGroup(m_styleoption->palette.currentColorGroup());
pixpainter.fillRect(m_styleoption->rect, pal.highlight());
@@ -1539,7 +1547,7 @@ void QQuickStyleItem::paint(QPainter *painter)
case ToolButton:
#ifdef Q_OS_OSX
- if (style() == "mac" && hints().value("segmented").toBool()) {
+ if (style() == QLatin1String("mac") && hints().value(QStringLiteral("segmented")).toBool()) {
const QPaintDevice *target = painter->device();
HIThemeSegmentDrawInfo sgi;
sgi.version = 0;
@@ -1555,10 +1563,10 @@ void QQuickStyleItem::paint(QPainter *painter)
}
SInt32 button_height;
GetThemeMetric(kThemeMetricButtonRoundedHeight, &button_height);
- QString buttonPos = m_properties.value("position").toString();
- sgi.position = buttonPos == "leftmost" ? kHIThemeSegmentPositionFirst :
- buttonPos == "rightmost" ? kHIThemeSegmentPositionLast :
- buttonPos == "h_middle" ? kHIThemeSegmentPositionMiddle :
+ QString buttonPos = m_properties.value(QStringLiteral("position")).toString();
+ sgi.position = buttonPos == QLatin1String("leftmost") ? kHIThemeSegmentPositionFirst :
+ buttonPos == QLatin1String("rightmost") ? kHIThemeSegmentPositionLast :
+ buttonPos == QLatin1String("h_middle") ? kHIThemeSegmentPositionMiddle :
kHIThemeSegmentPositionOnly;
QRect centered = m_styleoption->rect;
centered.setHeight(button_height);
@@ -1571,7 +1579,7 @@ void QQuickStyleItem::paint(QPainter *painter)
break;
case Tab:
#ifdef Q_OS_OSX
- if (style() == "mac") {
+ if (style() == QLatin1String("mac")) {
m_styleoption->rect.translate(0, 1); // Unhack QMacStyle's hack
qApp->style()->drawControl(QStyle::CE_TabBarTabShape, m_styleoption, painter);
m_styleoption->rect.translate(0, -1);
@@ -1616,7 +1624,7 @@ void QQuickStyleItem::paint(QPainter *painter)
break;
case Edit: {
#ifdef Q_OS_OSX
- if (style() == "mac" && hints().value("rounded").toBool()) {
+ if (style() == QLatin1String("mac") && hints().value(QStringLiteral("rounded")).toBool()) {
const QPaintDevice *target = painter->device();
HIThemeFrameDrawInfo fdi;
fdi.version = 0;
@@ -1674,7 +1682,7 @@ void QQuickStyleItem::paint(QPainter *painter)
case SpinBox:
#ifdef Q_OS_MAC
// macstyle depends on the embedded qlineedit to fill the editfield background
- if (style() == "mac") {
+ if (style() == QLatin1String("mac")) {
QRect editRect = qApp->style()->subControlRect(QStyle::CC_SpinBox,
qstyleoption_cast<QStyleOptionComplex*>(m_styleoption),
QStyle::SC_SpinBoxEditField);
@@ -1702,14 +1710,14 @@ void QQuickStyleItem::paint(QPainter *painter)
painter->fillRect(m_styleoption->rect, m_styleoption->palette.window().color());
qApp->style()->drawControl(QStyle::CE_ToolBar, m_styleoption, painter);
painter->save();
- painter->setPen(style() != "fusion" ? m_styleoption->palette.dark().color().darker(120) :
+ painter->setPen(style() != QLatin1String("fusion") ? m_styleoption->palette.dark().color().darker(120) :
m_styleoption->palette.window().color().lighter(107));
painter->drawLine(m_styleoption->rect.bottomLeft(), m_styleoption->rect.bottomRight());
painter->restore();
break;
case StatusBar:
#ifdef Q_OS_OSX
- if (style() == "mac") {
+ if (style() == QLatin1String("mac")) {
qApp->style()->drawControl(QStyle::CE_ToolBar, m_styleoption, painter);
painter->setPen(m_styleoption->palette.dark().color().darker(120));
painter->drawLine(m_styleoption->rect.topLeft(), m_styleoption->rect.topRight());
@@ -1876,20 +1884,20 @@ QPixmap QQuickTableRowImageProvider::requestPixmap(const QString &id, QSize *siz
QString style = qApp->style()->metaObject()->className();
opt.features = 0;
- if (id.contains("selected"))
+ if (id.contains(QLatin1String("selected")))
opt.state |= QStyle::State_Selected;
- if (id.contains("active")) {
+ if (id.contains(QLatin1String("active"))) {
opt.state |= QStyle::State_Active;
opt.palette.setCurrentColorGroup(QPalette::Active);
} else
opt.palette.setCurrentColorGroup(QPalette::Inactive);
- if (id.contains("alternate"))
+ if (id.contains(QLatin1String("alternate")))
opt.features |= QStyleOptionViewItem::Alternate;
QPalette pal = QApplication::palette("QAbstractItemView");
- if (opt.state & QStyle::State_Selected && (style.contains("Mac") ||
+ if (opt.state & QStyle::State_Selected && (style.contains(QLatin1String("Mac")) ||
!qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected))) {
pal.setCurrentColorGroup(opt.palette.currentColorGroup());
pixmap.fill(pal.highlight().color());
diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml
index a6eaed82..d2e61c81 100644
--- a/src/controls/ScrollView.qml
+++ b/src/controls/ScrollView.qml
@@ -286,7 +286,7 @@ FocusScope {
// comes originally from QTextEdit, which sets 20px steps by default, as well as
// QQuickWheelArea.
// TODO: centralize somewhere, QPlatformTheme?
- scrollSpeed: 20 * (__style.__wheelScrollLines || 1)
+ scrollSpeed: 20 * (__style && __style.__wheelScrollLines || 1)
Connections {
target: flickableItem
diff --git a/src/controls/Styles/Base/images/spinner_large.png b/src/controls/Styles/Base/images/spinner_large.png
index bcf51339..8e6a7738 100644
--- a/src/controls/Styles/Base/images/spinner_large.png
+++ b/src/controls/Styles/Base/images/spinner_large.png
Binary files differ
diff --git a/src/controls/Styles/Base/images/spinner_medium.png b/src/controls/Styles/Base/images/spinner_medium.png
index da8141bf..48a24d58 100644
--- a/src/controls/Styles/Base/images/spinner_medium.png
+++ b/src/controls/Styles/Base/images/spinner_medium.png
Binary files differ
diff --git a/src/controls/Styles/Base/images/spinner_small.png b/src/controls/Styles/Base/images/spinner_small.png
index 1f158f56..c3e86dc6 100644
--- a/src/controls/Styles/Base/images/spinner_small.png
+++ b/src/controls/Styles/Base/images/spinner_small.png
Binary files differ
diff --git a/src/controls/doc/src/qtquickcontrols-tableview.qdoc b/src/controls/doc/src/qtquickcontrols-tableview.qdoc
index a9c6d22a..fa3b103c 100644
--- a/src/controls/doc/src/qtquickcontrols-tableview.qdoc
+++ b/src/controls/doc/src/qtquickcontrols-tableview.qdoc
@@ -224,7 +224,7 @@
\li function \b clear() - deselects all rows
\li function \b selectAll() - selects all rows
\li function \b select(from, to) - select a range
- \li functton \b deselect(from, to) - de-selects a range
+ \li function \b deselect(from, to) - de-selects a range
\li function \b forEach(callback) - iterates over all selected rows
\li function \b contains(index) - checks whether the selection includes the given index
\li signal \b selectionChanged() - the current row selection changed
diff --git a/src/controls/doc/src/qtquickcontrols-treeview.qdoc b/src/controls/doc/src/qtquickcontrols-treeview.qdoc
index 8188e955..321f1934 100644
--- a/src/controls/doc/src/qtquickcontrols-treeview.qdoc
+++ b/src/controls/doc/src/qtquickcontrols-treeview.qdoc
@@ -215,13 +215,13 @@
/*!
\qmlsignal TreeView::doubleClicked(QModelIndex index)
- Emitted when the user presses and holds a valid row in the tree.
+ Emitted when the user double clicks a valid row.
\a index is the model index of the double clicked row in the tree.
\note This signal is only emitted if the row or item delegate does not accept mouse events.
- The corresponding handler is \c onPressAndHold.
+ The corresponding handler is \c onDoubleClicked.
*/
/*!
diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp
index b4a4963d..da670dc8 100644
--- a/src/controls/plugin.cpp
+++ b/src/controls/plugin.cpp
@@ -123,7 +123,7 @@ void QtQuickControlsPlugin::registerTypes(const char *uri)
initResources();
qmlRegisterType<QQuickAction>(uri, 1, 0, "Action");
qmlRegisterType<QQuickExclusiveGroup1>(uri, 1, 0, "ExclusiveGroup");
- qmlRegisterType<QQuickMenuItem>(uri, 1, 0, "MenuItem");
+ qmlRegisterType<QQuickMenuItem1>(uri, 1, 0, "MenuItem");
qmlRegisterUncreatableType<QQuickMenuItemType>(uri, 1, 0, "MenuItemType",
QLatin1String("Do not create objects of type MenuItemType"));
qmlRegisterType<QQuickMenuSeparator>(uri, 1, 0, "MenuSeparator");
@@ -161,8 +161,8 @@ void QtQuickControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri
qmlRegisterType<QQuickTreeModelAdaptor>(private_uri, 1, 0, "TreeModelAdaptor");
qmlRegisterType<QQuickScenePosListener>(private_uri, 1, 0, "ScenePosListener");
- qmlRegisterType<QQuickMenu>(private_uri, 1, 0, "MenuPrivate");
- qmlRegisterType<QQuickMenuBar>(private_uri, 1, 0, "MenuBarPrivate");
+ qmlRegisterType<QQuickMenu1>(private_uri, 1, 0, "MenuPrivate");
+ qmlRegisterType<QQuickMenuBar1>(private_uri, 1, 0, "MenuBarPrivate");
qmlRegisterType<QQuickPopupWindow>(private_uri, 1, 0, "PopupWindow");
qmlRegisterUncreatableType<QAbstractItemModel>(private_uri, 1, 0, "AbstractItemModel",
diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp
index 60430d55..d0f5524f 100644
--- a/src/controls/qquickmenu.cpp
+++ b/src/controls/qquickmenu.cpp
@@ -51,13 +51,13 @@
QT_BEGIN_NAMESPACE
/*!
- \class QQuickMenu
+ \class QQuickMenu1
\internal
*/
/*!
\qmltype MenuPrivate
- \instantiates QQuickMenu
+ \instantiates QQuickMenu1
\internal
\inqmlmodule QtQuick.Controls
*/
@@ -254,7 +254,7 @@ QT_BEGIN_NAMESPACE
\sa aboutToShow()
*/
-QQuickMenu::QQuickMenu(QObject *parent)
+QQuickMenu1::QQuickMenu1(QObject *parent)
: QQuickMenuText(parent, QQuickMenuItemType::Menu),
m_itemsCount(0),
m_selectedIndex(-1),
@@ -282,7 +282,7 @@ QQuickMenu::QQuickMenu(QObject *parent)
m_font = *const_cast<QFont*>(font);
}
-QQuickMenu::~QQuickMenu()
+QQuickMenu1::~QQuickMenu1()
{
while (!m_menuItems.empty()) {
QQuickMenuBase *item = m_menuItems.takeFirst();
@@ -297,14 +297,14 @@ QQuickMenu::~QQuickMenu()
m_platformMenu = 0;
}
-void QQuickMenu::syncParentMenuBar()
+void QQuickMenu1::syncParentMenuBar()
{
- QQuickMenuBar *menubar = qobject_cast<QQuickMenuBar *>(parent());
+ QQuickMenuBar1 *menubar = qobject_cast<QQuickMenuBar1 *>(parent());
if (menubar && menubar->platformMenuBar())
menubar->platformMenuBar()->syncMenu(m_platformMenu);
}
-void QQuickMenu::setVisible(bool v)
+void QQuickMenu1::setVisible(bool v)
{
QQuickMenuBase::setVisible(v);
if (m_platformMenu) {
@@ -313,7 +313,7 @@ void QQuickMenu::setVisible(bool v)
}
}
-void QQuickMenu::setEnabled(bool e)
+void QQuickMenu1::setEnabled(bool e)
{
QQuickMenuText::setEnabled(e);
if (m_platformMenu) {
@@ -322,14 +322,14 @@ void QQuickMenu::setEnabled(bool e)
}
}
-void QQuickMenu::updateText()
+void QQuickMenu1::updateText()
{
if (m_platformMenu)
m_platformMenu->setText(this->text());
QQuickMenuText::updateText();
}
-void QQuickMenu::setMinimumWidth(int w)
+void QQuickMenu1::setMinimumWidth(int w)
{
if (w == m_minimumWidth)
return;
@@ -341,7 +341,7 @@ void QQuickMenu::setMinimumWidth(int w)
emit minimumWidthChanged();
}
-void QQuickMenu::setFont(const QFont &arg)
+void QQuickMenu1::setFont(const QFont &arg)
{
if (arg == m_font)
return;
@@ -351,17 +351,17 @@ void QQuickMenu::setFont(const QFont &arg)
m_platformMenu->setFont(arg);
}
-void QQuickMenu::setXOffset(qreal x)
+void QQuickMenu1::setXOffset(qreal x)
{
m_xOffset = x;
}
-void QQuickMenu::setYOffset(qreal y)
+void QQuickMenu1::setYOffset(qreal y)
{
m_yOffset = y;
}
-void QQuickMenu::setSelectedIndex(int index)
+void QQuickMenu1::setSelectedIndex(int index)
{
if (m_selectedIndex == index)
return;
@@ -370,21 +370,21 @@ void QQuickMenu::setSelectedIndex(int index)
emit __selectedIndexChanged();
}
-void QQuickMenu::updateSelectedIndex()
+void QQuickMenu1::updateSelectedIndex()
{
- if (QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem*>(sender())) {
+ if (QQuickMenuItem1 *menuItem = qobject_cast<QQuickMenuItem1*>(sender())) {
int index = indexOfMenuItem(menuItem);
setSelectedIndex(index);
}
}
-QQuickMenuItems QQuickMenu::menuItems()
+QQuickMenuItems QQuickMenu1::menuItems()
{
- return QQuickMenuItems(this, 0, &QQuickMenu::append_menuItems, &QQuickMenu::count_menuItems,
- &QQuickMenu::at_menuItems, &QQuickMenu::clear_menuItems);
+ return QQuickMenuItems(this, 0, &QQuickMenu1::append_menuItems, &QQuickMenu1::count_menuItems,
+ &QQuickMenu1::at_menuItems, &QQuickMenu1::clear_menuItems);
}
-QQuickWindow *QQuickMenu::findParentWindow()
+QQuickWindow *QQuickMenu1::findParentWindow()
{
if (!m_parentWindow) {
QQuickItem *parentAsItem = qobject_cast<QQuickItem *>(parent());
@@ -394,7 +394,7 @@ QQuickWindow *QQuickMenu::findParentWindow()
return m_parentWindow;
}
-void QQuickMenu::popup()
+void QQuickMenu1::popup()
{
QQuickWindow *quickWindow = findParentWindow();
QPoint renderOffset;
@@ -414,7 +414,7 @@ void QQuickMenu::popup()
__popup(QRectF(mousePos.x() - renderOffset.x(), mousePos.y() - renderOffset.y(), 0, 0));
}
-void QQuickMenu::__popup(const QRectF &targetRect, int atItemIndex, MenuType menuType)
+void QQuickMenu1::__popup(const QRectF &targetRect, int atItemIndex, MenuType menuType)
{
if (popupVisible()) {
hideMenu();
@@ -466,7 +466,7 @@ void QQuickMenu::__popup(const QRectF &targetRect, int atItemIndex, MenuType men
}
}
-void QQuickMenu::setMenuContentItem(QQuickItem *item)
+void QQuickMenu1::setMenuContentItem(QQuickItem *item)
{
if (m_menuContentItem != item) {
m_menuContentItem = item;
@@ -474,7 +474,7 @@ void QQuickMenu::setMenuContentItem(QQuickItem *item)
}
}
-void QQuickMenu::setPopupVisible(bool v)
+void QQuickMenu1::setPopupVisible(bool v)
{
if (m_popupVisible != v) {
m_popupVisible = v;
@@ -482,7 +482,7 @@ void QQuickMenu::setPopupVisible(bool v)
}
}
-QRect QQuickMenu::popupGeometry() const
+QRect QQuickMenu1::popupGeometry() const
{
if (!m_popupWindow || !m_popupVisible)
return QRect();
@@ -490,13 +490,13 @@ QRect QQuickMenu::popupGeometry() const
return m_popupWindow->geometry();
}
-void QQuickMenu::prepareItemTrigger(QQuickMenuItem *)
+void QQuickMenu1::prepareItemTrigger(QQuickMenuItem1 *)
{
m_triggerCount++;
__dismissMenu();
}
-void QQuickMenu::concludeItemTrigger(QQuickMenuItem *)
+void QQuickMenu1::concludeItemTrigger(QQuickMenuItem1 *)
{
if (--m_triggerCount == 0)
destroyAllMenuPopups();
@@ -506,7 +506,7 @@ void QQuickMenu::concludeItemTrigger(QQuickMenuItem *)
* \internal
* Close this menu's popup window. Emits aboutToHide and sets __popupVisible to false.
*/
-void QQuickMenu::hideMenu()
+void QQuickMenu1::hideMenu()
{
if (m_popupVisible) {
emit aboutToHide();
@@ -517,7 +517,7 @@ void QQuickMenu::hideMenu()
m_parentWindow = 0;
}
-QQuickMenuPopupWindow *QQuickMenu::topMenuPopup() const
+QQuickMenuPopupWindow *QQuickMenu1::topMenuPopup() const
{
QQuickMenuPopupWindow *topMenuWindow = m_popupWindow;
while (topMenuWindow) {
@@ -536,7 +536,7 @@ QQuickMenuPopupWindow *QQuickMenu::topMenuPopup() const
* In QQuickPopupWindow, before closing, dismissPopup() emits popupDismissed()
* which is connected to dismissPopup() on any child popup.
*/
-void QQuickMenu::__dismissMenu()
+void QQuickMenu1::__dismissMenu()
{
if (m_platformMenu) {
m_platformMenu->dismiss();
@@ -549,7 +549,7 @@ void QQuickMenu::__dismissMenu()
* \internal
* Called when the popup window visible property changes.
*/
-void QQuickMenu::windowVisibleChanged(bool v)
+void QQuickMenu1::windowVisibleChanged(bool v)
{
if (!v) {
if (m_popupWindow) {
@@ -564,13 +564,13 @@ void QQuickMenu::windowVisibleChanged(bool v)
}
}
-void QQuickMenu::clearPopupWindow()
+void QQuickMenu1::clearPopupWindow()
{
m_popupWindow = 0;
emit __menuPopupDestroyed();
}
-void QQuickMenu::destroyMenuPopup()
+void QQuickMenu1::destroyMenuPopup()
{
if (m_triggerCount > 0)
return;
@@ -578,7 +578,7 @@ void QQuickMenu::destroyMenuPopup()
m_popupWindow->setToBeDeletedLater();
}
-void QQuickMenu::destroyAllMenuPopups() {
+void QQuickMenu1::destroyAllMenuPopups() {
if (m_triggerCount > 0)
return;
QQuickMenuPopupWindow *popup = topMenuPopup();
@@ -586,13 +586,27 @@ void QQuickMenu::destroyAllMenuPopups() {
popup->setToBeDeletedLater();
}
-void QQuickMenu::__closeAndDestroy()
+QQuickMenuBar1 *QQuickMenu1::menuBar()
+{
+ QObject *pi = parentMenuOrMenuBar();
+ while (pi) {
+ if (QQuickMenuBar1 *menuBar = qobject_cast<QQuickMenuBar1*>(pi))
+ return menuBar;
+ else if (QQuickMenu1 *menu = qobject_cast<QQuickMenu1*>(pi))
+ pi = menu->parentMenuOrMenuBar();
+ else
+ return 0;
+ }
+ return 0;
+}
+
+void QQuickMenu1::__closeAndDestroy()
{
hideMenu();
destroyMenuPopup();
}
-void QQuickMenu::__dismissAndDestroy()
+void QQuickMenu1::__dismissAndDestroy()
{
if (m_platformMenu)
return;
@@ -601,7 +615,7 @@ void QQuickMenu::__dismissAndDestroy()
destroyAllMenuPopups();
}
-void QQuickMenu::itemIndexToListIndex(int itemIndex, int *listIndex, int *containerIndex) const
+void QQuickMenu1::itemIndexToListIndex(int itemIndex, int *listIndex, int *containerIndex) const
{
*listIndex = -1;
QQuickMenuItemContainer *container = 0;
@@ -617,7 +631,7 @@ void QQuickMenu::itemIndexToListIndex(int itemIndex, int *listIndex, int *contai
*containerIndex = -1;
}
-int QQuickMenu::itemIndexForListIndex(int listIndex) const
+int QQuickMenu1::itemIndexForListIndex(int listIndex) const
{
int index = 0;
int i = 0;
@@ -630,7 +644,7 @@ int QQuickMenu::itemIndexForListIndex(int listIndex) const
return index;
}
-QQuickMenuBase *QQuickMenu::nextMenuItem(QQuickMenu::MenuItemIterator *it) const
+QQuickMenuBase *QQuickMenu1::nextMenuItem(QQuickMenu1::MenuItemIterator *it) const
{
if (it->containerIndex != -1) {
QQuickMenuItemContainer *container = qobject_cast<QQuickMenuItemContainer *>(m_menuItems[it->index]);
@@ -651,7 +665,7 @@ QQuickMenuBase *QQuickMenu::nextMenuItem(QQuickMenu::MenuItemIterator *it) const
return 0;
}
-QQuickMenuBase *QQuickMenu::menuItemAtIndex(int index) const
+QQuickMenuBase *QQuickMenu1::menuItemAtIndex(int index) const
{
if (0 <= index && index < m_itemsCount) {
if (!m_containersCount) {
@@ -675,7 +689,7 @@ QQuickMenuBase *QQuickMenu::menuItemAtIndex(int index) const
return 0;
}
-bool QQuickMenu::contains(QQuickMenuBase *item)
+bool QQuickMenu1::contains(QQuickMenuBase *item)
{
if (item->container())
return item->container()->items().contains(item);
@@ -683,7 +697,7 @@ bool QQuickMenu::contains(QQuickMenuBase *item)
return m_menuItems.contains(item);
}
-int QQuickMenu::indexOfMenuItem(QQuickMenuBase *item) const
+int QQuickMenu1::indexOfMenuItem(QQuickMenuBase *item) const
{
if (!item)
return -1;
@@ -699,31 +713,31 @@ int QQuickMenu::indexOfMenuItem(QQuickMenuBase *item) const
}
}
-QQuickMenuItem *QQuickMenu::addItem(const QString &title)
+QQuickMenuItem1 *QQuickMenu1::addItem(const QString &title)
{
return insertItem(m_itemsCount, title);
}
-QQuickMenuItem *QQuickMenu::insertItem(int index, const QString &title)
+QQuickMenuItem1 *QQuickMenu1::insertItem(int index, const QString &title)
{
- QQuickMenuItem *item = new QQuickMenuItem(this);
+ QQuickMenuItem1 *item = new QQuickMenuItem1(this);
item->setText(title);
insertItem(index, item);
return item;
}
-void QQuickMenu::addSeparator()
+void QQuickMenu1::addSeparator()
{
insertSeparator(m_itemsCount);
}
-void QQuickMenu::insertSeparator(int index)
+void QQuickMenu1::insertSeparator(int index)
{
QQuickMenuSeparator *item = new QQuickMenuSeparator(this);
insertItem(index, item);
}
-void QQuickMenu::insertItem(int index, QQuickMenuBase *menuItem)
+void QQuickMenu1::insertItem(int index, QQuickMenuBase *menuItem)
{
if (!menuItem)
return;
@@ -746,7 +760,7 @@ void QQuickMenu::insertItem(int index, QQuickMenuBase *menuItem)
emit itemsChanged();
}
-void QQuickMenu::removeItem(QQuickMenuBase *menuItem)
+void QQuickMenu1::removeItem(QQuickMenuBase *menuItem)
{
if (!menuItem)
return;
@@ -762,7 +776,7 @@ void QQuickMenu::removeItem(QQuickMenuBase *menuItem)
emit itemsChanged();
}
-void QQuickMenu::clear()
+void QQuickMenu1::clear()
{
m_containers.clear();
m_containersCount = 0;
@@ -777,7 +791,7 @@ void QQuickMenu::clear()
m_itemsCount = 0;
}
-void QQuickMenu::setupMenuItem(QQuickMenuBase *item, int platformIndex)
+void QQuickMenu1::setupMenuItem(QQuickMenuBase *item, int platformIndex)
{
item->setParentMenu(this);
if (m_platformMenu) {
@@ -789,9 +803,9 @@ void QQuickMenu::setupMenuItem(QQuickMenuBase *item, int platformIndex)
++m_itemsCount;
}
-void QQuickMenu::append_menuItems(QQuickMenuItems *list, QObject *o)
+void QQuickMenu1::append_menuItems(QQuickMenuItems *list, QObject *o)
{
- if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(list->object)) {
+ if (QQuickMenu1 *menu = qobject_cast<QQuickMenu1 *>(list->object)) {
if (QQuickMenuBase *menuItem = qobject_cast<QQuickMenuBase *>(o)) {
menu->m_menuItems.append(menuItem);
menu->setupMenuItem(menuItem);
@@ -812,25 +826,25 @@ void QQuickMenu::append_menuItems(QQuickMenuItems *list, QObject *o)
}
}
-int QQuickMenu::count_menuItems(QQuickMenuItems *list)
+int QQuickMenu1::count_menuItems(QQuickMenuItems *list)
{
- if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(list->object))
+ if (QQuickMenu1 *menu = qobject_cast<QQuickMenu1 *>(list->object))
return menu->m_itemsCount;
return 0;
}
-QObject *QQuickMenu::at_menuItems(QQuickMenuItems *list, int index)
+QObject *QQuickMenu1::at_menuItems(QQuickMenuItems *list, int index)
{
- if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(list->object))
+ if (QQuickMenu1 *menu = qobject_cast<QQuickMenu1 *>(list->object))
return menu->menuItemAtIndex(index);
return 0;
}
-void QQuickMenu::clear_menuItems(QQuickMenuItems *list)
+void QQuickMenu1::clear_menuItems(QQuickMenuItems *list)
{
- if (QQuickMenu *menu = qobject_cast<QQuickMenu *>(list->object))
+ if (QQuickMenu1 *menu = qobject_cast<QQuickMenu1 *>(list->object))
menu->clear();
}
diff --git a/src/controls/qquickmenu_p.h b/src/controls/qquickmenu_p.h
index f49f6d62..576ae5fd 100644
--- a/src/controls/qquickmenu_p.h
+++ b/src/controls/qquickmenu_p.h
@@ -51,10 +51,11 @@ class QPlatformMenu;
class QQuickMenuPopupWindow;
class QQuickMenuItemContainer;
class QQuickWindow;
+class QQuickMenuBar1;
typedef QQmlListProperty<QObject> QQuickMenuItems;
-class QQuickMenu : public QQuickMenuText
+class QQuickMenu1 : public QQuickMenuText
{
Q_OBJECT
Q_PROPERTY(QString title READ text WRITE setText NOTIFY titleChanged)
@@ -78,8 +79,8 @@ public:
enum MenuType { DefaultMenu = 0, EditMenu };
Q_INVOKABLE void popup();
- Q_INVOKABLE QQuickMenuItem *addItem(const QString &);
- Q_INVOKABLE QQuickMenuItem *insertItem(int, const QString &);
+ Q_INVOKABLE QQuickMenuItem1 *addItem(const QString &);
+ Q_INVOKABLE QQuickMenuItem1 *insertItem(int, const QString &);
Q_INVOKABLE void addSeparator();
Q_INVOKABLE void insertSeparator(int);
@@ -110,8 +111,8 @@ Q_SIGNALS:
void __proxyChanged();
public:
- QQuickMenu(QObject *parent = 0);
- virtual ~QQuickMenu();
+ QQuickMenu1(QObject *parent = 0);
+ virtual ~QQuickMenu1();
void setVisible(bool);
void setEnabled(bool);
@@ -147,11 +148,13 @@ public:
bool isProxy() const { return m_proxy; }
void setProxy(bool proxy) { if (m_proxy != proxy) { m_proxy = proxy; emit __proxyChanged(); } }
- void prepareItemTrigger(QQuickMenuItem *);
- void concludeItemTrigger(QQuickMenuItem *);
+ void prepareItemTrigger(QQuickMenuItem1 *);
+ void concludeItemTrigger(QQuickMenuItem1 *);
void destroyMenuPopup();
void destroyAllMenuPopups();
+ QQuickMenuBar1 *menuBar();
+
protected Q_SLOTS:
void updateSelectedIndex();
@@ -206,6 +209,6 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QQuickMenu)
+QML_DECLARE_TYPE(QQuickMenu1)
#endif // QQUICKMENU_P_H
diff --git a/src/controls/qquickmenubar.cpp b/src/controls/qquickmenubar.cpp
index 00cc32d3..800105ca 100644
--- a/src/controls/qquickmenubar.cpp
+++ b/src/controls/qquickmenubar.cpp
@@ -45,13 +45,13 @@ QT_BEGIN_NAMESPACE
/*!
- \class QQuickMenuBar
+ \class QQuickMenuBar1
\internal
*/
/*!
\qmltype MenuBarPrivate
- \instantiates QQuickMenuBar
+ \instantiates QQuickMenuBar1
\internal
\inqmlmodule QtQuick.Controls
*/
@@ -65,28 +65,28 @@ QT_BEGIN_NAMESPACE
\sa Menu
*/
-QQuickMenuBar::QQuickMenuBar(QObject *parent)
+QQuickMenuBar1::QQuickMenuBar1(QObject *parent)
: QObject(parent), m_platformMenuBar(0), m_contentItem(0), m_parentWindow(0)
{
}
-QQuickMenuBar::~QQuickMenuBar()
+QQuickMenuBar1::~QQuickMenuBar1()
{
if (isNative())
setNativeNoNotify(false);
}
-QQmlListProperty<QQuickMenu> QQuickMenuBar::menus()
+QQmlListProperty<QQuickMenu1> QQuickMenuBar1::menus()
{
- return QQmlListProperty<QQuickMenu>(this, 0, &QQuickMenuBar::append_menu, &QQuickMenuBar::count_menu, &QQuickMenuBar::at_menu, 0);
+ return QQmlListProperty<QQuickMenu1>(this, 0, &QQuickMenuBar1::append_menu, &QQuickMenuBar1::count_menu, &QQuickMenuBar1::at_menu, 0);
}
-bool QQuickMenuBar::isNative() const
+bool QQuickMenuBar1::isNative() const
{
return m_platformMenuBar != 0;
}
-void QQuickMenuBar::setNative(bool native)
+void QQuickMenuBar1::setNative(bool native)
{
bool wasNative = isNative();
setNativeNoNotify(native);
@@ -94,20 +94,20 @@ void QQuickMenuBar::setNative(bool native)
emit nativeChanged();
}
-void QQuickMenuBar::setNativeNoNotify(bool native)
+void QQuickMenuBar1::setNativeNoNotify(bool native)
{
if (native) {
if (!m_platformMenuBar) {
m_platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar();
if (m_platformMenuBar) {
m_platformMenuBar->handleReparent(m_parentWindow);
- for (QQuickMenu *menu : qAsConst(m_menus))
+ for (QQuickMenu1 *menu : qAsConst(m_menus))
m_platformMenuBar->insertMenu(menu->platformMenu(), 0 /* append */);
}
}
} else {
if (m_platformMenuBar) {
- for (QQuickMenu *menu : qAsConst(m_menus))
+ for (QQuickMenu1 *menu : qAsConst(m_menus))
m_platformMenuBar->removeMenu(menu->platformMenu());
}
delete m_platformMenuBar;
@@ -115,7 +115,7 @@ void QQuickMenuBar::setNativeNoNotify(bool native)
}
}
-void QQuickMenuBar::setContentItem(QQuickItem *item)
+void QQuickMenuBar1::setContentItem(QQuickItem *item)
{
if (item != m_contentItem) {
m_contentItem = item;
@@ -123,7 +123,7 @@ void QQuickMenuBar::setContentItem(QQuickItem *item)
}
}
-void QQuickMenuBar::setParentWindow(QQuickWindow *newParentWindow)
+void QQuickMenuBar1::setParentWindow(QQuickWindow *newParentWindow)
{
if (newParentWindow != m_parentWindow) {
m_parentWindow = newParentWindow;
@@ -132,9 +132,9 @@ void QQuickMenuBar::setParentWindow(QQuickWindow *newParentWindow)
}
}
-void QQuickMenuBar::append_menu(QQmlListProperty<QQuickMenu> *list, QQuickMenu *menu)
+void QQuickMenuBar1::append_menu(QQmlListProperty<QQuickMenu1> *list, QQuickMenu1 *menu)
{
- if (QQuickMenuBar *menuBar = qobject_cast<QQuickMenuBar *>(list->object)) {
+ if (QQuickMenuBar1 *menuBar = qobject_cast<QQuickMenuBar1 *>(list->object)) {
menu->setParent(menuBar);
menuBar->m_menus.append(menu);
@@ -145,16 +145,16 @@ void QQuickMenuBar::append_menu(QQmlListProperty<QQuickMenu> *list, QQuickMenu *
}
}
-int QQuickMenuBar::count_menu(QQmlListProperty<QQuickMenu> *list)
+int QQuickMenuBar1::count_menu(QQmlListProperty<QQuickMenu1> *list)
{
- if (QQuickMenuBar *menuBar = qobject_cast<QQuickMenuBar *>(list->object))
+ if (QQuickMenuBar1 *menuBar = qobject_cast<QQuickMenuBar1 *>(list->object))
return menuBar->m_menus.size();
return 0;
}
-QQuickMenu *QQuickMenuBar::at_menu(QQmlListProperty<QQuickMenu> *list, int index)
+QQuickMenu1 *QQuickMenuBar1::at_menu(QQmlListProperty<QQuickMenu1> *list, int index)
{
- QQuickMenuBar *menuBar = qobject_cast<QQuickMenuBar *>(list->object);
+ QQuickMenuBar1 *menuBar = qobject_cast<QQuickMenuBar1 *>(list->object);
if (menuBar && 0 <= index && index < menuBar->m_menus.size())
return menuBar->m_menus[index];
return 0;
diff --git a/src/controls/qquickmenubar_p.h b/src/controls/qquickmenubar_p.h
index 83166d77..47b27a42 100644
--- a/src/controls/qquickmenubar_p.h
+++ b/src/controls/qquickmenubar_p.h
@@ -47,11 +47,11 @@ QT_BEGIN_NAMESPACE
class QPlatformMenuBar;
class QQuickItem;
-class QQuickMenuBar: public QObject
+class QQuickMenuBar1: public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<QQuickMenu> menus READ menus NOTIFY menusChanged)
+ Q_PROPERTY(QQmlListProperty<QQuickMenu1> menus READ menus NOTIFY menusChanged)
Q_CLASSINFO("DefaultProperty", "menus")
Q_PROPERTY(QQuickItem *__contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged)
@@ -64,10 +64,10 @@ Q_SIGNALS:
void contentItemChanged();
public:
- QQuickMenuBar(QObject *parent = 0);
- ~QQuickMenuBar();
+ QQuickMenuBar1(QObject *parent = 0);
+ ~QQuickMenuBar1();
- QQmlListProperty<QQuickMenu> menus();
+ QQmlListProperty<QQuickMenu1> menus();
bool isNative() const;
void setNative(bool native);
@@ -82,12 +82,12 @@ public:
private:
void setNativeNoNotify(bool native);
- 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);
+ static void append_menu(QQmlListProperty<QQuickMenu1> *list, QQuickMenu1 *menu);
+ static int count_menu(QQmlListProperty<QQuickMenu1> *list);
+ static QQuickMenu1 *at_menu(QQmlListProperty<QQuickMenu1> *list, int index);
private:
- QList<QQuickMenu *> m_menus;
+ QList<QQuickMenu1 *> m_menus;
QPlatformMenuBar *m_platformMenuBar;
QQuickItem *m_contentItem;
QQuickWindow *m_parentWindow;
diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp
index d2236bf5..2057ba11 100644
--- a/src/controls/qquickmenuitem.cpp
+++ b/src/controls/qquickmenuitem.cpp
@@ -89,12 +89,12 @@ QObject *QQuickMenuBase::parentMenuOrMenuBar() const
return m_parentMenu;
}
-QQuickMenu *QQuickMenuBase::parentMenu() const
+QQuickMenu1 *QQuickMenuBase::parentMenu() const
{
return m_parentMenu;
}
-void QQuickMenuBase::setParentMenu(QQuickMenu *parentMenu)
+void QQuickMenuBase::setParentMenu(QQuickMenu1 *parentMenu)
{
if (m_platformItem && m_parentMenu && m_parentMenu->platformMenu())
m_parentMenu->platformMenu()->removeMenuItem(m_platformItem);
@@ -114,7 +114,7 @@ void QQuickMenuBase::setContainer(QQuickMenuItemContainer *c)
void QQuickMenuBase::syncWithPlatformMenu()
{
- QQuickMenu *menu = parentMenu();
+ QQuickMenu1 *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());
@@ -283,7 +283,7 @@ void QQuickMenuText::updateIcon()
/*!
\qmltype MenuItem
- \instantiates QQuickMenuItem
+ \instantiates QQuickMenuItem1
\ingroup menus
\ingroup controls
\inqmlmodule QtQuick.Controls
@@ -456,7 +456,7 @@ void QQuickMenuText::updateIcon()
Defaults to \c null, meaning no action is bound to the menu item.
*/
-QQuickMenuItem::QQuickMenuItem(QObject *parent)
+QQuickMenuItem1::QQuickMenuItem1(QObject *parent)
: QQuickMenuText(parent, QQuickMenuItemType::Item), m_boundAction(0)
{
connect(this, SIGNAL(__textChanged()), this, SIGNAL(textChanged()));
@@ -469,21 +469,21 @@ QQuickMenuItem::QQuickMenuItem(QObject *parent)
connect(platformItem(), SIGNAL(activated()), this, SLOT(trigger()), Qt::QueuedConnection);
}
-QQuickMenuItem::~QQuickMenuItem()
+QQuickMenuItem1::~QQuickMenuItem1()
{
unbindFromAction(m_boundAction);
if (platformItem())
disconnect(platformItem(), SIGNAL(activated()), this, SLOT(trigger()));
}
-void QQuickMenuItem::setParentMenu(QQuickMenu *parentMenu)
+void QQuickMenuItem1::setParentMenu(QQuickMenu1 *parentMenu)
{
QQuickMenuText::setParentMenu(parentMenu);
if (parentMenu)
connect(this, SIGNAL(triggered()), parentMenu, SLOT(updateSelectedIndex()));
}
-void QQuickMenuItem::bindToAction(QQuickAction *action)
+void QQuickMenuItem1::bindToAction(QQuickAction *action)
{
m_boundAction = action;
@@ -511,7 +511,7 @@ void QQuickMenuItem::bindToAction(QQuickAction *action)
}
}
-void QQuickMenuItem::unbindFromAction(QObject *o)
+void QQuickMenuItem1::unbindFromAction(QObject *o)
{
if (!o)
return;
@@ -538,14 +538,14 @@ void QQuickMenuItem::unbindFromAction(QObject *o)
disconnect(action, SIGNAL(iconSourceChanged()), this, SIGNAL(iconSourceChanged()));
}
-QQuickAction *QQuickMenuItem::action() const
+QQuickAction *QQuickMenuItem1::action() const
{
if (m_boundAction)
return m_boundAction;
return QQuickMenuText::action();
}
-void QQuickMenuItem::setBoundAction(QQuickAction *a)
+void QQuickMenuItem1::setBoundAction(QQuickAction *a)
{
if (a == m_boundAction)
return;
@@ -556,7 +556,7 @@ void QQuickMenuItem::setBoundAction(QQuickAction *a)
emit actionChanged();
}
-QString QQuickMenuItem::text() const
+QString QQuickMenuItem1::text() const
{
QString ownText = QQuickMenuText::text();
if (!ownText.isNull())
@@ -564,7 +564,7 @@ QString QQuickMenuItem::text() const
return m_boundAction ? m_boundAction->text() : QString();
}
-QUrl QQuickMenuItem::iconSource() const
+QUrl QQuickMenuItem1::iconSource() const
{
QUrl ownIconSource = QQuickMenuText::iconSource();
if (!ownIconSource.isEmpty())
@@ -572,7 +572,7 @@ QUrl QQuickMenuItem::iconSource() const
return m_boundAction ? m_boundAction->iconSource() : QUrl();
}
-QString QQuickMenuItem::iconName() const
+QString QQuickMenuItem1::iconName() const
{
QString ownIconName = QQuickMenuText::iconName();
if (!ownIconName.isEmpty())
@@ -580,7 +580,7 @@ QString QQuickMenuItem::iconName() const
return m_boundAction ? m_boundAction->iconName() : QString();
}
-QIcon QQuickMenuItem::icon() const
+QIcon QQuickMenuItem1::icon() const
{
QIcon ownIcon = QQuickMenuText::icon();
if (!ownIcon.isNull())
@@ -588,18 +588,18 @@ QIcon QQuickMenuItem::icon() const
return m_boundAction ? m_boundAction->icon() : QIcon();
}
-QVariant QQuickMenuItem::shortcut() const
+QVariant QQuickMenuItem1::shortcut() const
{
return action()->shortcut();
}
-void QQuickMenuItem::setShortcut(const QVariant &shortcut)
+void QQuickMenuItem1::setShortcut(const QVariant &shortcut)
{
if (!m_boundAction)
action()->setShortcut(shortcut);
}
-void QQuickMenuItem::updateShortcut()
+void QQuickMenuItem1::updateShortcut()
{
if (platformItem()) {
QKeySequence sequence;
@@ -614,18 +614,18 @@ void QQuickMenuItem::updateShortcut()
emit shortcutChanged();
}
-bool QQuickMenuItem::checkable() const
+bool QQuickMenuItem1::checkable() const
{
return action()->isCheckable();
}
-void QQuickMenuItem::setCheckable(bool checkable)
+void QQuickMenuItem1::setCheckable(bool checkable)
{
if (!m_boundAction)
action()->setCheckable(checkable);
}
-void QQuickMenuItem::updateCheckable()
+void QQuickMenuItem1::updateCheckable()
{
if (platformItem()) {
platformItem()->setCheckable(checkable());
@@ -635,18 +635,18 @@ void QQuickMenuItem::updateCheckable()
emit checkableChanged();
}
-bool QQuickMenuItem::checked() const
+bool QQuickMenuItem1::checked() const
{
return action()->isChecked();
}
-void QQuickMenuItem::setChecked(bool checked)
+void QQuickMenuItem1::setChecked(bool checked)
{
if (!m_boundAction)
action()->setChecked(checked);
}
-void QQuickMenuItem::updateChecked()
+void QQuickMenuItem1::updateChecked()
{
bool checked = this->checked();
if (platformItem()) {
@@ -657,26 +657,26 @@ void QQuickMenuItem::updateChecked()
emit toggled(checked);
}
-QQuickExclusiveGroup1 *QQuickMenuItem::exclusiveGroup() const
+QQuickExclusiveGroup1 *QQuickMenuItem1::exclusiveGroup() const
{
return action()->exclusiveGroup();
}
-void QQuickMenuItem::setExclusiveGroup(QQuickExclusiveGroup1 *eg)
+void QQuickMenuItem1::setExclusiveGroup(QQuickExclusiveGroup1 *eg)
{
if (!m_boundAction)
action()->setExclusiveGroup(eg);
}
-void QQuickMenuItem::setEnabled(bool enabled)
+void QQuickMenuItem1::setEnabled(bool enabled)
{
if (!m_boundAction)
action()->setEnabled(enabled);
}
-void QQuickMenuItem::trigger()
+void QQuickMenuItem1::trigger()
{
- QPointer<QQuickMenu> menu(parentMenu());
+ QPointer<QQuickMenu1> menu(parentMenu());
if (menu)
menu->prepareItemTrigger(this);
action()->trigger(this);
diff --git a/src/controls/qquickmenuitem_p.h b/src/controls/qquickmenuitem_p.h
index d8f3ca32..4c60a9b8 100644
--- a/src/controls/qquickmenuitem_p.h
+++ b/src/controls/qquickmenuitem_p.h
@@ -51,7 +51,7 @@ class QPlatformMenuItem;
class QQuickItem;
class QQuickAction;
class QQuickExclusiveGroup1;
-class QQuickMenu;
+class QQuickMenu1;
class QQuickMenuItemContainer;
class QQuickMenuItemType
@@ -88,9 +88,9 @@ public:
bool visible() const { return m_visible; }
virtual void setVisible(bool);
- QQuickMenu *parentMenu() const;
+ QQuickMenu1 *parentMenu() const;
QObject *parentMenuOrMenuBar() const;
- virtual void setParentMenu(QQuickMenu *parentMenu);
+ virtual void setParentMenu(QQuickMenu1 *parentMenu);
QQuickMenuItemContainer *container() const;
void setContainer(QQuickMenuItemContainer *);
@@ -107,7 +107,7 @@ public:
private:
bool m_visible;
QQuickMenuItemType::MenuItemType m_type;
- QQuickMenu *m_parentMenu;
+ QQuickMenu1 *m_parentMenu;
QQuickMenuItemContainer *m_container;
QPlatformMenuItem *m_platformItem;
QPointer<QQuickItem> m_visualItem;
@@ -167,7 +167,7 @@ private:
QQuickAction *m_action;
};
-class QQuickMenuItem : public QQuickMenuText
+class QQuickMenuItem1 : public QQuickMenuText
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
@@ -191,8 +191,8 @@ Q_SIGNALS:
void actionChanged();
public:
- QQuickMenuItem(QObject *parent = 0);
- ~QQuickMenuItem();
+ QQuickMenuItem1(QObject *parent = 0);
+ ~QQuickMenuItem1();
void setEnabled(bool enabled);
@@ -216,7 +216,7 @@ public:
QQuickExclusiveGroup1 *exclusiveGroup() const;
void setExclusiveGroup(QQuickExclusiveGroup1 *);
- void setParentMenu(QQuickMenu *parentMenu);
+ void setParentMenu(QQuickMenu1 *parentMenu);
protected Q_SLOTS:
void updateShortcut();
diff --git a/src/controls/qquickmenuitemcontainer_p.h b/src/controls/qquickmenuitemcontainer_p.h
index 02786f51..c34f2eb3 100644
--- a/src/controls/qquickmenuitemcontainer_p.h
+++ b/src/controls/qquickmenuitemcontainer_p.h
@@ -56,7 +56,7 @@ public:
setParentMenu(0);
}
- void setParentMenu(QQuickMenu *parentMenu)
+ void setParentMenu(QQuickMenu1 *parentMenu)
{
QQuickMenuBase::setParentMenu(parentMenu);
for (QQuickMenuBase *item : qAsConst(m_menuItems))
diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp
index 2a91940e..8d821d84 100644
--- a/src/controls/qquickmenupopupwindow.cpp
+++ b/src/controls/qquickmenupopupwindow.cpp
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
-QQuickMenuPopupWindow::QQuickMenuPopupWindow(QQuickMenu *menu) :
+QQuickMenuPopupWindow::QQuickMenuPopupWindow(QQuickMenu1 *menu) :
m_itemAt(0),
m_logicalParentWindow(0),
m_menu(menu)
@@ -163,32 +163,22 @@ void QQuickMenuPopupWindow::exposeEvent(QExposeEvent *e)
updateSize();
}
-QQuickMenu *QQuickMenuPopupWindow::menu() const
+QQuickMenu1 *QQuickMenuPopupWindow::menu() const
{
return m_menu;
}
-QQuickMenuBar *QQuickMenuPopupWindow::menuBar() const
-{
- QObject *pi = menu()->parentMenuOrMenuBar();
- while (pi) {
- if (QQuickMenuBar *menuBar = qobject_cast<QQuickMenuBar*>(pi))
- return menuBar;
- else if (QQuickMenu *menu = qobject_cast<QQuickMenu*>(pi))
- pi = menu->parentMenuOrMenuBar();
- else
- return 0;
- }
- return 0;
-}
-
bool QQuickMenuPopupWindow::shouldForwardEventAfterDismiss(QMouseEvent *e) const
{
- // The events that dismissed a popup child of a menu contained in the menubar
- // are never forwarded
- if (QQuickMenuBar *mb = menuBar()) {
- QPoint parentPos = transientParent()->mapFromGlobal(mapToGlobal(e->pos()));
- if (!mb->isNative() && mb->contentItem()->contains(parentPos))
+ // If the event falls inside this item the event should not be forwarded.
+ // For example for comboboxes or top menus of the menubar
+ QQuickMenuBar1 *mb = m_menu ? m_menu->menuBar() : Q_NULLPTR;
+ QQuickItem *item = mb && !mb->isNative() ? mb->contentItem() : menu()->visualItem();
+ QWindow *window = transientParent();
+ if (item && window && item->window() == window) {
+ QPointF pos = window->mapFromGlobal(mapToGlobal(e->pos()));
+ pos = item->mapFromScene(pos);
+ if (item->contains(pos))
return false;
}
diff --git a/src/controls/qquickmenupopupwindow_p.h b/src/controls/qquickmenupopupwindow_p.h
index deb867b3..5cff75af 100644
--- a/src/controls/qquickmenupopupwindow_p.h
+++ b/src/controls/qquickmenupopupwindow_p.h
@@ -41,14 +41,14 @@
QT_BEGIN_NAMESPACE
-class QQuickMenu;
-class QQuickMenuBar;
+class QQuickMenu1;
+class QQuickMenuBar1;
class QQuickMenuPopupWindow : public QQuickPopupWindow
{
Q_OBJECT
public:
- QQuickMenuPopupWindow(QQuickMenu *menu);
+ QQuickMenuPopupWindow(QQuickMenu1 *menu);
void setItemAt(QQuickItem *menuItem);
void setParentWindow(QWindow *effectiveParentWindow, QQuickWindow *parentWindow);
@@ -56,7 +56,7 @@ public:
void setParentItem(QQuickItem *);
- QQuickMenu *menu() const;
+ QQuickMenu1 *menu() const;
public Q_SLOTS:
void setToBeDeletedLater();
@@ -76,10 +76,7 @@ private:
QPointF m_oldItemPos;
QPointF m_initialPos;
QPointer<QQuickWindow> m_logicalParentWindow;
- QQuickMenu *m_menu;
-
-private:
- QQuickMenuBar *menuBar() const;
+ QQuickMenu1 *m_menu;
};
QT_END_NAMESPACE