aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2020-02-15 10:19:38 +0100
committerLiang Qi <liang.qi@qt.io>2020-02-15 10:19:38 +0100
commitc9260cd940fe9ca0e440b715cbfc13dd046e07b0 (patch)
tree9e4a97453f79dc7cf25434785e72920172535afd /src
parent8f9f0508e4f3469ae56874fcecc89023b51c2a75 (diff)
parent025f938c1b4676782674d54375e1e4e560e4b6cd (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: .qmake.conf tests/auto/qquickpopup/tst_qquickpopup.cpp Change-Id: Id3bca2da290234f3c69845ffe18c6d9193a1bd28
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/controls.pro2
-rw-r--r--src/imports/controls/designer/qtquickcontrols2.metainfo4
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml8
-rw-r--r--src/quickcontrols2/qquickstyle.cpp9
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp12
-rw-r--r--src/quicktemplates2/qquickcontrol_p_p.h2
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp7
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp5
8 files changed, 37 insertions, 12 deletions
diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro
index 2aeaf9ab..66373d55 100644
--- a/src/imports/controls/controls.pro
+++ b/src/imports/controls/controls.pro
@@ -19,7 +19,7 @@ SOURCES += \
RESOURCES += \
$$PWD/qtquickcontrols2plugin.qrc
-!static: qtConfig(quick-designer): include(designer/designer.pri)
+qtConfig(quick-designer): include(designer/designer.pri)
include(doc/doc.pri)
CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler
diff --git a/src/imports/controls/designer/qtquickcontrols2.metainfo b/src/imports/controls/designer/qtquickcontrols2.metainfo
index 9e6030b1..d27f1b90 100644
--- a/src/imports/controls/designer/qtquickcontrols2.metainfo
+++ b/src/imports/controls/designer/qtquickcontrols2.metainfo
@@ -443,7 +443,7 @@ MetaInfo {
version: "2.0"
requiredImport: "QtQuick.Controls"
- Property { name: "text"; type: "binding"; value: "qsTr(\"Text Area\")" }
+ Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Area\")" }
}
}
@@ -458,7 +458,7 @@ MetaInfo {
version: "2.0"
requiredImport: "QtQuick.Controls"
- Property { name: "text"; type: "binding"; value: "qsTr(\"Text Field\")" }
+ Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Field\")" }
}
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml
index 1c5db214..b8510ddd 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml
@@ -54,22 +54,22 @@ RangeSlider {
}
first.handle: Rectangle {
- x: control.leftPadding + first.visualPosition * (control.availableWidth - width)
+ x: control.leftPadding + control.first.visualPosition * (control.availableWidth - width)
y: control.topPadding + control.availableHeight / 2 - height / 2
implicitWidth: 26
implicitHeight: 26
radius: 13
- color: first.pressed ? "#f0f0f0" : "#f6f6f6"
+ color: control.first.pressed ? "#f0f0f0" : "#f6f6f6"
border.color: "#bdbebf"
}
second.handle: Rectangle {
- x: control.leftPadding + second.visualPosition * (control.availableWidth - width)
+ x: control.leftPadding + control.second.visualPosition * (control.availableWidth - width)
y: control.topPadding + control.availableHeight / 2 - height / 2
implicitWidth: 26
implicitHeight: 26
radius: 13
- color: second.pressed ? "#f0f0f0" : "#f6f6f6"
+ color: control.second.pressed ? "#f0f0f0" : "#f6f6f6"
border.color: "#bdbebf"
}
}
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index 7a3359ef..61632b11 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -128,6 +128,7 @@ static QStringList defaultImportPathList()
importPaths += QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
# endif
#endif
+ importPaths += envPathList("QML2_IMPORT_PATH");
importPaths += QStringLiteral(":/qt-project.org/imports");
importPaths += QCoreApplication::applicationDirPath();
return importPaths;
@@ -384,7 +385,13 @@ void QQuickStylePrivate::init(const QUrl &baseUrl)
spec->resolve(baseUrl);
if (!spec->fallbackStyle.isEmpty()) {
- QString fallbackStyle = spec->findStyle(QQmlFile::urlToLocalFileOrQrc(baseUrl), spec->fallbackStyle);
+ QString fallbackStyle;
+ const QStringList stylePaths = QQuickStylePrivate::stylePaths();
+ for (const QString &path : stylePaths) {
+ fallbackStyle = spec->findStyle(path, spec->fallbackStyle);
+ if (!fallbackStyle.isEmpty())
+ break;
+ }
if (fallbackStyle.isEmpty()) {
if (spec->fallbackStyle.compare(QStringLiteral("Default")) != 0) {
qWarning() << "ERROR: unable to locate fallback style" << spec->fallbackStyle;
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 6b845ae6..4eb411c2 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -180,6 +180,12 @@ bool QQuickControlPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
return true;
}
+ // If the control is on a Flickable that has a pressDelay, then the press is never
+ // sent as a touch event, therefore we need to check for this case.
+ if (touchId == -1 && pressWasTouch && point.state() == Qt::TouchPointReleased &&
+ point.pos() == previousPressPos) {
+ return true;
+ }
return false;
}
#endif
@@ -215,6 +221,8 @@ void QQuickControlPrivate::handleRelease(const QPointF &)
if ((focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && QGuiApplication::styleHints()->setFocusOnTouchRelease())
setActiveFocus(q, Qt::MouseFocusReason);
touchId = -1;
+ pressWasTouch = false;
+ previousPressPos = QPointF();
}
void QQuickControlPrivate::handleUngrab()
@@ -2121,6 +2129,10 @@ void QQuickControl::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickControl);
d->handlePress(event->localPos());
+ if (event->source() == Qt::MouseEventSynthesizedByQt) {
+ d->pressWasTouch = true;
+ d->previousPressPos = event->localPos();
+ }
event->accept();
}
diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h
index b649db0a..fa06c97f 100644
--- a/src/quicktemplates2/qquickcontrol_p_p.h
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
@@ -230,7 +230,9 @@ public:
bool explicitHoverEnabled = false;
#endif
bool resizingBackground = false;
+ bool pressWasTouch = false;
int touchId = -1;
+ QPointF previousPressPos;
qreal padding = 0;
qreal horizontalPadding = 0;
qreal verticalPadding = 0;
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 2c09cd11..f3dd2da1 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -455,8 +455,11 @@ void QQuickDialogButtonBoxPrivate::updateLanguage()
qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, true));
const auto boxAttachedPrivate = QQuickDialogButtonBoxAttachedPrivate::get(attached);
const QPlatformDialogHelper::StandardButton standardButton = boxAttachedPrivate->standardButton;
- const QString buttonText = QGuiApplicationPrivate::platformTheme()->standardButtonText(standardButton);
- button->setText(QPlatformTheme::removeMnemonics(buttonText));
+ // The button might be a custom one with explicitly specified text, so we shouldn't change it in that case.
+ if (standardButton != QPlatformDialogHelper::NoButton) {
+ const QString buttonText = QGuiApplicationPrivate::platformTheme()->standardButtonText(standardButton);
+ button->setText(QPlatformTheme::removeMnemonics(buttonText));
+ }
}
--i;
}
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 9ea0160e..9d733c94 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -557,8 +557,9 @@ void QQuickToolTipAttached::hide()
QQuickToolTip *tip = d->instance(false);
if (!tip)
return;
-
- tip->close();
+ // check the parent item to prevent unexpectedly closing tooltip by new created invisible tooltip
+ if (parent() == tip->parentItem())
+ tip->close();
}
QT_END_NAMESPACE