summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-07-09 18:40:02 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-07-09 18:40:02 +0200
commit223ec0f7827fde5609d7d48237a95e9b7c9563e1 (patch)
treeaf8420daede7cd8208adda1c8cb6381b062bdc83
parenta25023d56f16d8d3c08cc60f7059cf10a3b8a5ba (diff)
parentf2a3019e4332b756b5b27092768bf4039dca7c7a (diff)
downloadqtquickcontrols-223ec0f7827fde5609d7d48237a95e9b7c9563e1.tar.gz
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: src/controls/ToolBar.qml Change-Id: I5510496219a4ebe8bfced4192307219238ca9bb6
-rw-r--r--dist/changes-5.3.177
-rw-r--r--src/controls/ApplicationWindow.qml9
-rw-r--r--src/controls/BusyIndicator.qml10
-rw-r--r--src/controls/Button.qml8
-rw-r--r--src/controls/Calendar.qml8
-rw-r--r--src/controls/CheckBox.qml4
-rw-r--r--src/controls/ComboBox.qml15
-rw-r--r--src/controls/GroupBox.qml35
-rw-r--r--src/controls/Label.qml4
-rw-r--r--src/controls/Menu.qml2
-rw-r--r--src/controls/MenuBar.qml30
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp4
-rw-r--r--src/controls/ProgressBar.qml13
-rw-r--r--src/controls/RadioButton.qml23
-rw-r--r--src/controls/ScrollView.qml2
-rw-r--r--src/controls/Slider.qml4
-rw-r--r--src/controls/SpinBox.qml13
-rw-r--r--src/controls/SplitView.qml55
-rw-r--r--src/controls/StackView.qml25
-rw-r--r--src/controls/Switch.qml5
-rw-r--r--src/controls/Tab.qml2
-rw-r--r--src/controls/TabView.qml27
-rw-r--r--src/controls/TableViewColumn.qml15
-rw-r--r--src/controls/TextArea.qml10
-rw-r--r--src/controls/TextField.qml10
-rw-r--r--src/controls/ToolBar.qml26
-rw-r--r--src/controls/ToolButton.qml34
-rw-r--r--src/controls/doc/images/applicationwindow.pngbin0 -> 4576 bytes
-rw-r--r--src/controls/doc/images/busyindicator.pngbin0 -> 3027 bytes
-rw-r--r--src/controls/doc/images/button.pngbin0 -> 1295 bytes
-rw-r--r--src/controls/doc/images/calendar.pngbin0 -> 14280 bytes
-rw-r--r--src/controls/doc/images/checkbox.pngbin0 -> 3389 bytes
-rw-r--r--src/controls/doc/images/combobox.pngbin0 -> 2043 bytes
-rw-r--r--src/controls/doc/images/groupbox.pngbin0 -> 4922 bytes
-rw-r--r--src/controls/doc/images/label.pngbin0 -> 2526 bytes
-rw-r--r--src/controls/doc/images/menu.pngbin0 -> 10484 bytes
-rw-r--r--src/controls/doc/images/menubar.pngbin0 -> 4468 bytes
-rw-r--r--src/controls/doc/images/progressbar-intermediate.pngbin0 -> 1384 bytes
-rw-r--r--src/controls/doc/images/progressbar.pngbin0 -> 1719 bytes
-rw-r--r--src/controls/doc/images/radiobutton.pngbin0 -> 4083 bytes
-rw-r--r--src/controls/doc/images/scrollview.pngbin0 -> 35784 bytes
-rw-r--r--src/controls/doc/images/slider.pngbin0 -> 1579 bytes
-rw-r--r--src/controls/doc/images/spinbox.pngbin0 -> 868 bytes
-rw-r--r--src/controls/doc/images/splitview.pngbin0 -> 3066 bytes
-rw-r--r--src/controls/doc/images/stackview.pngbin0 -> 20718 bytes
-rw-r--r--src/controls/doc/images/switch.pngbin0 -> 557 bytes
-rw-r--r--src/controls/doc/images/tableview.pngbin55512 -> 6612 bytes
-rw-r--r--src/controls/doc/images/tabview.pngbin0 -> 4026 bytes
-rw-r--r--src/controls/doc/images/textarea.pngbin0 -> 25049 bytes
-rw-r--r--src/controls/doc/images/textfield.pngbin0 -> 1577 bytes
-rw-r--r--src/controls/doc/images/toolbar.pngbin0 -> 5134 bytes
-rw-r--r--src/controls/qquickaction.cpp19
-rw-r--r--src/controls/qquickexclusivegroup.cpp48
-rw-r--r--src/controls/qquickmenu.cpp9
-rw-r--r--src/controls/qquickmenuitem.cpp34
-rw-r--r--src/controls/qquickmenupopupwindow.cpp15
-rw-r--r--src/controls/qquickmenupopupwindow_p.h2
-rw-r--r--tests/auto/controls/data/tst_gridlayout.qml168
58 files changed, 556 insertions, 209 deletions
diff --git a/dist/changes-5.3.1 b/dist/changes-5.3.1
new file mode 100644
index 00000000..ec36c5c9
--- /dev/null
+++ b/dist/changes-5.3.1
@@ -0,0 +1,77 @@
+Qt 5.3.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.3.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ http://qt-project.org/doc/qt-5.3
+
+The Qt version 5.3 series is binary compatible with the 5.2.x series.
+Applications compiled for 5.2 will continue to run with 5.3.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ http://bugreports.qt-project.org/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+- Calendar:
+ * [QTBUG-38848] Calendar no longer selects dates in the next/previous
+ month when dragging the mouse.
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+QtQuick.Controls
+----------------
+
+ - Calendar:
+ * [QTBUG-38847] Fixed layouting and grid cell calculation
+
+ - ComboBox:
+ * [QTBUG-38054] Fixed the height of ComboBox
+ * [QTBUG-38384] Fixed the width of the button
+ * [QTBUG-38036] Fixed currentText to be correctly updated when the
+ current index goes from -1 to 0
+
+ - Menu:
+ * [QTBUG-39384] Fixed the disabled state handling for QPA menus
+
+ - ScrollView:
+ * [QTBUG-38083] Ensured that child MouseAreas will get mouse events first
+ * Fixed the scrollbar handle position calculation
+ * Fixed scrolling of parent ScrollViews when reaching the bounds of a
+ ScrollView
+
+ - TableView:
+ * [QTBUG-38789] Fixed styleData.row to be a binding so it updates
+ correctly for dynamically changing models
+ * Fixed the position of "filled" rows to move together with content
+ * [QTBUG-39337] Fixed TableViewColumn::resizeToContents() to process all
+ rows
+ * [QTBUG-39393] Fixed the content width calculation with a hidden header
+ * [QTBUG-39393] Allowed resizing and scrolling single-column tables
+
+ - TabView:
+ * Fixed handling of invalid indexes for TabView::getTab()
+ * Fixed the currentIndex to be updated correctly when inserting/removing
+ tabs
+ * Fixed styleData.activeFocus for the tab-delegate be true when the tab
+ button itself has active focus instead of the whole tabbar
+ * [QTBUG-38819] Fixed styleData.previousSelected for the tab-delegate
+
+QtQuick.Dialogs
+---------------
+
+ - Dialog:
+ * [QTBUG-39339] Prevented click passthrough when a dialog is showing
+
+ - FileDialog:
+ * [QTBUG-39204] Fixed back and esc keys to reject the dialog
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml
index 5ac73fbe..b4616363 100644
--- a/src/controls/ApplicationWindow.qml
+++ b/src/controls/ApplicationWindow.qml
@@ -51,6 +51,8 @@ import QtQuick.Controls.Private 1.0
\ingroup applicationwindow
\brief Provides a top-level application window.
+ \image applicationwindow.png
+
ApplicationWindow is a \l Window that adds convenience for positioning items,
such as \l MenuBar, \l ToolBar, and \l StatusBar in a platform independent
manner.
@@ -58,6 +60,8 @@ import QtQuick.Controls.Private 1.0
\code
ApplicationWindow {
id: window
+ visible: true
+
menuBar: MenuBar {
Menu { MenuItem {...} }
Menu { MenuItem {...} }
@@ -77,6 +81,11 @@ import QtQuick.Controls.Private 1.0
}
}
\endcode
+
+ \note By default, an ApplicationWindow is not visible.
+
+ The \l{Qt Quick Controls - Gallery} example is a good starting
+ point to explore this type.
*/
Window {
diff --git a/src/controls/BusyIndicator.qml b/src/controls/BusyIndicator.qml
index e995579d..761c0675 100644
--- a/src/controls/BusyIndicator.qml
+++ b/src/controls/BusyIndicator.qml
@@ -49,9 +49,19 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief A busy indicator.
+ \image busyindicator.png
+
The busy indicator should be used to indicate activity while content is
being loaded or the UI is blocked waiting for a resource to become available.
+ The following snippet shows how to use the BusyIndicator:
+
+ \qml
+ BusyIndicator {
+ running: image.status === Image.Loading
+ }
+ \endqml
+
You can create a custom appearance for a Busy Indicator by
assigning a \l {QtQuick.Controls.Styles::BusyIndicatorStyle}{BusyIndicatorStyle}.
*/
diff --git a/src/controls/Button.qml b/src/controls/Button.qml
index facb711c..74d46bf1 100644
--- a/src/controls/Button.qml
+++ b/src/controls/Button.qml
@@ -49,11 +49,19 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief A push button with a text label.
+ \image button.png
+
The push button is perhaps the most commonly used widget in any graphical
user interface. Pushing (or clicking) a button commands the computer to
perform some action or answer a question. Common examples of buttons are
OK, Apply, Cancel, Close, Yes, No, and Help buttons.
+ \qml
+ Button {
+ text: "Button"
+ }
+ \endqml
+
Button is similar to the QPushButton widget.
You can create a custom appearance for a Button by
diff --git a/src/controls/Calendar.qml b/src/controls/Calendar.qml
index bd376c10..9dd96ed3 100644
--- a/src/controls/Calendar.qml
+++ b/src/controls/Calendar.qml
@@ -50,6 +50,8 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief Provides a way to select dates from a calendar
+ \image calendar.png
+
Calendar allows selection of dates from a grid of days, similar to
QCalendarWidget.
@@ -67,6 +69,12 @@ import QtQuick.Controls.Private 1.0
Week numbers can be displayed by setting the weekNumbersVisible property to
\c true.
+ \qml
+ Calendar{
+ weekNumbersVisible: true
+ }
+ \endqml
+
You can create a custom appearance for Calendar by assigning a
\l {QtQuick.Controls.Styles::CalendarStyle}{CalendarStyle}.
*/
diff --git a/src/controls/CheckBox.qml b/src/controls/CheckBox.qml
index 66b49345..524ecc92 100644
--- a/src/controls/CheckBox.qml
+++ b/src/controls/CheckBox.qml
@@ -49,6 +49,8 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief A checkbox with a text label.
+ \image checkbox.png
+
A CheckBox is an option button that can be toggled on (checked) or off
(unchecked). Checkboxes are typically used to represent features in an
application that can be enabled or disabled without affecting others.
@@ -74,12 +76,14 @@ import QtQuick.Controls.Private 1.0
Column {
CheckBox {
text: qsTr("Breakfast")
+ checked: true
}
CheckBox {
text: qsTr("Lunch")
}
CheckBox {
text: qsTr("Dinner")
+ checked: true
}
}
\endqml
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 44ae2433..d9a9aaa7 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -49,7 +49,10 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief Provides a drop-down list functionality.
- Add items to the comboBox by assigning it a ListModel, or a list of strings to the \l model property.
+ \image combobox.png
+
+ Add items to the ComboBox by assigning it a ListModel, or a list of strings
+ to the \l model property.
\qml
ComboBox {
@@ -159,7 +162,7 @@ Control {
This property indicates whether the control is being hovered.
*/
- readonly property alias hovered: mouseArea.containsMouse
+ readonly property bool hovered: mouseArea.containsMouse || cursorArea.containsMouse
/*! \qmlproperty int ComboBox::count
\since QtQuick.Controls 1.1
@@ -459,6 +462,14 @@ Control {
}
prevText = text
}
+
+ MouseArea {
+ id: cursorArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.IBeamCursor
+ acceptedButtons: Qt.NoButton
+ }
}
Binding {
diff --git a/src/controls/GroupBox.qml b/src/controls/GroupBox.qml
index 9ed90fa5..d17d8cb8 100644
--- a/src/controls/GroupBox.qml
+++ b/src/controls/GroupBox.qml
@@ -51,6 +51,8 @@ import QtQuick.Layouts 1.0
\ingroup controls
\brief GroupBox provides a group box frame with a title.
+ \image groupbox.png
+
A group box provides a frame, a title on top and displays various other controls inside itself. Group boxes can also be checkable.
Child controls in checkable group boxes are enabled or disabled depending on whether or not the group box is checked.
@@ -63,24 +65,29 @@ import QtQuick.Layouts 1.0
The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor
items inside the group box, you must specify an explicit width and height on the GroupBox itself.
- The following example shows how we use a GroupBox with a column:
+ The following example shows how we use a GroupBox:
\qml
- GroupBox {
- title: qsTr("Package selection")
- Column {
- spacing: 2
- CheckBox {
- text: qsTr("Update system")
- }
- CheckBox {
- text: qsTr("Update applications")
- }
- CheckBox {
- text: qsTr("Update documentation")
- }
+ GroupBox {
+ title: "Joining for?"
+
+ Column {
+ spacing: 10
+
+ CheckBox {
+ text: "Breakfast"
+ checked: true
+ }
+ CheckBox {
+ text: "Lunch"
+ checked: false
+ }
+ CheckBox {
+ text: "Dinner"
+ checked: true
}
}
+ }
\endqml
\sa CheckBox, RadioButton, Layout
diff --git a/src/controls/Label.qml b/src/controls/Label.qml
index 7ec47490..e3052f44 100644
--- a/src/controls/Label.qml
+++ b/src/controls/Label.qml
@@ -47,7 +47,9 @@ import QtQuick 2.2
\ingroup controls
\brief A text label.
- In addition to the normal \l Text element, Label follows the font and
+ \image label.png
+
+ In addition to the normal \l Text type, Label follows the font and
color scheme of the system.
Use the \c text property to assign a text to the label. For other properties
check \l Text.
diff --git a/src/controls/Menu.qml b/src/controls/Menu.qml
index 0505a0a6..30177e4b 100644
--- a/src/controls/Menu.qml
+++ b/src/controls/Menu.qml
@@ -51,6 +51,8 @@ import QtQuick.Controls.Private 1.0
\brief Provides a menu component for use in menu bars, as context menu,
and other popup menus.
+ \image menu.png
+
\code
Menu {
title: "Edit"
diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml
index 4d577930..19e405ae 100644
--- a/src/controls/MenuBar.qml
+++ b/src/controls/MenuBar.qml
@@ -50,19 +50,27 @@ import QtQuick.Controls.Private 1.0
\ingroup applicationwindow
\brief Provides a horizontal menu bar.
+ \image menubar.png
+
+ MenuBar can be added to an \l ApplicationWindow, providing menu options
+ to access additional functionality of the application.
+
\code
- MenuBar {
- Menu {
- title: "File"
- MenuItem { text: "Open..." }
- MenuItem { text: "Close" }
- }
+ ApplicationWindow {
+ ...
+ menuBar: MenuBar {
+ Menu {
+ title: "File"
+ MenuItem { text: "Open..." }
+ MenuItem { text: "Close" }
+ }
- Menu {
- title: "Edit"
- MenuItem { text: "Cut" }
- MenuItem { text: "Copy" }
- MenuItem { text: "Paste" }
+ Menu {
+ title: "Edit"
+ MenuItem { text: "Cut" }
+ MenuItem { text: "Copy" }
+ MenuItem { text: "Paste" }
+ }
}
}
\endcode
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp
index b7ebc213..2f86a4a1 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -90,7 +90,9 @@ static QString styleImportPath(QQmlEngine *engine, const QString &styleName)
{
QString path = qgetenv("QT_QUICK_CONTROLS_STYLE");
QFileInfo info(path);
- if (info.isRelative()) {
+ if (fromResource(path)) {
+ path = info.path();
+ } else if (info.isRelative()) {
bool found = false;
foreach (const QString &import, engine->importPathList()) {
QDir dir(import + QLatin1String("/QtQuick/Controls/Styles"));
diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml
index 6a001f14..6af20e03 100644
--- a/src/controls/ProgressBar.qml
+++ b/src/controls/ProgressBar.qml
@@ -49,9 +49,22 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief A progress indicator.
+ \image progressbar.png
+
The ProgressBar is used to give an indication of the progress of an operation.
\l value is updated regularly and must be between \l minimumValue and \l maximumValue.
+ \code
+ Column {
+ ProgressBar {
+ value: 0.5
+ }
+ ProgressBar {
+ indeterminate: true
+ }
+ }
+ \endcode
+
You can create a custom appearance for a ProgressBar by
assigning a \l {QtQuick.Controls.Styles::ProgressBarStyle}{ProgressBarStyle}.
*/
diff --git a/src/controls/RadioButton.qml b/src/controls/RadioButton.qml
index 730e3448..e51abea8 100644
--- a/src/controls/RadioButton.qml
+++ b/src/controls/RadioButton.qml
@@ -49,25 +49,28 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief A radio button with a text label.
+ \image radiobutton.png
+
A RadioButton is an option button that can be switched on (checked) or off
(unchecked). Radio buttons typically present the user with a "one of many"
- choice. In a group of radio buttons, only one radio button at a time can be
- checked; if the user selects another button, the previously selected button
- is switched off.
+ choices. In a group of radio buttons, only one radio button can be
+ checked at a time; if the user selects another button, the previously
+ selected button is switched off.
\qml
GroupBox {
- title: qsTr("Search")
- Column {
- ExclusiveGroup { id: group }
+ title: "Tab Position"
+
+ RowLayout {
+ ExclusiveGroup { id: tabPositionGroup }
RadioButton {
- text: qsTr("From top")
- exclusiveGroup: group
+ text: "Top"
checked: true
+ exclusiveGroup: tabPositionGroup
}
RadioButton {
- text: qsTr("From cursor")
- exclusiveGroup: group
+ text: "Bottom"
+ exclusiveGroup: tabPositionGroup
}
}
}
diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml
index 431fadd1..37a87215 100644
--- a/src/controls/ScrollView.qml
+++ b/src/controls/ScrollView.qml
@@ -50,6 +50,8 @@ import QtQuick.Controls.Styles 1.1
\ingroup views
\brief Provides a scrolling view within another Item.
+ \image scrollview.png
+
A ScrollView can be used either to replace a \l Flickable or decorate an
existing \l Flickable. Depending on the platform, it will add scroll bars and
a content frame.
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index af5b89cd..94653bf8 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -49,13 +49,15 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief Provides a vertical or horizontal slider control.
+ \image slider.png
+
The slider is the classic control for providing a bounded value. It lets
the user move a slider handle along a horizontal or vertical groove
and translates the handle's position into a value within the legal range.
\code
Slider {
- onValueChanged: print(value)
+ value: 0.5
}
\endcode
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index 5d1268d8..9b6080f9 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -49,6 +49,8 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief Provides a spin box control.
+ \image spinbox.png
+
SpinBox allows the user to choose a value by clicking the up or down buttons, or by
pressing up or down on the keyboard. The user can also type the value in manually.
@@ -162,7 +164,8 @@ Control {
This property indicates whether the control is being hovered.
*/
- readonly property alias hovered: mouseArea.containsMouse
+ readonly property bool hovered: mouseArea.containsMouse || cursorArea.containsMouse
+ || mouseUp.containsMouse || mouseDown.containsMouse
/*!
\qmlsignal SpinBox::editingFinished()
@@ -289,6 +292,14 @@ Control {
function selectValue() {
select(prefix.length, text.length - suffix.length)
}
+
+ MouseArea {
+ id: cursorArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.IBeamCursor
+ acceptedButtons: Qt.NoButton
+ }
}
// Spinbox increment button
diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml
index 93f0a7e3..f4360746 100644
--- a/src/controls/SplitView.qml
+++ b/src/controls/SplitView.qml
@@ -51,6 +51,8 @@ import QtQuick.Window 2.1
\ingroup views
\brief Lays out items with a draggable splitter between each item.
+ \image splitview.png
+
SplitView is a control that lays out items horizontally or
vertically with a draggable splitter between each item.
@@ -92,26 +94,39 @@ import QtQuick.Window 2.1
could do the following:
\qml
- SplitView {
- anchors.fill: parent
- orientation: Qt.Horizontal
-
- Rectangle {
- width: 200
- Layout.maximumWidth: 400
- color: "gray"
- }
- Rectangle {
- id: centerItem
- Layout.minimumWidth: 50
- Layout.fillWidth: true
- color: "darkgray"
- }
- Rectangle {
- width: 200
- color: "gray"
- }
- }
+ SplitView {
+ anchors.fill: parent
+ orientation: Qt.Horizontal
+
+ Rectangle {
+ width: 200
+ Layout.maximumWidth: 400
+ color: "lightblue"
+ Text {
+ text: "View 1"
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ id: centerItem
+ Layout.minimumWidth: 50
+ Layout.fillWidth: true
+ color: "lightgray"
+ Text {
+ text: "View 2"
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ width: 200
+ color: "lightgreen"
+ Text {
+ text: "View 3"
+ anchors.centerIn: parent
+ }
+ }
+ }
+
\endqml
*/
diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml
index 2f3d5753..bd9c4de9 100644
--- a/src/controls/StackView.qml
+++ b/src/controls/StackView.qml
@@ -51,11 +51,36 @@ import QtQuick.Controls.Private 1.0
\brief Provides a stack-based navigation model.
+ \image stackview.png
+
StackView implements a stack-based navigation model, which can be used
with a set of interlinked information pages. Items are pushed onto the stack
as the user navigates deeper into the material, and popped off again when he
chooses to go back.
+ The \l{Qt Quick Controls - Touch Gallery}{touch gallery} example is a good
+ starting point to understand how StackView works. The following snippet
+ from the example shows how it can be used:
+
+ \qml
+ StackView {
+ id: stack
+ initialItem: view
+
+ Component {
+ id: view
+
+ MouseArea {
+ Text {
+ text: stack.depth
+ anchors.centerIn: parent
+ }
+ onClicked: stack.push(view)
+ }
+ }
+ }
+ \endqml
+
\section1 Using StackView in an Application
Using the StackView in the application is typically a simple matter of adding
the StackView as a child of a Window. The stack is usually anchored to the
diff --git a/src/controls/Switch.qml b/src/controls/Switch.qml
index 639610bf..f4ca3c34 100644
--- a/src/controls/Switch.qml
+++ b/src/controls/Switch.qml
@@ -49,7 +49,10 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief A switch.
- A Switch is an option button that can be switched on (checked) or off
+ \image switch.png
+ \caption On and Off states of a Switch.
+
+ A Switch is a toggle button that can be switched on (checked) or off
(unchecked). Switches are typically used to represent features in an
application that can be enabled or disabled without affecting others.
diff --git a/src/controls/Tab.qml b/src/controls/Tab.qml
index 8957806a..355fb44a 100644
--- a/src/controls/Tab.qml
+++ b/src/controls/Tab.qml
@@ -49,6 +49,8 @@ import QtQuick 2.2
A Tab item inherits from Loader and provides a similar
api.
+
+ \sa TabView
*/
Loader {
diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml
index 5787e3c4..71dc9b26 100644
--- a/src/controls/TabView.qml
+++ b/src/controls/TabView.qml
@@ -49,8 +49,33 @@ import QtQuick.Controls.Private 1.0
\ingroup views
\brief A control that allows the user to select one of multiple stacked items.
- You can create a custom appearance for a TabView by
+ \image tabview.png
+
+ TabView provides tab-based navigation model for your application.
+ For example, the following snippet uses tabs to present rectangles of
+ different color on each tab page:
+
+ \qml
+ TabView {
+ Tab {
+ title: "Red"
+ Rectangle { color: "red" }
+ }
+ Tab {
+ title: "Blue"
+ Rectangle { color: "blue" }
+ }
+ Tab {
+ title: "Green"
+ Rectangle { color: "green" }
+ }
+ }
+ \endqml
+
+ \note You can create a custom appearance for a TabView by
assigning a \l {QtQuick.Controls.Styles::TabViewStyle}{TabViewStyle}.
+
+ \l Tab represents the content of a tab in a TabView.
*/
FocusScope {
diff --git a/src/controls/TableViewColumn.qml b/src/controls/TableViewColumn.qml
index 931d32da..75565e4b 100644
--- a/src/controls/TableViewColumn.qml
+++ b/src/controls/TableViewColumn.qml
@@ -46,6 +46,21 @@ import QtQuick 2.2
\since 5.1
\ingroup viewitems
\brief Used to define columns in a \l TableView.
+
+ \image tableview.png
+
+ TableViewColumn represents a column within a TableView. It provides
+ properties to decide how the data in that column is presented.
+
+ \qml
+ TableView {
+ TableViewColumn { role: "title"; title: "Title"; width: 100 }
+ TableViewColumn { role: "author"; title: "Author"; width: 200 }
+ model: libraryModel
+ }
+ \endqml
+
+ \sa TableView
*/
QtObject {
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml
index d09b6d02..356b31ab 100644
--- a/src/controls/TextArea.qml
+++ b/src/controls/TextArea.qml
@@ -48,12 +48,18 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief Displays multiple lines of editable formatted text.
+ \image textarea.png
+
It can display both plain and rich text. For example:
\qml
TextArea {
width: 240
- text: "<b>Hello</b> <i>World!</i>"
+ text:
+ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
+ "sed do eiusmod tempor incididunt ut labore et dolore magna " +
+ "aliqua. Ut enim ad minim veniam, quis nostrud exercitation " +
+ "ullamco laboris nisi ut aliquip ex ea commodo cosnsequat. ";
}
\endqml
@@ -249,7 +255,7 @@ ScrollView {
\li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
\endlist
*/
- property alias inputMethodHints: edit.inputMethodHints
+ property int inputMethodHints: edit.inputMethodHints || Qt.ImhNone
/*!
\qmlproperty int TextArea::length
diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml
index dfadd78d..f74c6ed0 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -49,11 +49,19 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief Displays a single line of editable plain text.
+ \image textfield.png
+
TextField is used to accept a line of text input. Input constraints can be
placed on a TextField item (for example, through a \l validator or \l
inputMask). Setting \l echoMode to an appropriate value enables
TextField to be used for a password input field.
+ \qml
+ TextField {
+ placeholderText: qsTr("Enter name")
+ }
+ \endqml
+
You can create a custom appearance for a TextField by
assigning a \l {QtQuick.Controls.Styles::TextFieldStyle}{TextFieldStyle}.
@@ -293,7 +301,7 @@ Control {
\li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.
\endlist
*/
- property alias inputMethodHints: textInput.inputMethodHints
+ property int inputMethodHints: textInput.inputMethodHints || Qt.ImhNone
/*!
\qmlproperty int TextField::length
diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml
index 3430ac2a..8498860c 100644
--- a/src/controls/ToolBar.qml
+++ b/src/controls/ToolBar.qml
@@ -49,6 +49,8 @@ import QtQuick.Controls.Private 1.0
\ingroup applicationwindow
\brief Contains ToolButton and related controls.
+ \image toolbar.png
+
The common way of using ToolBar is in relation to \l ApplicationWindow. It
provides styling and is generally designed to work well with ToolButton as
well as other controls.
@@ -61,16 +63,26 @@ import QtQuick.Controls.Private 1.0
Otherwise the height is platform dependent.
\code
- import QtQuick.Controls 1.2
- import QtQuick.Layouts 1.0
-
ApplicationWindow {
- toolBar: ToolBar {
+ ...
+ toolBar:ToolBar {
RowLayout {
anchors.fill: parent
- ToolButton { ... }
- ToolButton { ... }
- ToolButton { ... }
+ ToolButton {
+ iconSource: "new.png"
+ }
+ ToolButton {
+ iconSource: "open.png"
+ }
+ ToolButton {
+ iconSource: "save-as.png"
+ }
+ Item { Layout.fillWidth: true }
+ CheckBox {
+ text: "Enabled"
+ checked: true
+ Layout.alignment: Qt.AlignRight
+ }
}
}
}
diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml
index 8bc466ea..d688e2b6 100644
--- a/src/controls/ToolButton.qml
+++ b/src/controls/ToolButton.qml
@@ -49,14 +49,34 @@ import QtQuick.Controls.Private 1.0
\ingroup controls
\brief Provides a button type that is typically used within a ToolBar.
- ToolButton is functionally similar to \l {QtQuick.Controls::}{Button}, but
- can provide a look that is more suitable within a \l ToolBar.
+ \image toolbar.png
- \code
- ToolButton {
- iconSource: "edit-cut.png"
- }
- \endcode
+ ToolButton is functionally similar to \l {QtQuick.Controls::}{Button}, but
+ can provide a look that is more suitable within a \l ToolBar.
+
+ \qml
+ ApplicationWindow {
+ ...
+ toolBar:ToolBar {
+ RowLayout {
+ ToolButton {
+ iconSource: "new.png"
+ }
+ ToolButton {
+ iconSource: "open.png"
+ }
+ ToolButton {
+ iconSource: "save-as.png"
+ }
+ Item { Layout.fillWidth: true }
+ CheckBox {
+ text: "Enabled"
+ checked: true
+ }
+ }
+ }
+ }
+ \endqml
You can create a custom appearance for a ToolButton by
assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}.
diff --git a/src/controls/doc/images/applicationwindow.png b/src/controls/doc/images/applicationwindow.png
new file mode 100644
index 00000000..90111f72
--- /dev/null
+++ b/src/controls/doc/images/applicationwindow.png
Binary files differ
diff --git a/src/controls/doc/images/busyindicator.png b/src/controls/doc/images/busyindicator.png
new file mode 100644
index 00000000..99b36f35
--- /dev/null
+++ b/src/controls/doc/images/busyindicator.png
Binary files differ
diff --git a/src/controls/doc/images/button.png b/src/controls/doc/images/button.png
new file mode 100644
index 00000000..f0742d05
--- /dev/null
+++ b/src/controls/doc/images/button.png
Binary files differ
diff --git a/src/controls/doc/images/calendar.png b/src/controls/doc/images/calendar.png
new file mode 100644
index 00000000..a053dae2
--- /dev/null
+++ b/src/controls/doc/images/calendar.png
Binary files differ
diff --git a/src/controls/doc/images/checkbox.png b/src/controls/doc/images/checkbox.png
new file mode 100644
index 00000000..daa7e68d
--- /dev/null
+++ b/src/controls/doc/images/checkbox.png
Binary files differ
diff --git a/src/controls/doc/images/combobox.png b/src/controls/doc/images/combobox.png
new file mode 100644
index 00000000..63a6d3e8
--- /dev/null
+++ b/src/controls/doc/images/combobox.png
Binary files differ
diff --git a/src/controls/doc/images/groupbox.png b/src/controls/doc/images/groupbox.png
new file mode 100644
index 00000000..1a55a521
--- /dev/null
+++ b/src/controls/doc/images/groupbox.png
Binary files differ
diff --git a/src/controls/doc/images/label.png b/src/controls/doc/images/label.png
new file mode 100644
index 00000000..d55331ff
--- /dev/null
+++ b/src/controls/doc/images/label.png
Binary files differ
diff --git a/src/controls/doc/images/menu.png b/src/controls/doc/images/menu.png
new file mode 100644
index 00000000..9d13faed
--- /dev/null
+++ b/src/controls/doc/images/menu.png
Binary files differ
diff --git a/src/controls/doc/images/menubar.png b/src/controls/doc/images/menubar.png
new file mode 100644
index 00000000..6624bbef
--- /dev/null
+++ b/src/controls/doc/images/menubar.png
Binary files differ
diff --git a/src/controls/doc/images/progressbar-intermediate.png b/src/controls/doc/images/progressbar-intermediate.png
new file mode 100644
index 00000000..17ac780b
--- /dev/null
+++ b/src/controls/doc/images/progressbar-intermediate.png
Binary files differ
diff --git a/src/controls/doc/images/progressbar.png b/src/controls/doc/images/progressbar.png
new file mode 100644
index 00000000..eecd874c
--- /dev/null
+++ b/src/controls/doc/images/progressbar.png
Binary files differ
diff --git a/src/controls/doc/images/radiobutton.png b/src/controls/doc/images/radiobutton.png
new file mode 100644
index 00000000..86e0bb81
--- /dev/null
+++ b/src/controls/doc/images/radiobutton.png
Binary files differ
diff --git a/src/controls/doc/images/scrollview.png b/src/controls/doc/images/scrollview.png
new file mode 100644
index 00000000..d43cf2a2
--- /dev/null
+++ b/src/controls/doc/images/scrollview.png
Binary files differ
diff --git a/src/controls/doc/images/slider.png b/src/controls/doc/images/slider.png
new file mode 100644
index 00000000..6a670d6c
--- /dev/null
+++ b/src/controls/doc/images/slider.png
Binary files differ
diff --git a/src/controls/doc/images/spinbox.png b/src/controls/doc/images/spinbox.png
new file mode 100644
index 00000000..438ab1cc
--- /dev/null
+++ b/src/controls/doc/images/spinbox.png
Binary files differ
diff --git a/src/controls/doc/images/splitview.png b/src/controls/doc/images/splitview.png
new file mode 100644
index 00000000..ae725d0d
--- /dev/null
+++ b/src/controls/doc/images/splitview.png
Binary files differ
diff --git a/src/controls/doc/images/stackview.png b/src/controls/doc/images/stackview.png
new file mode 100644
index 00000000..6a9857e6
--- /dev/null
+++ b/src/controls/doc/images/stackview.png
Binary files differ
diff --git a/src/controls/doc/images/switch.png b/src/controls/doc/images/switch.png
new file mode 100644
index 00000000..7e52b686
--- /dev/null
+++ b/src/controls/doc/images/switch.png
Binary files differ
diff --git a/src/controls/doc/images/tableview.png b/src/controls/doc/images/tableview.png
index e7e5e27d..07070e43 100644
--- a/src/controls/doc/images/tableview.png
+++ b/src/controls/doc/images/tableview.png
Binary files differ
diff --git a/src/controls/doc/images/tabview.png b/src/controls/doc/images/tabview.png
new file mode 100644
index 00000000..dbc89c68
--- /dev/null
+++ b/src/controls/doc/images/tabview.png
Binary files differ
diff --git a/src/controls/doc/images/textarea.png b/src/controls/doc/images/textarea.png
new file mode 100644
index 00000000..7de2a968
--- /dev/null
+++ b/src/controls/doc/images/textarea.png
Binary files differ
diff --git a/src/controls/doc/images/textfield.png b/src/controls/doc/images/textfield.png
new file mode 100644
index 00000000..1326e6a3
--- /dev/null
+++ b/src/controls/doc/images/textfield.png
Binary files differ
diff --git a/src/controls/doc/images/toolbar.png b/src/controls/doc/images/toolbar.png
new file mode 100644
index 00000000..9f9204b6
--- /dev/null
+++ b/src/controls/doc/images/toolbar.png
Binary files differ
diff --git a/src/controls/qquickaction.cpp b/src/controls/qquickaction.cpp
index 3d13f90b..12f5e504 100644
--- a/src/controls/qquickaction.cpp
+++ b/src/controls/qquickaction.cpp
@@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\brief Action provides an abstract user interface action that can be bound to items
+ \image menubar.png
+
In applications many common commands can be invoked via menus, toolbar buttons, and keyboard
shortcuts. Since the user expects each command to be performed in the same way, regardless of
the user interface used, it is useful to represent each command as an \e action.
@@ -68,18 +70,11 @@ QT_BEGIN_NAMESPACE
QtQuick Controls supports actions in \l {QtQuick.Controls::}{Button}, \l ToolButton, and \l MenuItem.
- Example:
- \qml
- Action {
- id: openAction
- text: "&Open"
- shortcut: "Ctrl+O"
- iconSource: "images/document-open.png"
- onTriggered: fileDialog.open()
- tooltip: "Open an Image"
- }
- \endqml
-
+ \quotefromfile gallery/main.qml
+ \dots
+ \skipto Action
+ \printto SystemPalette
+ \dots
*/
/*!
diff --git a/src/controls/qquickexclusivegroup.cpp b/src/controls/qquickexclusivegroup.cpp
index 7e991123..ba844ef3 100644
--- a/src/controls/qquickexclusivegroup.cpp
+++ b/src/controls/qquickexclusivegroup.cpp
@@ -97,34 +97,32 @@ static bool isChecked(const QObject *o)
}
\endcode
- Several controls already support ExclusiveGroup, e.g. \l Action, \l MenuItem, \l {QtQuick.Controls::}{Button}, and \l RadioButton.
+ Several controls already support ExclusiveGroup, e.g. \l Action,
+ \l MenuItem, \l {QtQuick.Controls::}{Button}, and \l RadioButton.
- Since ExclusiveGroup only supports \l Action as child items, we need to manually assign the \c exclusiveGroup
- property for other objects.
+ As ExclusiveGroup only supports \l Action as child items, we need to manually
+ assign the \c exclusiveGroup property for other objects.
\code
- ExclusiveGroup { id: textAlignmentGroup }
-
- Menu {
- MenuItem {
- text: "Alignt Left"
- checkable: true
- exclusiveGroup: textAlignmentGroup
- }
- MenuItem {
- text: "Alignt Right"
- checkable: true
- exclusiveGroup: textAlignmentGroup
- }
- MenuItem {
- text: "Center"
- checkable: true
- exclusiveGroup: textAlignmentGroup
- }
- MenuItem {
- text: "Justify"
- checkable: true
- exclusiveGroup: textAlignmentGroup
+ GroupBox {
+ id: group2
+ title: qsTr("Tab Position")
+ Layout.fillWidth: true
+ RowLayout {
+ ExclusiveGroup { id: tabPositionGroup }
+ RadioButton {
+ id: topButton
+ text: qsTr("Top")
+ checked: true
+ exclusiveGroup: tabPositionGroup
+ Layout.minimumWidth: 100
+ }
+ RadioButton {
+ id: bottomButton
+ text: qsTr("Bottom")
+ exclusiveGroup: tabPositionGroup
+ Layout.minimumWidth: 100
+ }
}
}
\endcode
diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp
index c12060bf..3ae9b5e0 100644
--- a/src/controls/qquickmenu.cpp
+++ b/src/controls/qquickmenu.cpp
@@ -51,6 +51,7 @@
#include <QtGui/qpa/qplatformtheme.h>
#include <QtGui/qpa/qplatformmenu.h>
#include <qquickitem.h>
+#include <QtQuick/private/qquickrendercontrol_p.h>
QT_BEGIN_NAMESPACE
@@ -395,7 +396,11 @@ void QQuickMenu::__popup(qreal x, qreal y, int atItemIndex)
QQuickMenuBase *atItem = menuItemAtIndex(atItemIndex);
- QQuickWindow *parentWindow = findParentWindow();
+ QQuickWindow *quickWindow = findParentWindow();
+ QWindow *parentWindow = quickWindow;
+ QWindow *renderWindow = QQuickRenderControl::renderWindowFor(static_cast<QQuickWindow *>(parentWindow));
+ if (renderWindow)
+ parentWindow = renderWindow; // may not be a QQuickWindow anymore (happens when using QQuickWidget)
if (m_platformMenu) {
QPointF screenPosition(x + m_xOffset, y + m_yOffset);
@@ -410,7 +415,7 @@ void QQuickMenu::__popup(qreal x, qreal y, int atItemIndex)
if (visualItem())
m_popupWindow->setParentItem(visualItem());
else
- m_popupWindow->setParentWindow(parentWindow);
+ m_popupWindow->setParentWindow(parentWindow, quickWindow);
m_popupWindow->setPopupContentItem(m_menuContentItem);
m_popupWindow->setItemAt(atItem ? atItem->visualItem() : 0);
diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp
index 0167bebd..ef048e82 100644
--- a/src/controls/qquickmenuitem.cpp
+++ b/src/controls/qquickmenuitem.cpp
@@ -142,6 +142,38 @@ void QQuickMenuBase::setVisualItem(QQuickItem *item)
\ingroup menus
\brief MenuSeparator provides a separator for items inside a menu.
+ \image menu.png
+
+ \code
+ Menu {
+ text: "Edit"
+
+ MenuItem {
+ text: "Cut"
+ shortcut: "Ctrl+X"
+ onTriggered: ...
+ }
+
+ MenuItem {
+ text: "Copy"
+ shortcut: "Ctrl+C"
+ onTriggered: ...
+ }
+
+ MenuItem {
+ text: "Paste"
+ shortcut: "Ctrl+V"
+ onTriggered: ...
+ }
+ MenuSeparator { }
+ MenuItem {
+ text: "Do Nothing"
+ shortcut: "Ctrl+E,Shift+Ctrl+X"
+ enabled: false
+ }
+ }
+ \endcode
+
\sa Menu, MenuItem
*/
@@ -259,6 +291,8 @@ void QQuickMenuText::updateIcon()
\inqmlmodule QtQuick.Controls
\brief MenuItem provides an item to add in a menu or a menu bar.
+ \image menu.png
+
\code
Menu {
text: "Edit"
diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp
index 6a2a03bc..c8483d63 100644
--- a/src/controls/qquickmenupopupwindow.cpp
+++ b/src/controls/qquickmenupopupwindow.cpp
@@ -64,8 +64,11 @@ void QQuickMenuPopupWindow::show()
void QQuickMenuPopupWindow::setParentItem(QQuickItem *item)
{
QQuickPopupWindow::setParentItem(item);
- if (item)
- setParentWindow(item->window());
+ if (item) {
+ QWindow *parentWindow = item->window();
+ QWindow *renderWindow = QQuickRenderControl::renderWindowFor(static_cast<QQuickWindow *>(parentWindow));
+ setParentWindow(renderWindow ? renderWindow : parentWindow, item->window());
+ }
}
void QQuickMenuPopupWindow::setItemAt(QQuickItem *menuItem)
@@ -83,12 +86,10 @@ void QQuickMenuPopupWindow::setItemAt(QQuickItem *menuItem)
}
}
-void QQuickMenuPopupWindow::setParentWindow(QQuickWindow *parentWindow)
+void QQuickMenuPopupWindow::setParentWindow(QWindow *effectiveParentWindow, QQuickWindow *parentWindow)
{
- QWindow *proxyWindow = QQuickRenderControl::renderWindowFor(parentWindow);
- QWindow *renderWindow = proxyWindow ? proxyWindow : parentWindow;
- if (transientParent() != renderWindow)
- setTransientParent(renderWindow);
+ if (transientParent() != effectiveParentWindow)
+ setTransientParent(effectiveParentWindow);
if (parentWindow) {
connect(parentWindow, SIGNAL(destroyed()), this, SLOT(dismissPopup()));
if (QQuickMenuPopupWindow *pw = qobject_cast<QQuickMenuPopupWindow *>(parentWindow))
diff --git a/src/controls/qquickmenupopupwindow_p.h b/src/controls/qquickmenupopupwindow_p.h
index 1e824bea..a550daa2 100644
--- a/src/controls/qquickmenupopupwindow_p.h
+++ b/src/controls/qquickmenupopupwindow_p.h
@@ -53,7 +53,7 @@ public:
QQuickMenuPopupWindow();
void setItemAt(QQuickItem *menuItem);
- void setParentWindow(QQuickWindow *parentWindow);
+ void setParentWindow(QWindow *effectiveParentWindow, QQuickWindow *parentWindow);
void setGeometry(int posx, int posy, int w, int h);
void setParentItem(QQuickItem *);
diff --git a/tests/auto/controls/data/tst_gridlayout.qml b/tests/auto/controls/data/tst_gridlayout.qml
index a595cca1..e3d9a66b 100644
--- a/tests/auto/controls/data/tst_gridlayout.qml
+++ b/tests/auto/controls/data/tst_gridlayout.qml
@@ -53,11 +53,6 @@ Item {
width: 200
height: 200
- function itemRect(item)
- {
- return [item.x, item.y, item.width, item.height];
- }
-
Component {
id: layout_flow_Component
GridLayout {
@@ -67,6 +62,7 @@ Item {
Repeater {
model: 6
Rectangle {
+ property var itemRect: [x, y, width, height]
color: "red"
Layout.preferredWidth: 10
Layout.preferredHeight: 10
@@ -79,23 +75,25 @@ Item {
function test_flow()
{
var layout = layout_flow_Component.createObject(container);
- compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[1]), [10, 0, 10, 10])
- compare(itemRect(layout.children[2]), [20, 0, 10, 10])
- compare(itemRect(layout.children[3]), [30, 0, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [10, 0, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [20, 0, 10, 10])
+ tryCompare(layout.children[3], "itemRect", [30, 0, 10, 10])
- compare(itemRect(layout.children[4]), [ 0, 10, 10, 10])
- compare(itemRect(layout.children[5]), [10, 10, 10, 10])
+ tryCompare(layout.children[4], "itemRect", [ 0, 10, 10, 10])
+ tryCompare(layout.children[5], "itemRect", [10, 10, 10, 10])
layout.rows = 4
layout.flow = GridLayout.TopToBottom
- compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[1]), [ 0, 10, 10, 10])
- compare(itemRect(layout.children[2]), [ 0, 20, 10, 10])
- compare(itemRect(layout.children[3]), [ 0, 30, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [ 0, 10, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [ 0, 20, 10, 10])
+ tryCompare(layout.children[3], "itemRect", [ 0, 30, 10, 10])
+
+ tryCompare(layout.children[4], "itemRect", [10, 0, 10, 10])
+ tryCompare(layout.children[5], "itemRect", [10, 10, 10, 10])
- compare(itemRect(layout.children[4]), [10, 0, 10, 10])
- compare(itemRect(layout.children[5]), [10, 10, 10, 10])
+ layout.destroy()
}
Component {
@@ -493,6 +491,7 @@ Item {
rowSpacing: 0
Rectangle {
// First one should auto position itself at (0,0)
+ property var itemRect: [x, y, width, height]
color: "red"
Layout.preferredWidth: 20
Layout.preferredHeight: 20
@@ -501,6 +500,7 @@ Item {
}
Rectangle {
// (0,1)
+ property var itemRect: [x, y, width, height]
color: "red"
Layout.preferredWidth: 20
Layout.preferredHeight: 20
@@ -508,6 +508,7 @@ Item {
}
Rectangle {
// (1,0)
+ property var itemRect: [x, y, width, height]
color: "red"
Layout.preferredWidth: 20
Layout.preferredHeight: 20
@@ -515,6 +516,7 @@ Item {
}
Rectangle {
// (1,1)
+ property var itemRect: [x, y, width, height]
color: "red"
Layout.preferredWidth: 10
Layout.preferredHeight: 10
@@ -522,6 +524,7 @@ Item {
}
Rectangle {
// (2,0)
+ property var itemRect: [x, y, width, height]
color: "red"
Layout.preferredWidth: 30
Layout.preferredHeight: 30
@@ -530,6 +533,7 @@ Item {
}
Rectangle {
// (3,0)
+ property var itemRect: [x, y, width, height]
baselineOffset: 7
color: "red"
Layout.row: 3
@@ -540,6 +544,7 @@ Item {
}
Rectangle {
// (3,1)
+ property var itemRect: [x, y, width, height]
baselineOffset: 7
color: "red"
Layout.preferredWidth: 10
@@ -556,13 +561,14 @@ Item {
layout.width = 60;
layout.height = 100;
- compare(itemRect(layout.children[0]), [ 0, 0, 40, 40]);
- compare(itemRect(layout.children[1]), [40, 20, 20, 20]);
- compare(itemRect(layout.children[2]), [20, 40, 20, 20]);
- compare(itemRect(layout.children[3]), [45, 40, 10, 10]);
- compare(itemRect(layout.children[4]), [30, 60, 30, 30]);
- compare(itemRect(layout.children[5]), [ 0, 90, 10, 10]);
- compare(itemRect(layout.children[6]), [50, 90, 10, 10]);
+
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 40, 40]);
+ tryCompare(layout.children[1], "itemRect", [40, 20, 20, 20]);
+ tryCompare(layout.children[2], "itemRect", [20, 40, 20, 20]);
+ tryCompare(layout.children[3], "itemRect", [45, 40, 10, 10]);
+ tryCompare(layout.children[4], "itemRect", [30, 60, 30, 30]);
+ tryCompare(layout.children[5], "itemRect", [ 0, 90, 10, 10]);
+ tryCompare(layout.children[6], "itemRect", [50, 90, 10, 10]);
layout.children[1].Layout.alignment = Qt.AlignTop
@@ -593,18 +599,21 @@ Item {
rowSpacing: 0
columns: 3
Rectangle {
+ property var itemRect: [x, y, width, height]
color: "#cbffc4"
Layout.preferredWidth: 50
Layout.preferredHeight: 50
Layout.alignment: Qt.AlignCenter
}
Rectangle {
+ property var itemRect: [x, y, width, height]
color: "#c4d1ff"
Layout.preferredWidth: 50
Layout.preferredHeight: 50
Layout.alignment: Qt.AlignRight
}
Rectangle {
+ property var itemRect: [x, y, width, height]
color: "#ffd5c4"
Layout.preferredWidth: 50
Layout.preferredHeight: 50
@@ -615,16 +624,16 @@ Item {
function verifyIsRightToLeft(layout)
{
- compare(itemRect(layout.children[0]), [125, 0, 50, 50]);
- compare(itemRect(layout.children[1]), [60, 0, 50, 50]);
- compare(itemRect(layout.children[2]), [10, 0, 50, 50]);
+ tryCompare(layout.children[0], "itemRect", [125, 0, 50, 50]);
+ tryCompare(layout.children[1], "itemRect", [60, 0, 50, 50]);
+ tryCompare(layout.children[2], "itemRect", [10, 0, 50, 50]);
}
function verifyIsLeftToRight(layout)
{
- compare(itemRect(layout.children[0]), [5, 0, 50, 50]);
- compare(itemRect(layout.children[1]), [70, 0, 50, 50]);
- compare(itemRect(layout.children[2]), [120, 0, 50, 50]);
+ tryCompare(layout.children[0], "itemRect", [5, 0, 50, 50]);
+ tryCompare(layout.children[1], "itemRect", [70, 0, 50, 50]);
+ tryCompare(layout.children[2], "itemRect", [120, 0, 50, 50]);
}
function test_rightToLeft()
@@ -637,30 +646,23 @@ Item {
verifyIsRightToLeft(layout)
layout.LayoutMirroring.enabled = true
layout.layoutDirection = Qt.LeftToRight
- waitForRendering(layout)
verifyIsRightToLeft(layout)
-
// Left To Right
layout.LayoutMirroring.enabled = false
layout.layoutDirection = Qt.LeftToRight
- waitForRendering(layout)
verifyIsLeftToRight(layout);
layout.LayoutMirroring.enabled = true
layout.layoutDirection = Qt.RightToLeft
- waitForRendering(layout)
verifyIsLeftToRight(layout);
layout.LayoutMirroring.enabled = false
- waitForRendering(layout)
verifyIsRightToLeft(layout)
layout.layoutDirection = Qt.LeftToRight
- waitForRendering(layout)
verifyIsLeftToRight(layout);
layout.LayoutMirroring.enabled = true
- waitForRendering(layout)
verifyIsRightToLeft(layout)
layout.destroy();
@@ -675,6 +677,7 @@ Item {
Repeater {
model: 4
Rectangle {
+ property var itemRect: [x, y, width, height]
width: 10
height: 10
color: "#ff0000"
@@ -688,18 +691,18 @@ Item {
var layout = layout_columnsOrRowsChanged_Component.createObject(container);
layout.width = 40;
layout.height = 20;
- waitForRendering(layout)
- compare(itemRect(layout.children[0]), [ 0, 5, 10, 10])
- compare(itemRect(layout.children[1]), [10, 5, 10, 10])
- compare(itemRect(layout.children[2]), [20, 5, 10, 10])
- compare(itemRect(layout.children[3]), [30, 5, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 5, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [10, 5, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [20, 5, 10, 10])
+ tryCompare(layout.children[3], "itemRect", [30, 5, 10, 10])
layout.columns = 2
- waitForRendering(layout)
- compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[1]), [20, 0, 10, 10])
- compare(itemRect(layout.children[2]), [ 0, 10, 10, 10])
- compare(itemRect(layout.children[3]), [20, 10, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [20, 0, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [ 0, 10, 10, 10])
+ tryCompare(layout.children[3], "itemRect", [20, 10, 10, 10])
+
+ layout.destroy()
}
function test_rowsChanged()
@@ -708,18 +711,18 @@ Item {
layout.flow = GridLayout.TopToBottom
layout.width = 20;
layout.height = 40;
- waitForRendering(layout)
- compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[1]), [ 0, 10, 10, 10])
- compare(itemRect(layout.children[2]), [ 0, 20, 10, 10])
- compare(itemRect(layout.children[3]), [ 0, 30, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [ 0, 10, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [ 0, 20, 10, 10])
+ tryCompare(layout.children[3], "itemRect", [ 0, 30, 10, 10])
layout.rows = 2
- waitForRendering(layout)
- compare(itemRect(layout.children[0]), [ 0, 5, 10, 10])
- compare(itemRect(layout.children[1]), [ 0, 25, 10, 10])
- compare(itemRect(layout.children[2]), [10, 5, 10, 10])
- compare(itemRect(layout.children[3]), [10, 25, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 5, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [ 0, 25, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [10, 5, 10, 10])
+ tryCompare(layout.children[3], "itemRect", [10, 25, 10, 10])
+
+ layout.destroy()
}
Component {
@@ -729,18 +732,21 @@ Item {
rowSpacing: 0
columnSpacing: 0
Rectangle {
+ property var itemRect: [x, y, width, height]
width: 10
height: 10
Layout.column: 0
color: "#ff0000"
}
Rectangle {
+ property var itemRect: [x, y, width, height]
Layout.column: 1
width: 10
height: 10
color: "#ff0000"
}
Rectangle {
+ property var itemRect: [x, y, width, height]
//Layout.column: 2
width: 10
height: 10
@@ -754,35 +760,33 @@ Item {
var layout = layout_columnOrRowChanged_Component.createObject(container);
layout.width = layout.implicitWidth
layout.height = layout.implicitHeight
- waitForRendering(layout)
// c0-c1-c2
- compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[1]), [10, 0, 10, 10])
- compare(itemRect(layout.children[2]), [20, 0, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [10, 0, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [20, 0, 10, 10])
layout.children[0].Layout.column = 3
- waitForRendering(layout)
//c1-c2-c0
- compare(itemRect(layout.children[0]), [20, 0, 10, 10])
- compare(itemRect(layout.children[1]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[2]), [10, 0, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [20, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [10, 0, 10, 10])
layout.children[2].Layout.column = 4
- waitForRendering(layout)
//c1-c0-c2
- compare(itemRect(layout.children[0]), [10, 0, 10, 10])
- compare(itemRect(layout.children[1]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[2]), [20, 0, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [10, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [20, 0, 10, 10])
layout.children[0].Layout.row = 1
// two rows, so we adjust it to its new implicitHeight
layout.height = layout.implicitHeight
- waitForRendering(layout)
//c1 c2
// c0
- compare(itemRect(layout.children[0]), [10, 10, 10, 10])
- compare(itemRect(layout.children[1]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[2]), [20, 0, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [10, 10, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[2], "itemRect", [20, 0, 10, 10])
+
+ layout.destroy()
}
Component {
@@ -791,11 +795,13 @@ Item {
id: layout
columnSpacing: 0
Rectangle {
+ property var itemRect: [x, y, width, height]
implicitWidth: 10
implicitHeight: 10
baselineOffset: 10
}
Rectangle {
+ property var itemRect: [x, y, width, height]
implicitWidth: 10
implicitHeight: 10
}
@@ -804,18 +810,16 @@ Item {
function test_baselines()
{
var layout = layout_baselines_Component.createObject(container);
- waitForRendering(layout)
- compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[1]), [10, 0, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [10, 0, 10, 10])
compare(layout.implicitWidth, 20)
compare(layout.implicitHeight, 10)
-
layout.children[0].Layout.alignment = Qt.AlignBaseline
layout.children[1].Layout.alignment = Qt.AlignBaseline
- compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[1]), [10, 10, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [10, 10, 10, 10])
compare(layout.implicitWidth, 20)
compare(layout.implicitHeight, 20)
@@ -829,6 +833,7 @@ Item {
Repeater {
model: 2
Rectangle {
+ property var itemRect: [x, y, width, height]
implicitWidth: 10
implicitHeight: 10
}
@@ -839,7 +844,6 @@ Item {
function test_spacings()
{
var layout = layout_spacings_Component.createObject(container);
- waitForRendering(layout)
// breaks down below -19. This is acceptable, since it means that the implicit size of the layout is negative
var testSpacings = [Number.NaN, 0, 10, -5, -19]
@@ -851,8 +855,8 @@ Item {
} else {
layout.columnSpacing = sp
}
- compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
- compare(itemRect(layout.children[1]), [10 + sp, 0, 10, 10])
+ tryCompare(layout.children[0], "itemRect", [ 0, 0, 10, 10])
+ tryCompare(layout.children[1], "itemRect", [10 + sp, 0, 10, 10])
compare(layout.implicitWidth, 20 + sp)
}