diff options
author | Caroline Chao <caroline.chao@digia.com> | 2014-01-22 16:01:44 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-22 16:01:44 +0100 |
commit | b5e1ed76942c1b0feb7a58db5fe9f24ce33e06f2 (patch) | |
tree | 229e431053cc0d2da989005009b1b9c7fcb0c1fa | |
parent | 86ad5273b6fec36cd1f29287918dcbb4b6f7b1e9 (diff) | |
parent | 0f52a81f27e4ab8144e8784f04b190f23a4d49d9 (diff) | |
download | qtquickcontrols-b5e1ed76942c1b0feb7a58db5fe9f24ce33e06f2.tar.gz |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
-rw-r--r-- | src/controls/ComboBox.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/ComboBoxStyle.qml | 10 | ||||
-rw-r--r-- | src/controls/Styles/Desktop/ComboBoxStyle.qml | 2 | ||||
-rw-r--r-- | src/layouts/qquicklinearlayout.cpp | 8 | ||||
-rw-r--r-- | tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml | 6 | ||||
-rw-r--r-- | tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp | 48 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_gridlayout.qml | 41 |
7 files changed, 101 insertions, 16 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index 4161de56..528b0824 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 diff --git a/src/controls/Styles/Base/ComboBoxStyle.qml b/src/controls/Styles/Base/ComboBoxStyle.qml index bbd2e331..f6751b09 100644 --- a/src/controls/Styles/Base/ComboBoxStyle.qml +++ b/src/controls/Styles/Base/ComboBoxStyle.qml @@ -69,7 +69,6 @@ Style { \sa Text::renderType */ property int renderType: Text.NativeRendering - /*! \internal */ property var __syspal: SystemPalette { colorGroup: control.enabled ? @@ -82,7 +81,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 { @@ -117,7 +119,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 } } @@ -192,7 +194,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 c679efec..d1b456b6 100644 --- a/src/controls/Styles/Desktop/ComboBoxStyle.qml +++ b/src/controls/Styles/Desktop/ComboBoxStyle.qml @@ -47,7 +47,7 @@ import "." as Desktop Style { readonly property ComboBox control: __control property int renderType: Text.NativeRendering - property int drowDownButtonWidth: 24 + property int dropDownButtonWidth: 24 property Component panel: Item { property bool popup: !!styleItem.styleHint("comboboxpopup") diff --git a/src/layouts/qquicklinearlayout.cpp b/src/layouts/qquicklinearlayout.cpp index 2e9c3536..d09a07dc 100644 --- a/src/layouts/qquicklinearlayout.cpp +++ b/src/layouts/qquicklinearlayout.cpp @@ -534,7 +534,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 { @@ -556,7 +556,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 { @@ -827,13 +827,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/activeFocusOnTab/data/activeFocusOnTab.qml b/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml index 210d377c..42f785ce 100644 --- a/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml +++ b/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml @@ -85,6 +85,12 @@ Item { objectName: "combobox" model: choices; } + ComboBox { + id: editable_combobox; + objectName: "editable_combobox" + model: choices; + editable: true; + } GroupBox { id: group1 objectName: "group1" diff --git a/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp b/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp index 6278149e..f1697fdc 100644 --- a/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp +++ b/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp @@ -132,7 +132,16 @@ void tst_activeFocusOnTab::activeFocusOnTab() QVERIFY(item); QVERIFY(item->hasActiveFocus()); - // Tab: combobox->group1_checkbox + // Tab: combobox->editable_combobox + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + item = findItem<QQuickItem>(window->rootObject(), "editable_combobox"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // Tab: editable_combobox->group1_checkbox key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); @@ -403,7 +412,16 @@ void tst_activeFocusOnTab::activeFocusOnTab() QVERIFY(item); QVERIFY(item->hasActiveFocus()); - // BackTab: group1_checkbox->combobox + // BackTab: group1_checkbox->editable_combobox + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + item = findItem<QQuickItem>(window->rootObject(), "editable_combobox"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // BackTab: editable_combobox->combobox key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); @@ -465,17 +483,26 @@ void tst_activeFocusOnTab::activeFocusOnTab2() QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(QGuiApplication::focusWindow() == window); - // original: spinbox - QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "spinbox"); + // original: editable_combobox + QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "editable_combobox"); QVERIFY(item); item->forceActiveFocus(); QVERIFY(item->hasActiveFocus()); - // Tab: spinbox->textfield + // Tab: editable_combobox->spinbox QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); + item = findItem<QQuickItem>(window->rootObject(), "spinbox"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // Tab: spinbox->textfield + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + item = findItem<QQuickItem>(window->rootObject(), "textfield"); QVERIFY(item); QVERIFY(item->hasActiveFocus()); @@ -525,7 +552,16 @@ void tst_activeFocusOnTab::activeFocusOnTab2() QVERIFY(item); QVERIFY(item->hasActiveFocus()); - // BackTab: spinbox->textarea + // BackTab: spinbox->editable_combobox + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + item = findItem<QQuickItem>(window->rootObject(), "editable_combobox"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // BackTab: editable_combobox->textarea key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); diff --git a/tests/auto/controls/data/tst_gridlayout.qml b/tests/auto/controls/data/tst_gridlayout.qml index 3d14bca0..ccd6235d 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(); + } } } |