summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Ahumada <sahumada@blackberry.com>2014-06-14 18:20:39 +0200
committerSergio Ahumada <sahumada@blackberry.com>2014-06-14 18:20:39 +0200
commitd67c98cb5d46e8d4bf72e57f3379e94b59b599fc (patch)
treeb9ce7231390313b4d467097b66c7c902f692fb22
parentf6845c203f00c90018c9d29579f890ea89dd2579 (diff)
parent8deeceb12e68dd429ee53d6ef667f1ec79bce4de (diff)
downloadqtquickcontrols-d67c98cb5d46e8d4bf72e57f3379e94b59b599fc.tar.gz
qtquickcontrols-d67c98cb5d46e8d4bf72e57f3379e94b59b599fc.tar.bz2
qtquickcontrols-d67c98cb5d46e8d4bf72e57f3379e94b59b599fc.zip
Merge remote-tracking branch 'origin/stable' into 5.3
Change-Id: I44e51646f79c71b9ade6cbedd9e22bcae00833c8
-rw-r--r--src/controls/MenuBar.qml20
-rw-r--r--src/controls/Private/MenuContentItem.qml4
-rw-r--r--src/layouts/doc/images/columnlayout.pngbin0 -> 348 bytes
-rw-r--r--src/layouts/doc/images/gridlayout.pngbin0 -> 2530 bytes
-rw-r--r--src/layouts/doc/images/rowlayout.pngbin0 -> 2627 bytes
-rw-r--r--src/layouts/qquicklinearlayout.cpp86
6 files changed, 96 insertions, 14 deletions
diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml
index 0fe56ef1..4d577930 100644
--- a/src/controls/MenuBar.qml
+++ b/src/controls/MenuBar.qml
@@ -174,8 +174,13 @@ MenuBarPrivate {
Keys.onLeftPressed: {
if (d.openedMenuIndex > 0) {
- d.preselectMenuItem = true
- d.openedMenuIndex--
+ var idx = d.openedMenuIndex - 1
+ while (idx >= 0 && !root.menus[idx].enabled)
+ idx--
+ if (idx >= 0) {
+ d.preselectMenuItem = true
+ d.openedMenuIndex = idx
+ }
} else {
event.accepted = false;
}
@@ -183,8 +188,13 @@ MenuBarPrivate {
Keys.onRightPressed: {
if (d.openedMenuIndex !== -1 && d.openedMenuIndex < root.menus.length - 1) {
- d.preselectMenuItem = true
- d.openedMenuIndex++
+ var idx = d.openedMenuIndex + 1
+ while (idx < root.menus.length && !root.menus[idx].enabled)
+ idx++
+ if (idx < root.menus.length) {
+ d.preselectMenuItem = true
+ d.openedMenuIndex = idx
+ }
} else {
event.accepted = false;
}
@@ -223,6 +233,8 @@ MenuBarPrivate {
Connections {
target: d
onOpenedMenuIndexChanged: {
+ if (!__menuItem.enabled)
+ return;
if (d.openedMenuIndex === index) {
if (__menuItem.__usingDefaultStyle)
__menuItem.style = d.style.menuStyle
diff --git a/src/controls/Private/MenuContentItem.qml b/src/controls/Private/MenuContentItem.qml
index dbbf26a9..669cde2f 100644
--- a/src/controls/Private/MenuContentItem.qml
+++ b/src/controls/Private/MenuContentItem.qml
@@ -165,7 +165,7 @@ Loader {
itemsModel: __menu.items
minWidth: __menu.__minimumWidth
maxHeight: d.style ? d.style.__maxPopupHeight : 0
- onTriggered: d.triggerAndDismiss(item)
+ onTriggered: if (item.__menuItem.enabled) d.triggerAndDismiss(item)
}
Component {
@@ -199,6 +199,8 @@ Loader {
active: visible
function __showSubMenu(immediately) {
+ if (!__menuItem.enabled)
+ return;
if (immediately) {
if (__menu.__currentIndex === __menuItemIndex) {
if (__menuItem.__usingDefaultStyle)
diff --git a/src/layouts/doc/images/columnlayout.png b/src/layouts/doc/images/columnlayout.png
new file mode 100644
index 00000000..f03eb7b9
--- /dev/null
+++ b/src/layouts/doc/images/columnlayout.png
Binary files differ
diff --git a/src/layouts/doc/images/gridlayout.png b/src/layouts/doc/images/gridlayout.png
new file mode 100644
index 00000000..493813c4
--- /dev/null
+++ b/src/layouts/doc/images/gridlayout.png
Binary files differ
diff --git a/src/layouts/doc/images/rowlayout.png b/src/layouts/doc/images/rowlayout.png
new file mode 100644
index 00000000..519a62fd
--- /dev/null
+++ b/src/layouts/doc/images/rowlayout.png
Binary files differ
diff --git a/src/layouts/qquicklinearlayout.cpp b/src/layouts/qquicklinearlayout.cpp
index ea772225..2db7bee0 100644
--- a/src/layouts/qquicklinearlayout.cpp
+++ b/src/layouts/qquicklinearlayout.cpp
@@ -69,6 +69,39 @@
\li \l{Layout::alignment}{Layout.alignment}
\endlist
+ \image rowlayout.png
+
+ \code
+ RowLayout {
+ id: layout
+ anchors.fill: parent
+ spacing: 6
+ Rectangle {
+ color: 'teal'
+ Layout.fillWidth: true
+ Layout.minimumWidth: 50
+ Layout.preferredWidth: 100
+ Layout.maximumWidth: 300
+ Layout.minimumHeight: 150
+ Text {
+ anchors.centerIn: parent
+ text: parent.width + 'x' + parent.height
+ }
+ }
+ Rectangle {
+ color: 'plum'
+ Layout.fillWidth: true
+ Layout.minimumWidth: 100
+ Layout.preferredWidth: 200
+ Layout.preferredHeight: 100
+ Text {
+ anchors.centerIn: parent
+ text: parent.width + 'x' + parent.height
+ }
+ }
+ }
+ \endcode
+
Read more about attached properties \l{QML Object Attributes}{here}.
\sa ColumnLayout
\sa GridLayout
@@ -98,6 +131,36 @@
\li \l{Layout::alignment}{Layout.alignment}
\endlist
+ \image columnlayout.png
+
+ \code
+ ColumnLayout{
+ spacing: 2
+
+ Rectangle {
+ Layout.alignment: Qt.AlignCenter
+ color: "red"
+ Layout.preferredWidth: 40
+ Layout.preferredHeight: 40
+ }
+
+ Rectangle {
+ Layout.alignment: Qt.AlignRight
+ color: "green"
+ Layout.preferredWidth: 40
+ Layout.preferredHeight: 70
+ }
+
+ Rectangle {
+ Layout.alignment: Qt.AlignBottom
+ Layout.fillHeight: true
+ color: "blue"
+ Layout.preferredWidth: 70
+ Layout.preferredHeight: 40
+ }
+ }
+ \endcode
+
Read more about attached properties \l{QML Object Attributes}{here}.
\sa RowLayout
@@ -114,6 +177,8 @@
\ingroup layouts
\brief Provides a way of dynamically arranging items in a grid.
+
+
If the GridLayout is resized, all items in the layout will be rearranged. It is similar
to the widget-based QGridLayout. All visible children of the GridLayout element will belong to
the layout. If you want a layout with just one row or one column, you can use the
@@ -127,16 +192,19 @@
columns the layout can have, before the auto-positioning wraps back to the beginning of the
next row. The \l columns property is only used when \l flow is \c GridLayout.LeftToRight.
+ \image gridlayout.png
+
\code
- GridLayout {
- id: grid
- columns: 3
- Text { text: "Three" }
- Text { text: "words" }
- Text { text: "in" }
- Text { text: "a" }
- Text { text: "row" }
- }
+ GridLayout {
+ id: grid
+ columns: 3
+
+ Text { text: "Three"; font.bold: true; }
+ Text { text: "words"; color: "red" }
+ Text { text: "in"; font.underline: true }
+ Text { text: "a"; font.pixelSize: 20 }
+ Text { text: "row"; font.strikeout: true }
+ }
\endcode
The \l rows property works in a similar way, but items are auto-positioned vertically. The \l