summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Olszak <olszak.tomasz@gmail.com>2013-12-17 22:36:01 +0100
committerTomasz Olszak <olszak.tomasz@gmail.com>2013-12-17 22:36:35 +0100
commit564da231d5416032d3ebe4fdd325345a351ad7c2 (patch)
treec91c2cd5eb57548686e7dca7ab49534587984324
parent9b88f8c31ac48eadd67f5e3f0b180efd03f97cd4 (diff)
parentae380584de53cf927fe4a7bd62ffb41f73b1faa1 (diff)
downloadqtquickcontrols-564da231d5416032d3ebe4fdd325345a351ad7c2.tar.gz
qtquickcontrols-564da231d5416032d3ebe4fdd325345a351ad7c2.tar.bz2
qtquickcontrols-564da231d5416032d3ebe4fdd325345a351ad7c2.zip
Merge remote-tracking branch 'origin/stable' into wip/tizenupstream/5.2.1
Change-Id: I145b6f66c08da6188d50104d0b107902f94e6a9b
-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/Styles.qml2
-rw-r--r--examples/quick/controls/gallery/gallery.pro1
-rw-r--r--examples/quick/controls/gallery/main.qml1
-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.qml4
-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.qml1
-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.qml7
-rw-r--r--src/controls/ComboBox.qml78
-rw-r--r--src/controls/Private/TabBar.qml5
-rw-r--r--src/controls/Private/qquickspinboxvalidator.cpp14
-rw-r--r--src/controls/Private/qquickspinboxvalidator_p.h3
-rw-r--r--src/controls/Private/qquickstyleitem.cpp14
-rw-r--r--src/controls/ScrollView.qml2
-rw-r--r--src/controls/Slider.qml6
-rw-r--r--src/controls/SpinBox.qml23
-rw-r--r--src/controls/StatusBar.qml2
-rw-r--r--src/controls/Styles/Base/BusyIndicatorStyle.qml3
-rw-r--r--src/controls/Styles/Base/SpinBoxStyle.qml9
-rw-r--r--src/controls/Styles/Base/TabViewStyle.qml30
-rw-r--r--src/controls/Styles/Base/TextFieldStyle.qml9
-rw-r--r--src/controls/Styles/Desktop/SliderStyle.qml1
-rw-r--r--src/controls/Styles/Desktop/TextAreaStyle.qml4
-rw-r--r--src/controls/TextField.qml18
-rw-r--r--src/controls/ToolBar.qml2
-rw-r--r--src/controls/qquickmenu.cpp2
-rw-r--r--src/controls/qquickmenu_p.h1
-rw-r--r--src/controls/qquickmenuitem.cpp25
-rw-r--r--src/controls/qquickmenuitem_p.h11
-rw-r--r--src/controls/qquickmenuitemcontainer_p.h2
-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.qml34
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml66
-rw-r--r--tests/auto/controls/data/tst_textfield.qml40
49 files changed, 502 insertions, 162 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/Styles.qml b/examples/quick/controls/gallery/content/Styles.qml
index e774ab52..81b46f63 100644
--- a/examples/quick/controls/gallery/content/Styles.qml
+++ b/examples/quick/controls/gallery/content/Styles.qml
@@ -309,7 +309,7 @@ Item {
anchors.rightMargin: -parent.anchors.rightMargin
}
}
- ParticleSystem{ id: bubbles }
+ ParticleSystem{ id: bubbles; running: visible }
ImageParticle{
id: fireball
system: bubbles
diff --git a/examples/quick/controls/gallery/gallery.pro b/examples/quick/controls/gallery/gallery.pro
index 09358658..68ed0c16 100644
--- a/examples/quick/controls/gallery/gallery.pro
+++ b/examples/quick/controls/gallery/gallery.pro
@@ -3,6 +3,7 @@ TARGET = gallery
!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/gallery/main.qml b/examples/quick/controls/gallery/main.qml
index 43b6776e..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
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..d15b6f65 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
@@ -385,7 +385,7 @@ Window {
CheckBox{
id: sortableCheckbox
checked: false
- text: "Sortindicator"
+ text: "Sort indicator"
anchors.verticalCenter: parent.verticalCenter
}
CheckBox{
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 50cbed56..89120094 100644
--- a/examples/quick/controls/texteditor/qml/main.qml
+++ b/examples/quick/controls/texteditor/qml/main.qml
@@ -46,6 +46,7 @@ import QtQuick.Window 2.1
import org.qtproject.example 1.0
ApplicationWindow {
+ visible: true
width: 640
height: 480
minimumWidth: 400
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 d4b23c76..e07725f4 100644
--- a/src/controls/ApplicationWindow.qml
+++ b/src/controls/ApplicationWindow.qml
@@ -133,7 +133,12 @@ Window {
default property alias data: contentArea.data
color: syspal.window
- flags: Qt.Window | Qt.WindowFullscreenButtonHint
+
+ 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}
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index db39f579..419bc117 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -268,6 +268,28 @@ Control {
}
/*! \internal */
+ function __selectPrevItem() {
+ input.blockUpdate = true
+ if (currentIndex > 0) {
+ currentIndex--;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+
+ /*! \internal */
+ function __selectNextItem() {
+ input.blockUpdate = true;
+ if (currentIndex < popupItems.count - 1) {
+ currentIndex++;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+
+ /*! \internal */
property var __popup: popup
style: Qt.createComponent(Settings.style + "/ComboBoxStyle.qml", comboBox)
@@ -285,6 +307,13 @@ Control {
forceActiveFocus()
popup.show()
}
+ onWheel: {
+ if (wheel.angleDelta.y > 0) {
+ __selectPrevItem();
+ } else if (wheel.angleDelta.y < 0){
+ __selectNextItem();
+ }
+ }
}
Component.onCompleted: {
@@ -323,16 +352,14 @@ Control {
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)
+ var idx = input.find(editText, Qt.MatchFixedString)
if (idx > -1) {
- var string = textAt(idx);
- if (string.length === editText.length) {
- currentIndex = idx;
- editText = string;
- }
+ currentIndex = idx;
+ editText = textAt(idx);
} else {
currentIndex = -1;
popup.currentText = editText;
@@ -340,8 +367,6 @@ Control {
comboBox.accepted();
}
- SystemPalette { id: syspal }
-
property bool blockUpdate: false
property string prevText
@@ -354,6 +379,10 @@ Control {
} else if (searchType === Qt.CaseSensitive) {
if (currentString.indexOf(text) === 0)
return i;
+ } else if (searchType === Qt.MatchFixedString) {
+ if (currentString.toLowerCase().indexOf(text.toLowerCase()) === 0
+ && currentString.length === text.length)
+ return i;
} else if (currentString.toLowerCase().indexOf(text.toLowerCase()) === 0) {
return i
}
@@ -432,7 +461,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 +469,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 +479,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 +510,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]; }
}
@@ -540,23 +571,6 @@ Control {
popup.show()
}
- Keys.onUpPressed: {
- input.blockUpdate = true
- if (currentIndex > 0) {
- currentIndex--;
- input.text = popup.currentText;
- activated(currentIndex);
- }
- input.blockUpdate = false;
- }
-
- Keys.onDownPressed: {
- input.blockUpdate = true;
- if (currentIndex < popupItems.count - 1) {
- currentIndex++;
- input.text = popup.currentText;
- activated(currentIndex);
- }
- input.blockUpdate = false;
- }
+ Keys.onUpPressed: __selectPrevItem()
+ Keys.onDownPressed: __selectNextItem()
}
diff --git a/src/controls/Private/TabBar.qml b/src/controls/Private/TabBar.qml
index 592ec348..2e374f99 100644
--- a/src/controls/Private/TabBar.qml
+++ b/src/controls/Private/TabBar.qml
@@ -119,7 +119,10 @@ FocusScope {
interactive: false
focus: true
- width: Math.min(availableWidth, count ? contentWidth : availableWidth)
+ // Note this will silence the binding loop warnings caused by QTBUG-35038
+ // and should be removed when this issue is resolved.
+ property int contentWidthWorkaround: contentWidth > 0 ? contentWidth: 0
+ width: Math.min(availableWidth, count ? contentWidthWorkaround : availableWidth)
height: currentItem ? currentItem.height : 0
highlightMoveDuration: 0
diff --git a/src/controls/Private/qquickspinboxvalidator.cpp b/src/controls/Private/qquickspinboxvalidator.cpp
index 16db3f08..342ae8c0 100644
--- a/src/controls/Private/qquickspinboxvalidator.cpp
+++ b/src/controls/Private/qquickspinboxvalidator.cpp
@@ -69,7 +69,7 @@ QQuickSpinBoxValidator::~QQuickSpinBoxValidator()
QString QQuickSpinBoxValidator::text() const
{
- return m_prefix + locale().toString(m_value, 'f', m_validator.decimals()) + m_suffix;
+ return textFromValue(m_value);
}
qreal QQuickSpinBoxValidator::value() const
@@ -178,7 +178,7 @@ void QQuickSpinBoxValidator::setSuffix(const QString &suffix)
void QQuickSpinBoxValidator::fixup(QString &input) const
{
- input.remove(locale().groupSeparator());
+ input = textFromValue(m_value).remove(locale().groupSeparator());
}
QValidator::State QQuickSpinBoxValidator::validate(QString &input, int &pos) const
@@ -207,8 +207,11 @@ QValidator::State QQuickSpinBoxValidator::validate(QString &input, int &pos) con
if (state == QValidator::Acceptable) {
bool ok = false;
qreal val = locale().toDouble(value, &ok);
- if (ok)
+ if (ok) {
const_cast<QQuickSpinBoxValidator *>(this)->setValue(val);
+ if (input != textFromValue(val))
+ state = QValidator::Intermediate;
+ }
}
return state;
}
@@ -229,4 +232,9 @@ void QQuickSpinBoxValidator::decrement()
setValue(m_value - m_step);
}
+QString QQuickSpinBoxValidator::textFromValue(qreal value) const
+{
+ return m_prefix + locale().toString(value, 'f', m_validator.decimals()) + m_suffix;
+}
+
QT_END_NAMESPACE
diff --git a/src/controls/Private/qquickspinboxvalidator_p.h b/src/controls/Private/qquickspinboxvalidator_p.h
index 09468fce..2ffac73e 100644
--- a/src/controls/Private/qquickspinboxvalidator_p.h
+++ b/src/controls/Private/qquickspinboxvalidator_p.h
@@ -107,6 +107,9 @@ Q_SIGNALS:
void suffixChanged();
void textChanged();
+protected:
+ QString textFromValue(qreal value) const;
+
private:
qreal m_value;
qreal m_step;
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index a14a22d1..c290bc28 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();
@@ -208,6 +211,7 @@ QQuickStyleItem::QQuickStyleItem(QQuickItem *parent)
setFlag(QQuickItem::ItemHasContents, true);
setSmooth(false);
+ connect(this, SIGNAL(visibleChanged()), this, SLOT(updateItem()));
connect(this, SIGNAL(widthChanged()), this, SLOT(updateItem()));
connect(this, SIGNAL(heightChanged()), this, SLOT(updateItem()));
connect(this, SIGNAL(enabledChanged()), this, SLOT(updateItem()));
@@ -913,6 +917,7 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
frame.state = m_styleoption->state;
frame.lineWidth = qApp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, 0);
frame.rect = m_styleoption->rect;
+ frame.styleObject = this;
size = qApp->style()->sizeFromContents(QStyle::CT_LineEdit, &frame, QSize(width, height));
}
break;
@@ -1578,6 +1583,7 @@ void QQuickStyleItem::paint(QPainter *painter)
frame.lineWidth = fw;
frame.midLineWidth = 0;
frame.rect = m_styleoption->rect;
+ frame.styleObject = this;
qApp->style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, painter);
}
}
@@ -1613,7 +1619,10 @@ bool QQuickStyleItem::hasThemeIcon(const QString &icon) const
bool QQuickStyleItem::event(QEvent *ev)
{
if (ev->type() == QEvent::StyleAnimationUpdate) {
- polish();
+ if (isVisible()) {
+ ev->accept();
+ polish();
+ }
return true;
} else if (ev->type() == QEvent::StyleChange) {
if (m_itemType == ScrollBar)
@@ -1661,6 +1670,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/ScrollView.qml b/src/controls/ScrollView.qml
index 6f1187ea..7e616392 100644
--- a/src/controls/ScrollView.qml
+++ b/src/controls/ScrollView.qml
@@ -60,7 +60,7 @@ import QtQuick.Controls.Styles 1.1
Example:
\code
ScrollView {
- Image { imageSource: "largeImage.png" }
+ Image { source: "largeImage.png" }
}
\endcode
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index d87bb526..d31eb2c1 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -181,8 +181,10 @@ Control {
style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider)
- Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0
- Keys.onLeftPressed: value -= (maximumValue - minimumValue)/10.0
+ Keys.onRightPressed: if (__horizontal) value += (maximumValue - minimumValue)/10.0
+ Keys.onLeftPressed: if (__horizontal) value -= (maximumValue - minimumValue)/10.0
+ Keys.onUpPressed: if (!__horizontal) value += (maximumValue - minimumValue)/10.0
+ Keys.onDownPressed: if (!__horizontal) value -= (maximumValue - minimumValue)/10.0
RangeModel {
id: range
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index bba4eae1..4dc03d97 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,18 +164,31 @@ 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 */
function __increment() {
validator.increment()
- input.selectValue()
+ if (activeFocus)
+ input.selectValue()
}
/*! \internal */
function __decrement() {
validator.decrement()
- input.selectValue()
+ if (activeFocus)
+ input.selectValue()
}
/*! \internal */
@@ -242,7 +255,7 @@ Control {
horizontalAlignment: spinbox.horizontalAlignment
verticalAlignment: __panel ? __panel.verticalAlignment : Qt.AlignVCenter
- selectByMouse: true
+ selectByMouse: activeFocus || activeFocusOnPress
validator: SpinBoxValidator {
id: validator
@@ -255,6 +268,8 @@ Control {
selectValue()
}
+ onEditingFinished: spinbox.editingFinished()
+
color: __panel ? __panel.foregroundColor : "black"
selectionColor: __panel ? __panel.selectionColor : "black"
selectedTextColor: __panel ? __panel.selectedTextColor : "black"
diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml
index cf41a2dc..5993ce46 100644
--- a/src/controls/StatusBar.qml
+++ b/src/controls/StatusBar.qml
@@ -72,7 +72,7 @@ import QtQuick.Controls.Private 1.0
\endcode
*/
-Item {
+FocusScope {
id: statusbar
activeFocusOnTab: false
diff --git a/src/controls/Styles/Base/BusyIndicatorStyle.qml b/src/controls/Styles/Base/BusyIndicatorStyle.qml
index d53ccb29..d9f0fdb4 100644
--- a/src/controls/Styles/Base/BusyIndicatorStyle.qml
+++ b/src/controls/Styles/Base/BusyIndicatorStyle.qml
@@ -77,6 +77,8 @@ Style {
/*! This defines the appearance of the busy indicator. */
property Component indicator: Item {
+ id: indicatorItem
+
implicitWidth: 48
implicitHeight: 48
@@ -96,6 +98,7 @@ Style {
loops: Animation.Infinite
from: 0
to: 360
+ running: indicatorItem.visible && (control.running || indicatorItem.opacity > 0);
}
}
}
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/TabViewStyle.qml b/src/controls/Styles/Base/TabViewStyle.qml
index 430dd02f..29364bbb 100644
--- a/src/controls/Styles/Base/TabViewStyle.qml
+++ b/src/controls/Styles/Base/TabViewStyle.qml
@@ -142,11 +142,9 @@ Style {
implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20))
implicitHeight: Math.round(textitem.implicitHeight + 10)
- clip: true
Item {
anchors.fill: parent
anchors.bottomMargin: styleData.selected ? 0 : 2
- clip: true
BorderImage {
anchors.fill: parent
source: styleData.selected ? "images/tab_selected.png" : "images/tab.png"
@@ -157,25 +155,27 @@ Style {
anchors.topMargin: styleData.selected ? 0 : 1
}
}
- Rectangle {
- anchors.fill: textitem
- anchors.margins: -1
- anchors.leftMargin: -3
- anchors.rightMargin: -3
- visible: (styleData.activeFocus && styleData.selected)
- height: 6
- radius: 3
- color: "#224f9fef"
- border.color: "#47b"
- }
Text {
id: textitem
- anchors.centerIn: parent
- anchors.alignWhenCentered: true
+ anchors.fill: parent
+ anchors.leftMargin: 4
+ anchors.rightMargin: 4
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
text: styleData.title
+ elide: Text.ElideMiddle
renderType: Text.NativeRendering
scale: control.tabPosition === Qt.TopEdge ? 1 : -1
color: __syspal.text
+ Rectangle {
+ anchors.centerIn: parent
+ width: textitem.paintedWidth + 6
+ height: textitem.paintedHeight + 4
+ visible: (styleData.activeFocus && styleData.selected)
+ radius: 3
+ color: "#224f9fef"
+ border.color: "#47b"
+ }
}
}
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/Desktop/SliderStyle.qml b/src/controls/Styles/Desktop/SliderStyle.qml
index fd426e35..022570b2 100644
--- a/src/controls/Styles/Desktop/SliderStyle.qml
+++ b/src/controls/Styles/Desktop/SliderStyle.qml
@@ -57,6 +57,7 @@ Style {
horizontal: control.orientation === Qt.Horizontal
enabled: control.enabled
hasFocus: control.activeFocus
+ hover: control.hovered
hints: control.styleHints
activeControl: control.tickmarksEnabled ? "ticks" : ""
property int handleWidth: 15
diff --git a/src/controls/Styles/Desktop/TextAreaStyle.qml b/src/controls/Styles/Desktop/TextAreaStyle.qml
index 3f2904a3..dbcd4dce 100644
--- a/src/controls/Styles/Desktop/TextAreaStyle.qml
+++ b/src/controls/Styles/Desktop/TextAreaStyle.qml
@@ -43,17 +43,15 @@ import QtQuick.Controls.Private 1.0
ScrollViewStyle {
property font font: __styleitem.font
- property color textColor: __styleitem.textColor
+ property color textColor: __syspal.text
property color selectionColor: __syspal.highlight
property color selectedTextColor: __syspal.highlightedText
property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
property StyleItem __styleitem: StyleItem{
- property color textColor: styleHint("textColor")
elementType: "edit"
visible: false
active: control.activeFocus
- onActiveChanged: textColor = styleHint("textColor")
}
property int renderType: Text.NativeRendering
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/ToolBar.qml b/src/controls/ToolBar.qml
index 1a4c7cb6..caf1d46f 100644
--- a/src/controls/ToolBar.qml
+++ b/src/controls/ToolBar.qml
@@ -76,7 +76,7 @@ import QtQuick.Controls.Private 1.0
\endcode
*/
-Item {
+FocusScope {
id: toolbar
activeFocusOnTab: false
diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp
index 361c4683..7aa52d56 100644
--- a/src/controls/qquickmenu.cpp
+++ b/src/controls/qquickmenu.cpp
@@ -236,7 +236,7 @@ QT_BEGIN_NAMESPACE
*/
QQuickMenu::QQuickMenu(QObject *parent)
- : QQuickMenuText(parent),
+ : QQuickMenuText(parent, QQuickMenuItemType::Menu),
m_itemsCount(0),
m_selectedIndex(-1),
m_parentWindow(0),
diff --git a/src/controls/qquickmenu_p.h b/src/controls/qquickmenu_p.h
index c1fab0b5..c6bf24e2 100644
--- a/src/controls/qquickmenu_p.h
+++ b/src/controls/qquickmenu_p.h
@@ -132,7 +132,6 @@ public:
QQuickItem *menuContentItem() const { return m_menuContentItem; }
bool popupVisible() const { return m_popupVisible; }
- QQuickMenuItemType::MenuItemType type() { return QQuickMenuItemType::Menu; }
bool isNative() { return m_platformMenu != 0; }
protected Q_SLOTS:
diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp
index 60d882c4..105b66ac 100644
--- a/src/controls/qquickmenuitem.cpp
+++ b/src/controls/qquickmenuitem.cpp
@@ -51,12 +51,15 @@
QT_BEGIN_NAMESPACE
-QQuickMenuBase::QQuickMenuBase(QObject *parent)
- : QObject(parent), m_visible(true), m_parentMenu(0), m_container(0), m_visualItem(0)
-{
- m_platformItem = QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem();
- if (m_platformItem)
- m_platformItem->setRole(QPlatformMenuItem::TextHeuristicRole);
+QQuickMenuBase::QQuickMenuBase(QObject *parent, int type)
+ : QObject(parent), m_visible(true), m_type(static_cast<QQuickMenuItemType::MenuItemType>(type))
+ , m_parentMenu(0), m_container(0), m_platformItem(0), m_visualItem(0)
+{
+ if (type >= 0) {
+ m_platformItem = QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem();
+ if (m_platformItem)
+ m_platformItem->setRole(QPlatformMenuItem::TextHeuristicRole);
+ }
}
QQuickMenuBase::~QQuickMenuBase()
@@ -98,7 +101,7 @@ QQuickMenu *QQuickMenuBase::parentMenu() const
void QQuickMenuBase::setParentMenu(QQuickMenu *parentMenu)
{
- if (m_parentMenu && m_parentMenu->platformMenu())
+ if (m_platformItem && m_parentMenu && m_parentMenu->platformMenu())
m_parentMenu->platformMenu()->removeMenuItem(m_platformItem);
m_parentMenu = parentMenu;
@@ -155,14 +158,14 @@ void QQuickMenuBase::setVisualItem(QQuickItem *item)
*/
QQuickMenuSeparator::QQuickMenuSeparator(QObject *parent)
- : QQuickMenuBase(parent)
+ : QQuickMenuBase(parent, QQuickMenuItemType::Separator)
{
if (platformItem())
platformItem()->setIsSeparator(true);
}
-QQuickMenuText::QQuickMenuText(QObject *parent)
- : QQuickMenuBase(parent), m_action(new QQuickAction(this))
+QQuickMenuText::QQuickMenuText(QObject *parent, QQuickMenuItemType::MenuItemType type)
+ : QQuickMenuBase(parent, type), m_action(new QQuickAction(this))
{
connect(m_action, SIGNAL(enabledChanged()), this, SLOT(updateEnabled()));
connect(m_action, SIGNAL(textChanged()), this, SLOT(updateText()));
@@ -417,7 +420,7 @@ void QQuickMenuText::updateIcon()
*/
QQuickMenuItem::QQuickMenuItem(QObject *parent)
- : QQuickMenuText(parent), m_boundAction(0)
+ : QQuickMenuText(parent, QQuickMenuItemType::Item), m_boundAction(0)
{
connect(this, SIGNAL(__textChanged()), this, SIGNAL(textChanged()));
diff --git a/src/controls/qquickmenuitem_p.h b/src/controls/qquickmenuitem_p.h
index a0c70832..3ba719f6 100644
--- a/src/controls/qquickmenuitem_p.h
+++ b/src/controls/qquickmenuitem_p.h
@@ -66,7 +66,7 @@ class QQuickMenuItemType
public:
enum MenuItemType {
- Separator,
+ Separator = 0,
Item,
Menu
};
@@ -86,7 +86,7 @@ Q_SIGNALS:
void visibleChanged();
public:
- QQuickMenuBase(QObject *parent = 0);
+ QQuickMenuBase(QObject *parent, int type);
~QQuickMenuBase();
bool visible() const { return m_visible; }
@@ -105,11 +105,12 @@ public:
QQuickItem *visualItem() const;
void setVisualItem(QQuickItem *item);
- virtual QQuickMenuItemType::MenuItemType type() { return QQuickMenuItemType::Item; }
+ QQuickMenuItemType::MenuItemType type() { return m_type; }
virtual bool isNative() { return m_platformItem != 0; }
private:
bool m_visible;
+ QQuickMenuItemType::MenuItemType m_type;
QQuickMenu *m_parentMenu;
QQuickMenuItemContainer *m_container;
QPlatformMenuItem *m_platformItem;
@@ -121,8 +122,6 @@ class QQuickMenuSeparator : public QQuickMenuBase
Q_OBJECT
public:
QQuickMenuSeparator(QObject *parent = 0);
-
- QQuickMenuItemType::MenuItemType type() { return QQuickMenuItemType::Separator; }
};
class QQuickMenuText : public QQuickMenuBase
@@ -143,7 +142,7 @@ Q_SIGNALS:
void __iconChanged();
public:
- QQuickMenuText(QObject *parent = 0);
+ QQuickMenuText(QObject *parent, QQuickMenuItemType::MenuItemType type);
~QQuickMenuText();
bool enabled() const;
diff --git a/src/controls/qquickmenuitemcontainer_p.h b/src/controls/qquickmenuitemcontainer_p.h
index 9602c3a7..a845994e 100644
--- a/src/controls/qquickmenuitemcontainer_p.h
+++ b/src/controls/qquickmenuitemcontainer_p.h
@@ -52,7 +52,7 @@ class QQuickMenuItemContainer : public QQuickMenuBase
Q_OBJECT
public:
explicit QQuickMenuItemContainer(QObject *parent = 0)
- : QQuickMenuBase(parent)
+ : QQuickMenuBase(parent, -1)
{ }
~QQuickMenuItemContainer()
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..f63a6ee7 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"
@@ -305,6 +307,24 @@ TestCase {
compare(comboBox.editText, "Coco")
compare(comboBox.currentIndex, 1)
+ comboBox.editText = ""
+ keyPress(Qt.Key_C)
+ keyPress(Qt.Key_O)
+ keyPress(Qt.Key_C) // autocompletes "coco"
+ keyPress(Qt.Key_Backspace)
+ keyPress(Qt.Key_Return) // Accept "coc"
+ compare(comboBox.editText, "coc")
+ compare(comboBox.currentText, "coc")
+
+ comboBox.editText = ""
+ keyPress(Qt.Key_C)
+ keyPress(Qt.Key_O)
+ keyPress(Qt.Key_C) // autocompletes "coc"
+ keyPress(Qt.Key_Space)
+ keyPress(Qt.Key_Return) // Accept "coc "
+ compare(comboBox.editText, "coc ")
+ compare(comboBox.currentText, "coc ")
+
comboBox.destroy()
}
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index 9a68907c..260fc0c1 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -343,6 +343,16 @@ 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; \
@@ -546,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("
@@ -578,7 +618,33 @@ Item {
downCoord.y = item.y + item.height - arrowMargin
}
+ function test_fixup() {
+ var spinbox = Qt.createQmlObject('import QtQuick.Controls 1.1; SpinBox { minimumValue: -1 }', container, '')
+ verify(spinbox)
+ spinbox.forceActiveFocus()
+ verify(spinbox.activeFocus)
+
+ keyClick(Qt.Key_Minus)
+ keyClick(Qt.Key_0)
+ compare(spinbox.__text, "-0")
+
+ // fixup "-0" to "0" on accept
+ keyClick(Qt.Key_Enter)
+ compare(spinbox.__text, "0")
+ spinbox.prefix = "pfx"
+ spinbox.suffix = "sfx"
+ keyClick(Qt.Key_A, Qt.ControlModifier)
+ keyClick(Qt.Key_Minus)
+ keyClick(Qt.Key_0)
+ compare(spinbox.__text, "pfx-0sfx")
+
+ // fixup "-0" to "0" on defocus
+ spinbox.focus = false
+ compare(spinbox.__text, "pfx0sfx")
+
+ spinbox.destroy()
+ }
}
}
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()
+ }
}
}