summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-29 16:04:47 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-29 16:04:47 +0100
commitc669f95302fecb4b21d3b658d3b1d42efb3cc7e8 (patch)
tree496fc6ccdd52dbe8b65f3d7f5b7d72d43af703ae
parent8cc5e5ecd7ebea89a6a4c2f931d6774255911df7 (diff)
parent1070aeb5521a95039cad3f4536e85e99526a4900 (diff)
downloadqtquickcontrols-c669f95302fecb4b21d3b658d3b1d42efb3cc7e8.tar.gz
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: .qmake.conf Change-Id: I626baf91e8bb9e9816346fdb842c0d577ca23d77
-rw-r--r--examples/quick/controls/basiclayouts/basiclayouts.pro1
-rw-r--r--examples/quick/controls/basiclayouts/main.qml1
-rw-r--r--examples/quick/controls/basiclayouts/src/main.cpp11
-rw-r--r--examples/quick/controls/gallery/content/AboutDialog.qml48
-rw-r--r--examples/quick/controls/gallery/gallery.pro2
-rw-r--r--examples/quick/controls/gallery/main.qml13
-rw-r--r--examples/quick/controls/gallery/resources.qrc1
-rw-r--r--examples/quick/controls/gallery/src/main.cpp11
-rw-r--r--examples/quick/controls/shared/qtquickcontrolsapplication.h (renamed from examples/quick/controls/shared/qt_quick_controls_examplemain.h)29
-rw-r--r--examples/quick/controls/shared/shared.pri4
-rw-r--r--examples/quick/controls/splitview/main.qml1
-rw-r--r--examples/quick/controls/splitview/splitview.pro1
-rw-r--r--examples/quick/controls/splitview/src/main.cpp11
-rw-r--r--examples/quick/controls/tableview/main.qml2
-rw-r--r--examples/quick/controls/tableview/src/main.cpp11
-rw-r--r--examples/quick/controls/tableview/tableview.pro1
-rw-r--r--examples/quick/controls/texteditor/qml/main.qml37
-rw-r--r--examples/quick/controls/texteditor/src/main.cpp24
-rw-r--r--examples/quick/controls/texteditor/texteditor.pro1
-rw-r--r--examples/quick/controls/touch/main.qml1
-rw-r--r--examples/quick/controls/touch/src/main.cpp11
-rw-r--r--examples/quick/controls/touch/touch.pro1
-rw-r--r--src/controls/ApplicationWindow.qml8
-rw-r--r--src/controls/ComboBox.qml15
-rw-r--r--src/controls/Private/qquickstyleitem.cpp6
-rw-r--r--src/controls/SpinBox.qml20
-rw-r--r--src/controls/Styles/Base/BusyIndicatorStyle.qml45
-rw-r--r--src/controls/Styles/Base/SpinBoxStyle.qml9
-rw-r--r--src/controls/Styles/Base/TextFieldStyle.qml9
-rw-r--r--src/controls/Styles/Base/images/spinner_large.pngbin0 -> 15085 bytes
-rw-r--r--src/controls/Styles/Base/images/spinner_medium.pngbin0 -> 5934 bytes
-rw-r--r--src/controls/Styles/Base/images/spinner_small.pngbin0 -> 4582 bytes
-rw-r--r--src/controls/Styles/styles.pri3
-rw-r--r--src/controls/TableView.qml2
-rw-r--r--src/controls/TextField.qml18
-rw-r--r--src/controls/plugins.qmltypes157
-rw-r--r--tests/auto/controls/data/spinbox/sp_editingfinished.qml61
-rw-r--r--tests/auto/controls/data/textfield/tf_editingfinished.qml63
-rw-r--r--tests/auto/controls/data/tst_combobox.qml16
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml110
-rw-r--r--tests/auto/controls/data/tst_textfield.qml40
41 files changed, 663 insertions, 142 deletions
diff --git a/examples/quick/controls/basiclayouts/basiclayouts.pro b/examples/quick/controls/basiclayouts/basiclayouts.pro
index 144ad0fe..a5586fe6 100644
--- a/examples/quick/controls/basiclayouts/basiclayouts.pro
+++ b/examples/quick/controls/basiclayouts/basiclayouts.pro
@@ -3,6 +3,7 @@ TARGET = basiclayouts
!android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
include(src/src.pri)
+include(../shared/shared.pri)
OTHER_FILES += \
main.qml
diff --git a/examples/quick/controls/basiclayouts/main.qml b/examples/quick/controls/basiclayouts/main.qml
index fe573aa6..18883d9a 100644
--- a/examples/quick/controls/basiclayouts/main.qml
+++ b/examples/quick/controls/basiclayouts/main.qml
@@ -47,6 +47,7 @@ import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0
ApplicationWindow {
+ visible: true
title: "Basic layouts"
property int margin: 11
width: mainLayout.implicitWidth + 2 * margin
diff --git a/examples/quick/controls/basiclayouts/src/main.cpp b/examples/quick/controls/basiclayouts/src/main.cpp
index 57ba57e3..a757f485 100644
--- a/examples/quick/controls/basiclayouts/src/main.cpp
+++ b/examples/quick/controls/basiclayouts/src/main.cpp
@@ -38,5 +38,12 @@
**
****************************************************************************/
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/gallery/content/AboutDialog.qml b/examples/quick/controls/gallery/content/AboutDialog.qml
new file mode 100644
index 00000000..aec7b604
--- /dev/null
+++ b/examples/quick/controls/gallery/content/AboutDialog.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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.Dialogs 1.1
+
+MessageDialog {
+ icon: StandardIcon.Information
+ text: "QtQuick.Controls gallery example"
+ detailedText: "This example demonstrates most of the available Qt Quick Controls."
+ title: "About Gallery"
+}
diff --git a/examples/quick/controls/gallery/gallery.pro b/examples/quick/controls/gallery/gallery.pro
index b9a5d0e6..68ed0c16 100644
--- a/examples/quick/controls/gallery/gallery.pro
+++ b/examples/quick/controls/gallery/gallery.pro
@@ -3,9 +3,11 @@ TARGET = gallery
!android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
include(src/src.pri)
+include(../shared/shared.pri)
OTHER_FILES += \
main.qml \
+ content/AboutDialog.qml \
content/ChildWindow.qml \
content/Controls.qml \
content/ImageViewer.qml \
diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml
index cd8240f7..61e77ef8 100644
--- a/examples/quick/controls/gallery/main.qml
+++ b/examples/quick/controls/gallery/main.qml
@@ -49,6 +49,7 @@ import QtQuick.Dialogs 1.0
import "content"
ApplicationWindow {
+ visible: true
title: "Component Gallery"
width: 640
@@ -70,6 +71,8 @@ ApplicationWindow {
onAccepted: imageViewer.open(fileUrl)
}
+ AboutDialog { id: aboutDialog }
+
Action {
id: openAction
text: "&Open"
@@ -106,6 +109,12 @@ ApplicationWindow {
onTriggered: activeFocusItem.paste()
}
+ Action {
+ id: aboutAction
+ text: "About"
+ onTriggered: aboutDialog.open()
+ }
+
ExclusiveGroup {
id: textFormatGroup
@@ -210,6 +219,10 @@ ApplicationWindow {
visible: false
}
}
+ Menu {
+ title: "&Help"
+ MenuItem { action: aboutAction }
+ }
}
diff --git a/examples/quick/controls/gallery/resources.qrc b/examples/quick/controls/gallery/resources.qrc
index 6f487274..ca9c6521 100644
--- a/examples/quick/controls/gallery/resources.qrc
+++ b/examples/quick/controls/gallery/resources.qrc
@@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
+ <file>content/AboutDialog.qml</file>
<file>content/ChildWindow.qml</file>
<file>content/Controls.qml</file>
<file>content/ImageViewer.qml</file>
diff --git a/examples/quick/controls/gallery/src/main.cpp b/examples/quick/controls/gallery/src/main.cpp
index 57ba57e3..a757f485 100644
--- a/examples/quick/controls/gallery/src/main.cpp
+++ b/examples/quick/controls/gallery/src/main.cpp
@@ -38,5 +38,12 @@
**
****************************************************************************/
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/shared/qt_quick_controls_examplemain.h b/examples/quick/controls/shared/qtquickcontrolsapplication.h
index 7f73a6d1..171de6c6 100644
--- a/examples/quick/controls/shared/qt_quick_controls_examplemain.h
+++ b/examples/quick/controls/shared/qtquickcontrolsapplication.h
@@ -39,12 +39,8 @@
**
****************************************************************************/
-#ifndef QT_QUICK_CONTROLS_EXAMPLEMAIN_H
-#define QT_QUICK_CONTROLS_EXAMPLEMAIN_H
-
-#include <QtQml>
-#include <QtQuick/QQuickView>
-#include <QtCore/QString>
+#ifndef QTQUICKCONTROLSAPPLICATION_H
+#define QTQUICKCONTROLSAPPLICATION_H
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/QApplication>
@@ -55,26 +51,11 @@
QT_BEGIN_NAMESPACE
#ifdef QT_WIDGETS_LIB
-#define Application QApplication
+#define QtQuickControlsApplication QApplication
#else
-#define Application QGuiApplication
+#define QtQuickControlsApplication QGuiApplication
#endif
-#define QT_QUICK_CONTROLS_EXAMPLE_MAIN(url) \
- int main(int argc, char *argv[]) \
- { \
- Application app(argc, argv); \
- QQmlApplicationEngine engine(QUrl(#url)); \
- QObject *topLevel = engine.rootObjects().value(0); \
- QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); \
- if ( !window ) { \
- qWarning("Error: Your root item has to be a Window."); \
- return -1; \
- } \
- window->show(); \
- return app.exec(); \
- }
-
QT_END_NAMESPACE
-#endif // QT_QUICK_CONTROLS_EXAMPLEMAIN_H
+#endif // QTQUICKCONTROLSAPPLICATION_H
diff --git a/examples/quick/controls/shared/shared.pri b/examples/quick/controls/shared/shared.pri
new file mode 100644
index 00000000..8ca34737
--- /dev/null
+++ b/examples/quick/controls/shared/shared.pri
@@ -0,0 +1,4 @@
+INCLUDEPATH += $$PWD
+
+SOURCES += \
+ $$PWD/qtquickcontrolsapplication.h
diff --git a/examples/quick/controls/splitview/main.qml b/examples/quick/controls/splitview/main.qml
index 992607d6..395188ce 100644
--- a/examples/quick/controls/splitview/main.qml
+++ b/examples/quick/controls/splitview/main.qml
@@ -47,6 +47,7 @@ import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0
ApplicationWindow {
+ visible: true
width: 600
height: 400
diff --git a/examples/quick/controls/splitview/splitview.pro b/examples/quick/controls/splitview/splitview.pro
index 066e578c..11c55f74 100644
--- a/examples/quick/controls/splitview/splitview.pro
+++ b/examples/quick/controls/splitview/splitview.pro
@@ -3,6 +3,7 @@ TARGET = splitview
!android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
include(src/src.pri)
+include(../shared/shared.pri)
OTHER_FILES += \
main.qml
diff --git a/examples/quick/controls/splitview/src/main.cpp b/examples/quick/controls/splitview/src/main.cpp
index 57ba57e3..a757f485 100644
--- a/examples/quick/controls/splitview/src/main.cpp
+++ b/examples/quick/controls/splitview/src/main.cpp
@@ -38,5 +38,12 @@
**
****************************************************************************/
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/tableview/main.qml b/examples/quick/controls/tableview/main.qml
index 37ab383e..e613e42e 100644
--- a/examples/quick/controls/tableview/main.qml
+++ b/examples/quick/controls/tableview/main.qml
@@ -48,7 +48,7 @@ import QtQuick.Controls 1.1
import QtQuick.XmlListModel 2.0
Window {
-
+ visible: true
width: 538 + frame.margins * 2
height: 360 + frame.margins * 2
diff --git a/examples/quick/controls/tableview/src/main.cpp b/examples/quick/controls/tableview/src/main.cpp
index 57ba57e3..a757f485 100644
--- a/examples/quick/controls/tableview/src/main.cpp
+++ b/examples/quick/controls/tableview/src/main.cpp
@@ -38,5 +38,12 @@
**
****************************************************************************/
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/tableview/tableview.pro b/examples/quick/controls/tableview/tableview.pro
index f3d7d7e6..7238d007 100644
--- a/examples/quick/controls/tableview/tableview.pro
+++ b/examples/quick/controls/tableview/tableview.pro
@@ -3,6 +3,7 @@ TARGET = tableview
!android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
include(src/src.pri)
+include(../shared/shared.pri)
OTHER_FILES += \
main.qml
diff --git a/examples/quick/controls/texteditor/qml/main.qml b/examples/quick/controls/texteditor/qml/main.qml
index 14bfa623..89120094 100644
--- a/examples/quick/controls/texteditor/qml/main.qml
+++ b/examples/quick/controls/texteditor/qml/main.qml
@@ -38,14 +38,15 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0
-import QtQuick.Dialogs 1.0
+import QtQuick.Dialogs 1.1
import QtQuick.Window 2.1
import org.qtproject.example 1.0
ApplicationWindow {
+ visible: true
width: 640
height: 480
minimumWidth: 400
@@ -53,35 +54,11 @@ ApplicationWindow {
title: document.documentTitle + " - Text Editor Example"
- ApplicationWindow {
+ MessageDialog {
id: aboutBox
-
- width: 280
- height: 120
title: "About Text"
-
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 8
- Item {
- Layout.fillWidth: true
- Layout.fillHeight: true
- Label {
- anchors.centerIn: parent
- horizontalAlignment: Text.AlignHCenter
- text: "This is a basic text editor \nwritten with Qt Quick Controls"
- }
- }
- Button {
- text: "Ok"
- isDefault: true
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- onClicked: aboutBox.close()
- }
- Keys.onReturnPressed: aboutBox.close()
- focus: true
- }
+ text: "This is a basic text editor \nwritten with Qt Quick Controls"
+ icon: StandardIcon.Information
}
Action {
@@ -231,7 +208,7 @@ ApplicationWindow {
}
Menu {
title: "&Help"
- MenuItem { text: "About..." ; onTriggered: aboutBox.show() }
+ MenuItem { text: "About..." ; onTriggered: aboutBox.open() }
}
}
diff --git a/examples/quick/controls/texteditor/src/main.cpp b/examples/quick/controls/texteditor/src/main.cpp
index a096f70d..ea7d22de 100644
--- a/examples/quick/controls/texteditor/src/main.cpp
+++ b/examples/quick/controls/texteditor/src/main.cpp
@@ -38,32 +38,14 @@
**
****************************************************************************/
-#ifdef QT_WIDGETS_LIB
-#include <QtWidgets/QApplication>
-#else
-#include <QtGui/QGuiApplication>
-#endif
-#include <QtQml>
-#include <QtQuick/QQuickView>
-#include <QtCore/QString>
-
+#include "qtquickcontrolsapplication.h"
#include "documenthandler.h"
+#include <QtQml/QQmlApplicationEngine>
int main(int argc, char *argv[])
{
-#ifdef QT_WIDGETS_LIB
- QApplication app(argc, argv);
-#else
- QGuiApplication app(argc, argv);
-#endif
+ QtQuickControlsApplication app(argc, argv);
qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler");
QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
- QObject *topLevel = engine.rootObjects().value(0);
- QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
- if ( !window ) {
- qWarning("Error: Your root item has to be a Window.");
- return -1;
- }
- window->show();
return app.exec();
}
diff --git a/examples/quick/controls/texteditor/texteditor.pro b/examples/quick/controls/texteditor/texteditor.pro
index d9b6c8a3..06e669d9 100644
--- a/examples/quick/controls/texteditor/texteditor.pro
+++ b/examples/quick/controls/texteditor/texteditor.pro
@@ -3,6 +3,7 @@ TARGET = texteditor
!android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
include(src/src.pri)
+include(../shared/shared.pri)
OTHER_FILES += \
qml/main.qml \
diff --git a/examples/quick/controls/touch/main.qml b/examples/quick/controls/touch/main.qml
index a6de8910..ab5d534f 100644
--- a/examples/quick/controls/touch/main.qml
+++ b/examples/quick/controls/touch/main.qml
@@ -43,6 +43,7 @@ import QtQuick.Controls 1.1
import "content"
ApplicationWindow {
+ visible: true
width: 800
height: 1280
diff --git a/examples/quick/controls/touch/src/main.cpp b/examples/quick/controls/touch/src/main.cpp
index 57ba57e3..a757f485 100644
--- a/examples/quick/controls/touch/src/main.cpp
+++ b/examples/quick/controls/touch/src/main.cpp
@@ -38,5 +38,12 @@
**
****************************************************************************/
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/touch/touch.pro b/examples/quick/controls/touch/touch.pro
index 1e5d12f3..6afca140 100644
--- a/examples/quick/controls/touch/touch.pro
+++ b/examples/quick/controls/touch/touch.pro
@@ -3,6 +3,7 @@ TARGET = touch
!android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
include(src/src.pri)
+include(../shared/shared.pri)
OTHER_FILES += \
main.qml \
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml
index 564e8d2a..6e0160df 100644
--- a/src/controls/ApplicationWindow.qml
+++ b/src/controls/ApplicationWindow.qml
@@ -119,11 +119,19 @@ Window {
onStatusBarChanged: { if (statusBar) { statusBar.parent = statusBarArea } }
+ onVisibleChanged: { if (visible && menuBar) { menuBar.__parentWindow = root } }
+
/*! \internal */
default property alias data: contentArea.data
color: syspal.window
+ flags: Qt.Window | Qt.WindowFullscreenButtonHint |
+ Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint |
+ Qt.WindowCloseButtonHint | Qt.WindowFullscreenButtonHint
+ // QTBUG-35049: Windows is removing features we didn't ask for, even though Qt::CustomizeWindowHint is not set
+ // Otherwise Qt.Window | Qt.WindowFullscreenButtonHint would be enough
+
SystemPalette {id: syspal}
Item {
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 8298a2d9..00842a40 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -323,8 +323,9 @@ Control {
renderType: __style ? __style.renderType : Text.NativeRendering
selectByMouse: true
- selectionColor: syspal.highlight
- selectedTextColor: syspal.highlightedText
+ color: __style.__syspal.text
+ selectionColor: __style.__syspal.highlight
+ selectedTextColor: __style.__syspal.highlightedText
onAccepted: {
var idx = input.find(editText)
if (idx > -1) {
@@ -340,8 +341,6 @@ Control {
comboBox.accepted();
}
- SystemPalette { id: syspal }
-
property bool blockUpdate: false
property string prevText
@@ -432,7 +431,7 @@ Control {
property ExclusiveGroup eg: ExclusiveGroup { id: eg }
- property bool __modelIsArray: popupItems.model ? popupItems.model.constructor === Array : false
+ property bool modelIsArray: false
Instantiator {
id: popupItems
@@ -440,6 +439,7 @@ Control {
property bool updatingModel: false
onModelChanged: {
+ popup.modelIsArray = !!model ? model.constructor === Array : false
if (active) {
if (updatingModel && popup.__selectedIndex === 0) {
// We still want to update the currentText
@@ -449,12 +449,13 @@ Control {
popup.__selectedIndex = 0
}
}
+ popup.resolveTextValue(comboBox.textRole)
}
MenuItem {
text: popup.textRole === '' ?
modelData :
- ((popup.__modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '')
+ ((popup.modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '')
onTriggered: {
if (index !== currentIndex)
activated(index)
@@ -479,7 +480,7 @@ Control {
}
var get = model['get'];
- if (!get && popup.__modelIsArray) {
+ if (!get && popup.modelIsArray && !!model[0]) {
if (model[0].constructor !== String && model[0].constructor !== Number)
get = function(i) { return model[i]; }
}
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index a14a22d1..566a46f8 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -112,7 +112,7 @@ public:
}
void initialize(QSGTexture *texture,
- const QRectF &bounds,
+ const QRectF &bounds, qreal devicePixelRatio,
int left, int top, int right, int bottom) {
delete m_material.texture();
@@ -127,6 +127,9 @@ public:
QRectF tc = texture->normalizedTextureSubRect();
QSize ts = texture->textureSize();
+ ts.setHeight(ts.height() / devicePixelRatio);
+ ts.setWidth(ts.width() / devicePixelRatio);
+
qreal invtw = tc.width() / ts.width();
qreal invth = tc.height() / ts.height();
@@ -1661,6 +1664,7 @@ QSGNode *QQuickStyleItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
styleNode->initialize(window()->createTextureFromImage(m_image, QQuickWindow::TextureCanUseAtlas),
boundingRect(),
+ window()->devicePixelRatio(),
m_border.left(), m_border.top(), m_border.right(), m_border.bottom());
return styleNode;
}
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index 0cc2f5a7..c756566d 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Private 1.0
@@ -164,6 +164,17 @@ Control {
*/
readonly property alias hovered: mouseArea.containsMouse
+ /*!
+ \qmlsignal SpinBox::editingFinished()
+ \since 5.2
+
+ This signal is emitted when the Return or Enter key is pressed or
+ the control loses focus. Note that if there is a validator
+ set on the control and enter/return is pressed, this signal will
+ only be emitted if the validator returns an acceptable state.
+ */
+ signal editingFinished()
+
style: Qt.createComponent(Settings.style + "/SpinBoxStyle.qml", spinbox)
/*! \internal */
@@ -255,6 +266,8 @@ Control {
selectValue()
}
+ onEditingFinished: spinbox.editingFinished()
+
color: __panel ? __panel.foregroundColor : "black"
selectionColor: __panel ? __panel.selectionColor : "black"
selectedTextColor: __panel ? __panel.selectedTextColor : "black"
@@ -271,6 +284,7 @@ Control {
MouseArea {
id: mouseUp
+ objectName: "mouseUp"
hoverEnabled: true
property var upRect: __panel ? __panel.upRect : null
@@ -285,6 +299,7 @@ Control {
height: upRect ? upRect.height : 0
onClicked: __increment()
+ onPressed: if (activeFocusOnPress) input.forceActiveFocus()
property bool autoincrement: false;
onReleased: autoincrement = false
@@ -296,9 +311,12 @@ Control {
MouseArea {
id: mouseDown
+ objectName: "mouseDown"
hoverEnabled: true
onClicked: __decrement()
+ onPressed: if (activeFocusOnPress) input.forceActiveFocus()
+
property var downRect: __panel ? __panel.downRect : null
anchors.left: parent.left
diff --git a/src/controls/Styles/Base/BusyIndicatorStyle.qml b/src/controls/Styles/Base/BusyIndicatorStyle.qml
index 2a033024..d53ccb29 100644
--- a/src/controls/Styles/Base/BusyIndicatorStyle.qml
+++ b/src/controls/Styles/Base/BusyIndicatorStyle.qml
@@ -37,7 +37,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Private 1.0
@@ -77,36 +77,25 @@ Style {
/*! This defines the appearance of the busy indicator. */
property Component indicator: Item {
- implicitWidth: 32
- implicitHeight: 32
+ implicitWidth: 48
+ implicitHeight: 48
opacity: control.running ? 1 : 0
- Behavior on opacity { NumberAnimation { duration: 250 } }
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
- Timer {
- interval: 16
- running: control.running
- repeat: true
- onTriggered: { repeater.counter += 0.20 }
- }
-
- Repeater {
- id: repeater
- model: 9
- anchors.fill: parent
- property real counter: 0
- Rectangle {
- width: repeater.width/6 + 2
- height: width
- radius: width/2
- x: repeater.width/2
- transform: Rotation { origin.x: 0 ; origin.y: repeater.width/2 ; angle: 5 + (360/repeater.count) * index}
- border.color: Qt.rgba(0, 0, 0, 0.24)
- color: Qt.rgba(lum, lum, lum, lum/2 + 0.3)
- property real lum: {
- var idx = ((repeater.count-index) + repeater.counter) % repeater.count
- return Math.max( 0.3, 1 - (idx/(repeater.count - 1)))
- }
+ Image {
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ width: Math.min(parent.width, parent.height)
+ height: width
+ source: width <= 32 ? "images/spinner_small.png" :
+ width >= 48 ? "images/spinner_large.png" :
+ "images/spinner_medium.png"
+ RotationAnimator on rotation {
+ duration: 800
+ loops: Animation.Infinite
+ from: 0
+ to: 360
}
}
}
diff --git a/src/controls/Styles/Base/SpinBoxStyle.qml b/src/controls/Styles/Base/SpinBoxStyle.qml
index 9f1b565d..9cedf2b9 100644
--- a/src/controls/Styles/Base/SpinBoxStyle.qml
+++ b/src/controls/Styles/Base/SpinBoxStyle.qml
@@ -76,8 +76,7 @@ Style {
}
/*! The content margins of the text field. */
- padding { top: 1 ; left: Math.round(TextSingleton.implicitHeight/2) ; right: Math.round(TextSingleton.implicitHeight) ; bottom: 0 }
-
+ padding { top: 1 ; left: Math.round(styleData.contentHeight/2) ; right: Math.max(22, Math.round(styleData.contentHeight)) ; bottom: 0 }
/*! \qmlproperty enumeration horizontalAlignment
This property defines the default text aligment.
@@ -141,8 +140,8 @@ Style {
/*! The background of the SpinBox. */
property Component background: Item {
- implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
- implicitWidth: styleData.contentWidth + 26
+ implicitHeight: Math.max(25, Math.round(styleData.contentHeight * 1.2))
+ implicitWidth: styleData.contentWidth + padding.left + padding.right
Rectangle {
anchors.fill: parent
anchors.bottomMargin: -1
@@ -156,7 +155,7 @@ Style {
GradientStop {color: "#fff" ; position: 0.1}
GradientStop {color: "#fff" ; position: 1}
}
- radius: TextSingleton.implicitHeight * 0.16
+ radius: control.font.pixelSize * 0.16
anchors.fill: parent
border.color: control.activeFocus ? "#47b" : "#999"
}
diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml
index 8b4494d1..4713130f 100644
--- a/src/controls/Styles/Base/TextFieldStyle.qml
+++ b/src/controls/Styles/Base/TextFieldStyle.qml
@@ -77,7 +77,7 @@ Style {
readonly property TextField control: __control
/*! The content margins of the text field. */
- padding { top: 4 ; left: TextSingleton.implicitHeight/3 ; right: TextSingleton.implicitHeight/3 ; bottom:4 }
+ padding { top: 4 ; left: Math.round(control.__contentHeight/3) ; right: control.__contentHeight/3 ; bottom: 4 }
/*! The current font. */
property font font
@@ -93,6 +93,7 @@ Style {
/*!
\qmlproperty enumeration renderType
+ \since 5.2
Override the default rendering type for the control.
@@ -113,8 +114,8 @@ Style {
/*! The background of the text field. */
property Component background: Item {
- implicitWidth: Math.round(TextSingleton.implicitHeight * 8)
- implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
+ implicitWidth: Math.round(control.__contentHeight * 8)
+ implicitHeight: Math.max(25, Math.round(control.__contentHeight * 1.2))
Rectangle {
anchors.fill: parent
anchors.bottomMargin: -1
@@ -128,7 +129,7 @@ Style {
GradientStop {color: "#fff" ; position: 0.1}
GradientStop {color: "#fff" ; position: 1}
}
- radius: TextSingleton.implicitHeight * 0.16
+ radius: control.__contentHeight * 0.16
anchors.fill: parent
border.color: control.activeFocus ? "#47b" : "#999"
}
diff --git a/src/controls/Styles/Base/images/spinner_large.png b/src/controls/Styles/Base/images/spinner_large.png
new file mode 100644
index 00000000..bfd1b637
--- /dev/null
+++ b/src/controls/Styles/Base/images/spinner_large.png
Binary files differ
diff --git a/src/controls/Styles/Base/images/spinner_medium.png b/src/controls/Styles/Base/images/spinner_medium.png
new file mode 100644
index 00000000..41409d45
--- /dev/null
+++ b/src/controls/Styles/Base/images/spinner_medium.png
Binary files differ
diff --git a/src/controls/Styles/Base/images/spinner_small.png b/src/controls/Styles/Base/images/spinner_small.png
new file mode 100644
index 00000000..2f6048e4
--- /dev/null
+++ b/src/controls/Styles/Base/images/spinner_small.png
Binary files differ
diff --git a/src/controls/Styles/styles.pri b/src/controls/Styles/styles.pri
index 5a36767e..d695893a 100644
--- a/src/controls/Styles/styles.pri
+++ b/src/controls/Styles/styles.pri
@@ -73,6 +73,9 @@ STYLES_QML_FILES += \
$$PWD/Base/images/arrow-left@2x.png \
$$PWD/Base/images/arrow-right.png \
$$PWD/Base/images/arrow-right@2x.png \
+ $$PWD/Base/images/spinner_small.png \
+ $$PWD/Base/images/spinner_medium.png \
+ $$PWD/Base/images/spinner_large.png \
$$PWD/Base/images/check.png \
$$PWD/Base/images/check@2x.png
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml
index 586f1211..736ac6e3 100644
--- a/src/controls/TableView.qml
+++ b/src/controls/TableView.qml
@@ -830,7 +830,6 @@ ScrollView {
}
}
}
- onWidthChanged: listView.contentWidth = width
}
}
@@ -991,6 +990,7 @@ ScrollView {
}
}
}
+ onWidthChanged: listView.contentWidth = width
}
Loader {
id: loader
diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml
index c1e3ddab..0bd4db1e 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Private 1.0
@@ -403,6 +403,18 @@ Control {
signal accepted()
/*!
+ \qmlsignal TextField::editingFinished()
+ \since 5.2
+
+ This signal is emitted when the Return or Enter key is pressed or
+ the text field loses focus. Note that if there is a validator or
+ inputMask set on the text field and enter/return is pressed, this
+ signal will only be emitted if the input follows
+ the inputMask and the validator returns an acceptable state.
+ */
+ signal editingFinished()
+
+ /*!
\qmlmethod TextField::copy()
Copies the currently selected text to the system clipboard.
@@ -572,7 +584,7 @@ Control {
selectionColor: __panel ? __panel.selectionColor : "darkred"
selectedTextColor: __panel ? __panel.selectedTextColor : "white"
- font: __panel ? __panel.font : font
+ font: __panel ? __panel.font : undefined
anchors.leftMargin: __panel ? __panel.leftMargin : 0
anchors.topMargin: __panel ? __panel.topMargin : 0
anchors.rightMargin: __panel ? __panel.rightMargin : 0
@@ -591,5 +603,7 @@ Control {
Qt.inputMethod.hide()
textfield.accepted()
}
+
+ onEditingFinished: textfield.editingFinished()
}
}
diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes
index e82b58a5..eadb72ef 100644
--- a/src/controls/plugins.qmltypes
+++ b/src/controls/plugins.qmltypes
@@ -948,7 +948,164 @@ Module {
Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true }
}
Component {
+ name: "QQuickText"
+ defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
+ exports: ["QtQuick/Text 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextStyle"
+ values: {
+ "Normal": 0,
+ "Outline": 1,
+ "Raised": 2,
+ "Sunken": 3
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2,
+ "StyledText": 4
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Enum {
+ name: "LineHeightMode"
+ values: {
+ "ProportionalHeight": 0,
+ "FixedHeight": 1
+ }
+ }
+ Enum {
+ name: "FontSizeMode"
+ values: {
+ "FixedSize": 0,
+ "HorizontalFit": 1,
+ "VerticalFit": 2,
+ "Fit": 3
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "linkColor"; type: "QColor" }
+ Property { name: "style"; type: "TextStyle" }
+ Property { name: "styleColor"; type: "QColor" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "truncated"; type: "bool"; isReadonly: true }
+ Property { name: "maximumLineCount"; type: "int" }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "elide"; type: "TextElideMode" }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "lineHeight"; type: "double" }
+ Property { name: "lineHeightMode"; type: "LineHeightMode" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "minimumPixelSize"; type: "int" }
+ Property { name: "minimumPointSize"; type: "int" }
+ Property { name: "fontSizeMode"; type: "FontSizeMode" }
+ Property { name: "renderType"; type: "RenderType" }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "styleChanged"
+ Parameter { name: "style"; type: "TextStyle" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "elideModeChanged"
+ Parameter { name: "mode"; type: "TextElideMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "lineHeightChanged"
+ Parameter { name: "lineHeight"; type: "double" }
+ }
+ Signal {
+ name: "lineHeightModeChanged"
+ Parameter { name: "mode"; type: "LineHeightMode" }
+ }
+ Signal {
+ name: "lineLaidOut"
+ Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
+ }
+ Method { name: "doLayout" }
+ }
+
+ Component {
+ prototype: "QQuickText"
name: "QtQuick.Controls/Label"
exports: ["QtQuick.Controls/Label 1.0"]
exportMetaObjectRevisions: [0]
diff --git a/tests/auto/controls/data/spinbox/sp_editingfinished.qml b/tests/auto/controls/data/spinbox/sp_editingfinished.qml
new file mode 100644
index 00000000..d85e6eae
--- /dev/null
+++ b/tests/auto/controls/data/spinbox/sp_editingfinished.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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
+ property alias control2: _control2
+ SpinBox {
+ id: _control1
+ property bool myeditingfinished: false
+ onEditingFinished: myeditingfinished = true
+ }
+ SpinBox {
+ id: _control2
+ property bool myeditingfinished: false
+ onEditingFinished: myeditingfinished = true
+ }
+}
diff --git a/tests/auto/controls/data/textfield/tf_editingfinished.qml b/tests/auto/controls/data/textfield/tf_editingfinished.qml
new file mode 100644
index 00000000..d38423a4
--- /dev/null
+++ b/tests/auto/controls/data/textfield/tf_editingfinished.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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
+ property alias control2: _control2
+ TextField {
+ id: _control1
+ text: 'A'
+ property bool myeditingfinished: false
+ onEditingFinished: myeditingfinished = true
+ }
+ TextField {
+ id: _control2
+ text: 'B'
+ property bool myeditingfinished: false
+ onEditingFinished: myeditingfinished = true
+ }
+}
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 802d23e4..256e213e 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -118,13 +118,15 @@ TestCase {
}
function test_arraymodelwithtextrole() {
- // FIXME The use-case before this change should work.
- var comboBox = Qt.createQmlObject('import QtQuick.Controls 1.1 ; \
- ComboBox { \
- model: [ { "text": "Banana", "color": "Yellow"}, \
- { "text": "Apple", "color": "Green"}, \
- { "text": "Coconut", "color": "Brown"} ]; \
- textRole: "text" }', testCase, '');
+ var arrayModel = [
+ {text: 'Banana', color: 'Yellow'},
+ {text: 'Apple', color: 'Green'},
+ {text: 'Coconut', color: 'Brown'}
+ ];
+
+ var comboBox = Qt.createQmlObject('import QtQuick.Controls 1.1 ; ComboBox { }', testCase, '');
+ comboBox.textRole = "text"
+ comboBox.model = arrayModel
compare(comboBox.currentIndex, 0)
compare(comboBox.currentText, "Banana")
comboBox.textRole = "color"
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index 67dd3dba..176a70b5 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -343,6 +343,86 @@ Item {
spinbox2.destroy()
}
+ function test_setFontsize(){
+ var control = Qt.createQmlObject('import QtQuick.Controls 1.1; import QtQuick.Controls.Styles 1.1; SpinBox {style: SpinBoxStyle{}}', container, '')
+ var width = control.width;
+ var height = control.height;
+ control.font.pixelSize = 40
+ verify(control.width > width) // ensure that the text field resizes
+ verify(control.height > height)
+ control.destroy()
+ }
+
+ function test_get_active_focus_when_up_or_down_was_pressed(){
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.1; \
+ Column { \
+ property alias spinbox: _spinbox; \
+ property alias textfield: _textfield; \
+ SpinBox { \
+ id: _spinbox; \
+ } \
+ TextField { \
+ id: _textfield; \
+ text: "textfile"; \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ verify(control !== null)
+
+ var spinbox = control.spinbox
+ var textfield = control.textfield
+ verify(spinbox !== null)
+ verify(textfield !== null)
+
+ waitForRendering(control)
+
+ var up = getMouseArea(spinbox, "mouseUp")
+ verify(up !== null)
+ var down = getMouseArea(spinbox, "mouseDown")
+ verify(down !== null)
+
+ textfield.forceActiveFocus()
+ verify(!spinbox.activeFocus)
+ verify(textfield.activeFocus)
+
+ mouseClick(up, up.width/2, up.height/2)
+ verify(spinbox.activeFocus)
+ verify(!textfield.activeFocus)
+
+ textfield.forceActiveFocus()
+ verify(!spinbox.activeFocus)
+ verify(textfield.activeFocus)
+
+ mouseClick(down, down.width/2, down.height/2)
+ verify(spinbox.activeFocus)
+ verify(!textfield.activeFocus)
+
+ textfield.forceActiveFocus()
+ verify(!spinbox.activeFocus)
+ verify(textfield.activeFocus)
+ spinbox.activeFocusOnPress = false
+
+ mouseClick(up, up.width/2, up.height/2)
+ verify(!spinbox.activeFocus)
+ verify(textfield.activeFocus)
+
+ mouseClick(down, down.width/2, down.height/2)
+ verify(!spinbox.activeFocus)
+ verify(textfield.activeFocus)
+
+ control.destroy()
+ }
+
+ function getMouseArea(control, name) {
+ for (var i = 0; i < control.children.length; i++) {
+ if (control.children[i].objectName === name)
+ return control.children[i]
+ }
+ return null
+ }
+
function test_activeFocusOnPress(){
var spinbox = Qt.createQmlObject('import QtQuick.Controls 1.1; SpinBox {x: 20; y: 20; width: 100; height: 50}', container, '')
spinbox.activeFocusOnPress = false
@@ -476,6 +556,36 @@ Item {
spinbox.destroy()
}
+ function test_editingFinished() {
+ var component = Qt.createComponent("spinbox/sp_editingfinished.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)
+ var control2 = test.control2
+ verify(control2 !== null)
+
+ control1.forceActiveFocus()
+ verify(control1.activeFocus)
+ verify(!control2.activeFocus)
+
+ verify(control1.myeditingfinished === false)
+ verify(control2.myeditingfinished === false)
+
+ keyPress(Qt.Key_Tab)
+ verify(!control1.activeFocus)
+ verify(control2.activeFocus)
+ verify(control1.myeditingfinished === true)
+
+ keyPress(Qt.Key_Enter)
+ verify(!control1.activeFocus)
+ verify(control2.activeFocus)
+ verify(control2.myeditingfinished === true)
+
+ test.destroy()
+ }
+
function test_construction() {
// onValueChanged should not be emitted during construction.
var root = Qt.createQmlObject("
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index 6a176997..a526d1f0 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -280,6 +280,16 @@ TestCase {
control.destroy()
}
+ function test_setFontsize(){
+ var control = Qt.createQmlObject('import QtQuick.Controls 1.1; import QtQuick.Controls.Styles 1.1; TextField {style:TextFieldStyle{}}', container, '')
+ var width = control.width;
+ var height = control.height;
+ control.font.pixelSize = 40
+ verify(control.width > width) // ensure that the text field resizes
+ verify(control.height > height)
+ control.destroy()
+ }
+
function test_activeFocusOnTab() {
// Set TextField readonly so the tab/backtab can be tested toward the navigation
var test_control = 'import QtQuick 2.1; \
@@ -356,5 +366,35 @@ TestCase {
verify(!control.control3.activeFocus)
control.destroy()
}
+
+ function test_editingFinished() {
+ var component = Qt.createComponent("textfield/tf_editingfinished.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)
+ var control2 = test.control2
+ verify(control2 !== null)
+
+ control1.forceActiveFocus()
+ verify(control1.activeFocus)
+ verify(!control2.activeFocus)
+
+ verify(control1.myeditingfinished === false)
+ verify(control2.myeditingfinished === false)
+
+ keyPress(Qt.Key_Tab)
+ verify(!control1.activeFocus)
+ verify(control2.activeFocus)
+ verify(control1.myeditingfinished === true)
+
+ keyPress(Qt.Key_Enter)
+ verify(!control1.activeFocus)
+ verify(control2.activeFocus)
+ verify(control2.myeditingfinished === true)
+
+ test.destroy()
+ }
}
}