aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-11-20 13:49:15 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-11-20 13:49:15 +0100
commitfe4505386f7136f9475099901b4770bfb566818d (patch)
treee8ae23eb75295483bdfedc90de0910b84746b09d
parent44b191636795a1f4baa984f49cd8330d2cd74585 (diff)
parentcbf8342526c071bc77c3764e7a28c3cfe587bb80 (diff)
Merge 5.10 into 5.10.0
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-button-icononly.qml8
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-button-textbesideicon.qml8
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-button-textonly.qml8
-rw-r--r--src/imports/platform/qquickplatformmenu_p.h1
-rw-r--r--src/imports/platform/qquickplatformstandardpaths_p.h2
-rw-r--r--src/imports/platform/qquickplatformsystemtrayicon_p.h2
-rw-r--r--src/imports/platform/qtlabsplatformplugin.cpp6
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp15
-rw-r--r--src/quicktemplates2/qquickslider.cpp6
-rw-r--r--tests/auto/controls/data/tst_slider.qml6
-rw-r--r--tests/auto/platform/data/tst_messagedialog.qml42
-rw-r--r--tests/auto/platform/data/tst_systemtrayicon.qml32
12 files changed, 107 insertions, 29 deletions
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-icononly.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-icononly.qml
index 43110494..32b0797a 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-icononly.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-button-icononly.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-textbesideicon.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-textbesideicon.qml
index e3be7a4b..870da262 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-textbesideicon.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-button-textbesideicon.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-textonly.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-textonly.qml
index 883340dc..fe871639 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-textonly.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-button-textonly.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/platform/qquickplatformmenu_p.h b/src/imports/platform/qquickplatformmenu_p.h
index 7456c660..b5c23b61 100644
--- a/src/imports/platform/qquickplatformmenu_p.h
+++ b/src/imports/platform/qquickplatformmenu_p.h
@@ -209,5 +209,6 @@ private:
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickPlatformMenu)
+Q_DECLARE_METATYPE(QPlatformMenu::MenuType)
#endif // QQUICKPLATFORMMENU_P_H
diff --git a/src/imports/platform/qquickplatformstandardpaths_p.h b/src/imports/platform/qquickplatformstandardpaths_p.h
index c3d879b0..e2f4e11e 100644
--- a/src/imports/platform/qquickplatformstandardpaths_p.h
+++ b/src/imports/platform/qquickplatformstandardpaths_p.h
@@ -86,5 +86,7 @@ private:
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickPlatformStandardPaths)
+Q_DECLARE_METATYPE(QStandardPaths::StandardLocation)
+Q_DECLARE_METATYPE(QStandardPaths::LocateOptions)
#endif // QQUICKPLATFORMSTANDARDPATHS_P_H
diff --git a/src/imports/platform/qquickplatformsystemtrayicon_p.h b/src/imports/platform/qquickplatformsystemtrayicon_p.h
index 7aa07512..77a78f30 100644
--- a/src/imports/platform/qquickplatformsystemtrayicon_p.h
+++ b/src/imports/platform/qquickplatformsystemtrayicon_p.h
@@ -137,5 +137,7 @@ private:
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickPlatformSystemTrayIcon)
+Q_DECLARE_METATYPE(QPlatformSystemTrayIcon::ActivationReason)
+Q_DECLARE_METATYPE(QPlatformSystemTrayIcon::MessageIcon)
#endif // QQUICKPLATFORMSYSTEMTRAYICON_P_H
diff --git a/src/imports/platform/qtlabsplatformplugin.cpp b/src/imports/platform/qtlabsplatformplugin.cpp
index bcb9ac98..1eac7d80 100644
--- a/src/imports/platform/qtlabsplatformplugin.cpp
+++ b/src/imports/platform/qtlabsplatformplugin.cpp
@@ -56,9 +56,6 @@
# include "qquickplatformsystemtrayicon_p.h"
#endif
-Q_DECLARE_METATYPE(QStandardPaths::StandardLocation)
-Q_DECLARE_METATYPE(QStandardPaths::LocateOptions)
-
static inline void initResources()
{
#ifdef QT_STATIC
@@ -102,6 +99,7 @@ void QtLabsPlatformPlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickPlatformMenuItem>(uri, 1, 0, "MenuItem");
qmlRegisterType<QQuickPlatformMenuItemGroup>(uri, 1, 0, "MenuItemGroup");
qmlRegisterType<QQuickPlatformMenuSeparator>(uri, 1, 0, "MenuSeparator");
+ qRegisterMetaType<QPlatformMenu::MenuType>();
qmlRegisterUncreatableType<QPlatformDialogHelper>(uri, 1, 0, "StandardButton", QQuickPlatformDialog::tr("Cannot create an instance of StandardButton"));
qmlRegisterSingletonType<QQuickPlatformStandardPaths>(uri, 1, 0, "StandardPaths", QQuickPlatformStandardPaths::create);
@@ -110,6 +108,8 @@ void QtLabsPlatformPlugin::registerTypes(const char *uri)
#if QT_CONFIG(systemtrayicon)
qmlRegisterType<QQuickPlatformSystemTrayIcon>(uri, 1, 0, "SystemTrayIcon");
+ qRegisterMetaType<QPlatformSystemTrayIcon::ActivationReason>();
+ qRegisterMetaType<QPlatformSystemTrayIcon::MessageIcon>();
#endif
}
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index b6a9d757..cd971139 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -197,13 +197,13 @@ static QRectF alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment
qreal w = size.width();
qreal h = size.height();
if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter)
- y += rectangle.size().height() / 2 - h / 2;
+ y += (rectangle.size().height() - h) / 2;
else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom)
y += rectangle.size().height() - h;
if ((alignment & Qt::AlignRight) == Qt::AlignRight)
x += rectangle.size().width() - w;
else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter)
- x += rectangle.size().width() / 2 - w / 2;
+ x += (rectangle.size().width() - w) / 2;
return QRectF(x, y, w, h);
}
@@ -213,15 +213,12 @@ void QQuickDialogButtonBoxPrivate::resizeContent()
if (!contentItem)
return;
- const int halign = alignment & Qt::AlignHorizontal_Mask;
- const int valign = alignment & Qt::AlignVertical_Mask;
-
- const qreal cw = !halign ? q->availableWidth() : contentItem->implicitWidth();
- const qreal ch = !valign ? q->availableHeight() : contentItem->implicitHeight();
-
QRectF geometry = q->boundingRect().adjusted(q->leftPadding(), q->topPadding(), -q->rightPadding(), -q->bottomPadding());
- if (halign || valign)
+ if (alignment != 0) {
+ qreal cw = (alignment & Qt::AlignHorizontal_Mask) == 0 ? q->availableWidth() : contentItem->implicitWidth();
+ qreal ch = (alignment & Qt::AlignVertical_Mask) == 0 ? q->availableHeight() : contentItem->implicitHeight();
geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(cw, ch), geometry);
+ }
contentItem->setPosition(geometry.topLeft());
contentItem->setSize(geometry.size());
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 8628f981..b358663d 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -545,10 +545,10 @@ void QQuickSlider::setHandle(QQuickItem *handle)
qreal QQuickSlider::valueAt(qreal position) const
{
Q_D(const QQuickSlider);
- const qreal value = d->from + (d->to - d->from) * position;
+ const qreal value = (d->to - d->from) * position;
if (qFuzzyIsNull(d->stepSize))
- return value;
- return qRound(value / d->stepSize) * d->stepSize;
+ return d->from + value;
+ return d->from + qRound(value / d->stepSize) * d->stepSize;
}
/*!
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index b70aeaab..a831e402 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -776,12 +776,14 @@ TestCase {
return [
{ tag: "0.0..1.0", from: 0.0, to: 1.0, values: [0.0, 0.2, 0.5, 1.0] },
{ tag: "0..100", from: 0, to: 100, values: [0, 20, 50, 100] },
- { tag: "100..-100", from: 100, to: -100, values: [100, 60, 0, -100] }
+ { tag: "100..-100", from: 100, to: -100, values: [100, 60, 0, -100] },
+ { tag: "-7..7", from: -7, to: 7, stepSize: 1.0, values: [-7.0, -4.0, 0.0, 7.0] },
+ { tag: "-3..7", from: -3, to: 7, stepSize: 5.0, values: [-3.0, -3.0, 2.0, 7.0] },
]
}
function test_valueAt(data) {
- var control = createTemporaryObject(slider, testCase, {from: data.from, to: data.to})
+ var control = createTemporaryObject(slider, testCase, {from: data.from, to: data.to, stepSize: data.stepSize})
verify(control)
compare(control.valueAt(0.0), data.values[0])
diff --git a/tests/auto/platform/data/tst_messagedialog.qml b/tests/auto/platform/data/tst_messagedialog.qml
index 8415f429..cf51c27d 100644
--- a/tests/auto/platform/data/tst_messagedialog.qml
+++ b/tests/auto/platform/data/tst_messagedialog.qml
@@ -63,9 +63,51 @@ TestCase {
MessageDialog { }
}
+ SignalSpy {
+ id: spy
+ }
+
function test_instance() {
var dialog = messageDialog.createObject(testCase)
verify(dialog)
dialog.destroy()
}
+
+ function test_standardButtons() {
+ // Q_FLAGS(QPlatformDialogHelper::StandardButtons)
+ compare(MessageDialog.NoButton , 0x00000000)
+ compare(MessageDialog.Ok , 0x00000400)
+ compare(MessageDialog.Save , 0x00000800)
+ compare(MessageDialog.SaveAll , 0x00001000)
+ compare(MessageDialog.Open , 0x00002000)
+ compare(MessageDialog.Yes , 0x00004000)
+ compare(MessageDialog.YesToAll , 0x00008000)
+ compare(MessageDialog.No , 0x00010000)
+ compare(MessageDialog.NoToAll , 0x00020000)
+ compare(MessageDialog.Abort , 0x00040000)
+ compare(MessageDialog.Retry , 0x00080000)
+ compare(MessageDialog.Ignore , 0x00100000)
+ compare(MessageDialog.Close , 0x00200000)
+ compare(MessageDialog.Cancel , 0x00400000)
+ compare(MessageDialog.Discard , 0x00800000)
+ compare(MessageDialog.Help , 0x01000000)
+ compare(MessageDialog.Apply , 0x02000000)
+ compare(MessageDialog.Reset , 0x04000000)
+ compare(MessageDialog.RestoreDefaults, 0x08000000)
+ }
+
+ function test_clicked() {
+ var dialog = messageDialog.createObject(testCase)
+ verify(dialog)
+
+ spy.target = dialog
+ spy.signalName = "clicked"
+
+ dialog.clicked(MessageDialog.Yes)
+ compare(spy.count, 1)
+ compare(spy.signalArguments[0][0], MessageDialog.Yes)
+
+ spy.clear()
+ dialog.destroy()
+ }
}
diff --git a/tests/auto/platform/data/tst_systemtrayicon.qml b/tests/auto/platform/data/tst_systemtrayicon.qml
index 62e231c0..ea6f731a 100644
--- a/tests/auto/platform/data/tst_systemtrayicon.qml
+++ b/tests/auto/platform/data/tst_systemtrayicon.qml
@@ -97,4 +97,36 @@ TestCase {
spy.clear()
icon.destroy()
}
+
+ function test_messageIcon() {
+ // Q_ENUMS(QPlatformSystemTrayIcon::ActivationReason)
+ compare(SystemTrayIcon.NoIcon, 0)
+ compare(SystemTrayIcon.Information, 1)
+ compare(SystemTrayIcon.Warning, 2)
+ compare(SystemTrayIcon.Critical, 3)
+ }
+
+ function test_activationReason() {
+ // Q_ENUMS(QPlatformSystemTrayIcon::ActivationReason)
+ compare(SystemTrayIcon.Unknown, 0)
+ compare(SystemTrayIcon.Context, 1)
+ compare(SystemTrayIcon.DoubleClick, 2)
+ compare(SystemTrayIcon.Trigger, 3)
+ compare(SystemTrayIcon.MiddleClick, 4)
+ }
+
+ function test_activated() {
+ var icon = systemTrayIcon.createObject(testCase)
+ verify(icon)
+
+ spy.target = icon
+ spy.signalName = "activated"
+
+ icon.activated(SystemTrayIcon.Trigger)
+ compare(spy.count, 1)
+ compare(spy.signalArguments[0][0], SystemTrayIcon.Trigger)
+
+ spy.clear()
+ icon.destroy()
+ }
}