summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Olszak <olszak.tomasz@gmail.com>2014-01-28 21:18:12 +0100
committerTomasz Olszak <olszak.tomasz@gmail.com>2014-01-28 23:22:16 +0100
commitf0a4d0200d64ebc4b0d868e0f47f799450f50f6d (patch)
tree8353a365ed9919d602f8abbb3216cc282f8feb9b
parentb59d76a92e51d8f3856dc8b0ec2dee2d13e4e14a (diff)
parent17788ca8f0d6fe4fb0d03e99e34ed667fde54379 (diff)
downloadqtquickcontrols-f0a4d0200d64ebc4b0d868e0f47f799450f50f6d.tar.gz
qtquickcontrols-f0a4d0200d64ebc4b0d868e0f47f799450f50f6d.tar.bz2
qtquickcontrols-f0a4d0200d64ebc4b0d868e0f47f799450f50f6d.zip
Merge remote-tracking branch 'origin/stable' into wip/tizen
Change-Id: I6a4b4e546a726b2719f607da7219f1f40cba1167
-rw-r--r--.qmake.conf2
-rw-r--r--src/controls/ComboBox.qml3
-rw-r--r--src/controls/Private/qquickstyleitem.cpp4
-rw-r--r--src/controls/SpinBox.qml2
-rw-r--r--src/controls/StackView.qml4
-rw-r--r--src/controls/Styles/Base/ComboBoxStyle.qml11
-rw-r--r--src/controls/Styles/Desktop/ComboBoxStyle.qml2
-rw-r--r--src/controls/Styles/Desktop/SpinBoxStyle.qml5
-rw-r--r--src/controls/TextArea.qml2
-rw-r--r--src/controls/TextField.qml4
-rw-r--r--src/layouts/qgridlayoutengine.cpp1
-rw-r--r--src/layouts/qquicklinearlayout.cpp12
-rw-r--r--tests/auto/controls/data/combobox/cb_keys.qml62
-rw-r--r--tests/auto/controls/data/spinbox/sb_keys.qml63
-rw-r--r--tests/auto/controls/data/textarea/ta_keys.qml62
-rw-r--r--tests/auto/controls/data/textfield/tf_keys.qml62
-rw-r--r--tests/auto/controls/data/tst_combobox.qml32
-rw-r--r--tests/auto/controls/data/tst_gridlayout.qml41
-rw-r--r--tests/auto/controls/data/tst_rowlayout.qml36
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml32
-rw-r--r--tests/auto/controls/data/tst_textarea.qml32
-rw-r--r--tests/auto/controls/data/tst_textfield.qml32
22 files changed, 485 insertions, 21 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 45d05b25..5d8fd36b 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,3 @@
load(qt_build_config)
-MODULE_VERSION = 5.2.1
+MODULE_VERSION = 5.2.2
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 74def897..4a9ce967 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -348,7 +348,7 @@ Control {
anchors.fill: parent
anchors.leftMargin: 8
- anchors.rightMargin: __style.drowDownButtonWidth
+ anchors.rightMargin: __style.dropDownButtonWidth
verticalAlignment: Text.AlignVCenter
@@ -427,6 +427,7 @@ Control {
}
property bool allowComplete: false
+ Keys.forwardTo: comboBox
Keys.onPressed: allowComplete = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete);
onTextChanged: {
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index c290bc28..d45f4e7b 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -601,6 +601,7 @@ void QQuickStyleItem::initStyleOption()
QStyleOptionSpinBox *opt = qstyleoption_cast<QStyleOptionSpinBox*>(m_styleoption);
opt->frame = true;
+ opt->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField;
if (value() & 0x1)
opt->activeSubControls = QStyle::SC_SpinBoxUp;
else if (value() & (1<<1))
@@ -919,6 +920,9 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
frame.rect = m_styleoption->rect;
frame.styleObject = this;
size = qApp->style()->sizeFromContents(QStyle::CT_LineEdit, &frame, QSize(width, height));
+ if (m_itemType == SpinBox)
+ size.setWidth(qApp->style()->sizeFromContents(QStyle::CT_SpinBox,
+ m_styleoption, QSize(width + 2, height)).width());
}
break;
case GroupBox: {
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index 4dc03d97..8fc964a0 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -268,6 +268,8 @@ Control {
selectValue()
}
+ Keys.forwardTo: spinbox
+
onEditingFinished: spinbox.editingFinished()
color: __panel ? __panel.foregroundColor : "black"
diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml
index 18f77d2e..d8089174 100644
--- a/src/controls/StackView.qml
+++ b/src/controls/StackView.qml
@@ -290,7 +290,7 @@ import QtQuick.Controls.Private 1.0
properties.exitItem.opacity = 1
}
- property Component pushTransition: StackViewTransition {
+ pushTransition: StackViewTransition {
PropertyAnimation {
target: enterItem
property: "opacity"
@@ -328,7 +328,7 @@ import QtQuick.Controls.Private 1.0
properties.exitItem.rotation = 0
}
- property Component pushTransition: StackViewTransition {
+ pushTransition: StackViewTransition {
SequentialAnimation {
ScriptAction {
script: enterItem.rotation = 90
diff --git a/src/controls/Styles/Base/ComboBoxStyle.qml b/src/controls/Styles/Base/ComboBoxStyle.qml
index 2b4b237d..ee72a1f1 100644
--- a/src/controls/Styles/Base/ComboBoxStyle.qml
+++ b/src/controls/Styles/Base/ComboBoxStyle.qml
@@ -52,7 +52,7 @@ import QtQuick.Controls.Private 1.0
*/
Style {
-
+ id: style
/*! \internal */
property var __syspal: SystemPalette {
colorGroup: control.enabled ?
@@ -65,7 +65,10 @@ Style {
padding { top: 4 ; left: 6 ; right: 6 ; bottom:4 }
/*! The size of the drop down button when the combobox is editable. */
- property int drowDownButtonWidth: Math.round(TextSingleton.implicitHeight)
+ property int dropDownButtonWidth: Math.round(TextSingleton.implicitHeight)
+
+ /*! \internal Alias kept for backwards compatibility with a spelling mistake in 5.2.0) */
+ property alias drowDownButtonWidth: style.dropDownButtonWidth
/*! This defines the background of the button. */
property Component background: Item {
@@ -100,7 +103,7 @@ Style {
source: "images/arrow-down.png"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
- anchors.rightMargin: drowDownButtonWidth / 2
+ anchors.rightMargin: dropDownButtonWidth / 2
opacity: control.enabled ? 0.6 : 0.3
}
}
@@ -175,7 +178,7 @@ Style {
Loader {
id: editorLoader
anchors.fill: parent
- anchors.rightMargin: drowDownButtonWidth + padding.right
+ anchors.rightMargin: dropDownButtonWidth + padding.right
anchors.bottomMargin: -1
sourceComponent: control.editable ? __editor : null
}
diff --git a/src/controls/Styles/Desktop/ComboBoxStyle.qml b/src/controls/Styles/Desktop/ComboBoxStyle.qml
index b36b4c1d..ef198d5e 100644
--- a/src/controls/Styles/Desktop/ComboBoxStyle.qml
+++ b/src/controls/Styles/Desktop/ComboBoxStyle.qml
@@ -46,7 +46,7 @@ import "." as Desktop
Style {
readonly property ComboBox control: __control
- property int drowDownButtonWidth: 24
+ property int dropDownButtonWidth: 24
property Component panel: Item {
property bool popup: !!styleItem.styleHint("comboboxpopup")
diff --git a/src/controls/Styles/Desktop/SpinBoxStyle.qml b/src/controls/Styles/Desktop/SpinBoxStyle.qml
index 5cf13ea8..18bfec36 100644
--- a/src/controls/Styles/Desktop/SpinBoxStyle.qml
+++ b/src/controls/Styles/Desktop/SpinBoxStyle.qml
@@ -88,11 +88,6 @@ Style {
Item {
id: edit
anchors.fill: parent
- Rectangle {
- color: "white"
- anchors.fill: parent
- anchors.margins: -1
- }
FocusFrame {
anchors.fill: parent
focusMargin:-6
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml
index 72697919..66e7faf6 100644
--- a/src/controls/TextArea.qml
+++ b/src/controls/TextArea.qml
@@ -720,6 +720,8 @@ ScrollView {
selectByMouse: true
readOnly: false
+ Keys.forwardTo: area
+
KeyNavigation.priority: KeyNavigation.BeforeItem
KeyNavigation.tab: area.tabChangesFocus ? area.KeyNavigation.tab : null
KeyNavigation.backtab: area.tabChangesFocus ? area.KeyNavigation.backtab : null
diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml
index 0bd4db1e..d9ba3625 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -303,7 +303,7 @@ Control {
\qmlproperty string TextField::placeholderText
This property contains the text that is shown in the text field when the
- text field is empty and has no focus.
+ text field is empty.
*/
property alias placeholderText: placeholderTextComponent.text
@@ -598,6 +598,8 @@ Control {
renderType: __style ? __style.renderType : Text.NativeRendering
+ Keys.forwardTo: textfield
+
onAccepted: {
Qt.inputMethod.commit()
Qt.inputMethod.hide()
diff --git a/src/layouts/qgridlayoutengine.cpp b/src/layouts/qgridlayoutengine.cpp
index 910e34a0..35aa04f1 100644
--- a/src/layouts/qgridlayoutengine.cpp
+++ b/src/layouts/qgridlayoutengine.cpp
@@ -813,7 +813,6 @@ int QGridLayoutEngine::effectiveLastRow(Qt::Orientation orientation) const
void QGridLayoutEngine::setSpacing(qreal spacing, Qt::Orientations orientations)
{
- Q_ASSERT(spacing >= 0.0);
if (orientations & Qt::Horizontal)
q_defaultSpacings[Hor].setUserValue(spacing);
if (orientations & Qt::Vertical)
diff --git a/src/layouts/qquicklinearlayout.cpp b/src/layouts/qquicklinearlayout.cpp
index 4f776b1f..c15f2ed4 100644
--- a/src/layouts/qquicklinearlayout.cpp
+++ b/src/layouts/qquicklinearlayout.cpp
@@ -499,9 +499,11 @@ void QQuickGridLayoutBase::rearrange(const QSizeF &size)
qSwap(left, right);
*/
+ // Set m_dirty to false in case size hint changes during arrangement.
+ // This could happen if there is a binding like implicitWidth: height
+ QQuickLayout::rearrange(size);
d->engine.setGeometries(QRectF(QPointF(0,0), size));
- QQuickLayout::rearrange(size);
}
bool QQuickGridLayoutBase::shouldIgnoreItem(QQuickItem *child, QQuickLayoutAttached *&info, QSizeF *sizeHints)
@@ -545,7 +547,7 @@ QQuickGridLayout::QQuickGridLayout(QQuickItem *parent /* = 0*/)
\qmlproperty real GridLayout::columnSpacing
This property holds the spacing between each column.
- The default value is \c 4.
+ The default value is \c 5.
*/
qreal QQuickGridLayout::columnSpacing() const
{
@@ -568,7 +570,7 @@ void QQuickGridLayout::setColumnSpacing(qreal spacing)
\qmlproperty real GridLayout::rowSpacing
This property holds the spacing between each row.
- The default value is \c 4.
+ The default value is \c 5.
*/
qreal QQuickGridLayout::rowSpacing() const
{
@@ -843,13 +845,13 @@ QQuickLinearLayout::QQuickLinearLayout(Qt::Orientation orientation,
\qmlproperty real RowLayout::spacing
This property holds the spacing between each cell.
- The default value is \c 4.
+ The default value is \c 5.
*/
/*!
\qmlproperty real ColumnLayout::spacing
This property holds the spacing between each cell.
- The default value is \c 4.
+ The default value is \c 5.
*/
qreal QQuickLinearLayout::spacing() const
diff --git a/tests/auto/controls/data/combobox/cb_keys.qml b/tests/auto/controls/data/combobox/cb_keys.qml
new file mode 100644
index 00000000..0e75fddb
--- /dev/null
+++ b/tests/auto/controls/data/combobox/cb_keys.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+
+Row {
+ width: 100
+ height: 50
+ spacing: 10
+
+ property alias control1: _control1
+ ComboBox {
+ id: _control1
+ editable: true
+ property bool gotit: false
+ Keys.onPressed: {
+ if ((!gotit) && (event.key === Qt.Key_B)) {
+ gotit = true;
+ event.accepted = true;
+ return;
+ }
+ }
+ }
+}
diff --git a/tests/auto/controls/data/spinbox/sb_keys.qml b/tests/auto/controls/data/spinbox/sb_keys.qml
new file mode 100644
index 00000000..39671835
--- /dev/null
+++ b/tests/auto/controls/data/spinbox/sb_keys.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+
+Row {
+ width: 100
+ height: 50
+ spacing: 10
+
+ property alias control1: _control1
+ SpinBox {
+ id: _control1
+ value: 9
+ property bool gotit: false
+ Keys.onPressed: {
+ if ((!gotit) && (event.key === Qt.Key_B)) {
+ gotit = true;
+ value = value - 2;
+ event.accepted = true;
+ return;
+ }
+ }
+ }
+}
diff --git a/tests/auto/controls/data/textarea/ta_keys.qml b/tests/auto/controls/data/textarea/ta_keys.qml
new file mode 100644
index 00000000..e810bbc9
--- /dev/null
+++ b/tests/auto/controls/data/textarea/ta_keys.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+
+Row {
+ width: 100
+ height: 50
+ spacing: 10
+
+ property alias control1: _control1
+ TextArea {
+ id: _control1
+ text: ""
+ property bool gotit: false
+ Keys.onPressed: {
+ if ((!gotit) && (event.key === Qt.Key_B)) {
+ gotit = true;
+ event.accepted = true;
+ return;
+ }
+ }
+ }
+}
diff --git a/tests/auto/controls/data/textfield/tf_keys.qml b/tests/auto/controls/data/textfield/tf_keys.qml
new file mode 100644
index 00000000..4124651d
--- /dev/null
+++ b/tests/auto/controls/data/textfield/tf_keys.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+
+Row {
+ width: 100
+ height: 50
+ spacing: 10
+
+ property alias control1: _control1
+ TextField {
+ id: _control1
+ text: ""
+ property bool gotit: false
+ Keys.onPressed: {
+ if ((!gotit) && (event.key === Qt.Key_B)) {
+ gotit = true;
+ event.accepted = true;
+ return;
+ }
+ }
+ }
+}
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 6758c982..4d5117fb 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -697,5 +697,37 @@ TestCase {
comboBox.destroy()
}
}
+
+ function test_keys() {
+ var component = Qt.createComponent("combobox/cb_keys.qml")
+ compare(component.status, Component.Ready)
+ var test = component.createObject(container);
+ verify(test !== null, "test control created is null")
+ var control1 = test.control1
+ verify(control1 !== null)
+
+ control1.forceActiveFocus()
+ verify(control1.activeFocus)
+
+ verify(control1.gotit === false)
+ verify(control1.editText === "0")
+
+ keyPress(Qt.Key_A)
+ verify(control1.activeFocus)
+ verify(control1.gotit === false)
+ verify(control1.editText === "0a")
+
+ keyPress(Qt.Key_B)
+ verify(control1.activeFocus)
+ verify(control1.gotit === true)
+ verify(control1.editText === "0a")
+
+ keyPress(Qt.Key_B)
+ verify(control1.activeFocus)
+ verify(control1.gotit === true)
+ verify(control1.editText === "0ab")
+
+ test.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_gridlayout.qml b/tests/auto/controls/data/tst_gridlayout.qml
index 7e6240fd..22784aa7 100644
--- a/tests/auto/controls/data/tst_gridlayout.qml
+++ b/tests/auto/controls/data/tst_gridlayout.qml
@@ -786,5 +786,46 @@ Item {
layout.destroy();
}
+
+ Component {
+ id: layout_spacings_Component
+ GridLayout {
+ id: layout
+ Repeater {
+ model: 2
+ Rectangle {
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ }
+ }
+ }
+
+ 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]
+ layout.rowSpacing = 0
+ for (var i = 0; i < testSpacings.length; ++i) {
+ var sp = testSpacings[i]
+ if (isNaN(sp)) {
+ sp = 5 // Test defaults
+ } else {
+ layout.columnSpacing = sp
+ }
+ compare(itemRect(layout.children[0]), [ 0, 0, 10, 10])
+ compare(itemRect(layout.children[1]), [10 + sp, 0, 10, 10])
+ compare(layout.implicitWidth, 20 + sp)
+ }
+
+ // do not crash
+ layout.columnSpacing = -100
+ waitForRendering(layout)
+ verify(isFinite(layout.implicitWidth))
+ layout.destroy();
+ }
}
}
diff --git a/tests/auto/controls/data/tst_rowlayout.qml b/tests/auto/controls/data/tst_rowlayout.qml
index c82a16d4..9db6c803 100644
--- a/tests/auto/controls/data/tst_rowlayout.qml
+++ b/tests/auto/controls/data/tst_rowlayout.qml
@@ -536,6 +536,42 @@ Item {
layout.destroy()
}
+
+ Component {
+ id: layout_change_implicitWidth_during_rearrange
+ ColumnLayout {
+ width: 100
+ height: 20
+ RowLayout {
+ spacing: 0
+ Rectangle {
+ Layout.fillHeight: true
+ Layout.fillWidth: false
+ implicitWidth: height
+ color: "red"
+ }
+ Rectangle {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ color: "blue"
+ }
+ }
+ }
+ }
+
+ function test_change_implicitWidth_during_rearrange() {
+ var layout = layout_change_implicitWidth_during_rearrange.createObject(container)
+ var red = layout.children[0].children[0]
+ var blue = layout.children[0].children[1]
+ waitForRendering(layout);
+ tryCompare(red, 'width', 20)
+ tryCompare(blue, 'width', 80)
+ layout.height = 40
+ tryCompare(red, 'width', 40)
+ tryCompare(blue, 'width', 60)
+ layout.destroy()
+ }
+
Component {
id: layout_addIgnoredItem_Component
RowLayout {
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index 260fc0c1..4a01c6c2 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -645,6 +645,38 @@ Item {
spinbox.destroy()
}
+
+ function test_keys() {
+ var component = Qt.createComponent("spinbox/sb_keys.qml")
+ compare(component.status, Component.Ready)
+ var test = component.createObject(container);
+ verify(test !== null, "test control created is null")
+ var control1 = test.control1
+ verify(control1 !== null)
+
+ control1.forceActiveFocus()
+ verify(control1.activeFocus)
+
+ verify(control1.gotit === false)
+ verify(control1.value === 9)
+
+ keyPress(Qt.Key_A)
+ verify(control1.activeFocus)
+ verify(control1.gotit === false)
+ verify(control1.value === 9)
+
+ keyPress(Qt.Key_B)
+ verify(control1.activeFocus)
+ verify(control1.gotit === true)
+ verify(control1.value === 7)
+
+ keyPress(Qt.Key_B)
+ verify(control1.activeFocus)
+ verify(control1.gotit === true)
+ verify(control1.value === 7)
+
+ test.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 5d0778f1..31239bef 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -155,5 +155,37 @@ TestCase {
verify(!control.control3.activeFocus)
control.destroy()
}
+
+ function test_keys() {
+ var component = Qt.createComponent("textarea/ta_keys.qml")
+ compare(component.status, Component.Ready)
+ var test = component.createObject(container);
+ verify(test !== null, "test control created is null")
+ var control1 = test.control1
+ verify(control1 !== null)
+
+ control1.forceActiveFocus()
+ verify(control1.activeFocus)
+
+ verify(control1.gotit === false)
+ verify(control1.text === "")
+
+ keyPress(Qt.Key_A)
+ verify(control1.activeFocus)
+ verify(control1.gotit === false)
+ verify(control1.text === "a")
+
+ keyPress(Qt.Key_B)
+ verify(control1.activeFocus)
+ verify(control1.gotit === true)
+ verify(control1.text === "a")
+
+ keyPress(Qt.Key_B)
+ verify(control1.activeFocus)
+ verify(control1.gotit === true)
+ verify(control1.text === "ab")
+
+ test.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index a526d1f0..c8f59b7f 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -396,5 +396,37 @@ TestCase {
test.destroy()
}
+
+ function test_keys() {
+ var component = Qt.createComponent("textfield/tf_keys.qml")
+ compare(component.status, Component.Ready)
+ var test = component.createObject(container);
+ verify(test !== null, "test control created is null")
+ var control1 = test.control1
+ verify(control1 !== null)
+
+ control1.forceActiveFocus()
+ verify(control1.activeFocus)
+
+ verify(control1.gotit === false)
+ verify(control1.text === "")
+
+ keyPress(Qt.Key_A)
+ verify(control1.activeFocus)
+ verify(control1.gotit === false)
+ verify(control1.text === "a")
+
+ keyPress(Qt.Key_B)
+ verify(control1.activeFocus)
+ verify(control1.gotit === true)
+ verify(control1.text === "a")
+
+ keyPress(Qt.Key_B)
+ verify(control1.activeFocus)
+ verify(control1.gotit === true)
+ verify(control1.text === "ab")
+
+ test.destroy()
+ }
}
}