aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.12.528
-rw-r--r--dist/changes-5.13.131
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp44
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p_p.h2
-rw-r--r--src/quicktemplates2/qquickicon.cpp25
-rw-r--r--src/quicktemplates2/qquickicon_p.h2
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml8
-rw-r--r--tests/auto/controls/data/tst_dial.qml18
-rw-r--r--tests/auto/translation/data/dialogButtonBox.qml61
-rw-r--r--tests/auto/translation/qtbase_fr.ts22
-rw-r--r--tests/auto/translation/translation.pro19
-rw-r--r--tests/auto/translation/tst_translation.cpp100
12 files changed, 342 insertions, 18 deletions
diff --git a/dist/changes-5.12.5 b/dist/changes-5.12.5
new file mode 100644
index 00000000..3d5d25e7
--- /dev/null
+++ b/dist/changes-5.12.5
@@ -0,0 +1,28 @@
+Qt 5.12.5 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.0 through 5.12.4.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Controls *
+****************************************************************************
+
+ - TextArea:
+ * [QTBUG-76369] Fixed rendering issue using the Material style.
+
+ - Container
+ * [QTBUG-76164] Fixed crash when removing items.
diff --git a/dist/changes-5.13.1 b/dist/changes-5.13.1
new file mode 100644
index 00000000..3acd7b6e
--- /dev/null
+++ b/dist/changes-5.13.1
@@ -0,0 +1,31 @@
+Qt 5.13.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.13.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Controls *
+****************************************************************************
+
+ - [QTBUG-76356] Accessibility: a Switch now has checkbox as its accessibleRole.
+ - [QTBUG-75572] Fixed an issue with transforming Shortcut.sequence to string.
+ - [QTBUG-75844] The text cursor no longer disappears while dragging it
+ around on iOS with the magnifier showing.
+ - [QTBUG-75972] The countChanged signal now will be emitted when a new
+ model is set on a ComboBox.
+ - [QTBUG-67343] It's now OK to use a ShaderEffect in a ComboBox delegate
+ (fixed in Qt Quick, tested in Controls 2)
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 91fb41f2..10d80778 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -430,7 +430,8 @@ void QQuickDialogButtonBoxPrivate::removeStandardButtons()
while (i >= 0) {
QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(q->itemAt(i));
if (button) {
- QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, false));
+ QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(
+ qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, false));
if (attached) {
QQuickDialogButtonBoxAttachedPrivate *p = QQuickDialogButtonBoxAttachedPrivate::get(attached);
if (p->standardButton != QPlatformDialogHelper::NoButton) {
@@ -443,6 +444,24 @@ void QQuickDialogButtonBoxPrivate::removeStandardButtons()
}
}
+void QQuickDialogButtonBoxPrivate::updateLanguage()
+{
+ Q_Q(QQuickDialogButtonBox);
+ int i = q->count() - 1;
+ while (i >= 0) {
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(itemAt(i));
+ if (button) {
+ QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(
+ 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));
+ }
+ --i;
+ }
+}
+
QQuickDialogButtonBox::QQuickDialogButtonBox(QQuickItem *parent)
: QQuickContainer(*(new QQuickDialogButtonBoxPrivate), parent)
{
@@ -684,11 +703,34 @@ void QQuickDialogButtonBox::updatePolish()
d->updateLayout();
}
+class LanguageEventFilter : public QObject
+{
+public:
+ LanguageEventFilter(QQuickDialogButtonBoxPrivate *box)
+ : QObject(box->q_ptr)
+ , boxPrivate(box)
+ {
+ }
+
+protected:
+ bool eventFilter(QObject *, QEvent *event)
+ {
+ if (event->type() == QEvent::LanguageChange)
+ boxPrivate->updateLanguage();
+ return false;
+ }
+
+private:
+ QQuickDialogButtonBoxPrivate *boxPrivate;
+};
+
void QQuickDialogButtonBox::componentComplete()
{
Q_D(QQuickDialogButtonBox);
QQuickContainer::componentComplete();
d->updateLayout();
+ // TODO: use the solution in QTBUG-78141 instead, when it's implemented.
+ qApp->installEventFilter(new LanguageEventFilter(d));
}
void QQuickDialogButtonBox::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
index 66386911..6f9c9033 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
@@ -78,6 +78,8 @@ public:
QQuickAbstractButton *createStandardButton(QPlatformDialogHelper::StandardButton button);
void removeStandardButtons();
+ void updateLanguage();
+
Qt::Alignment alignment = 0;
QQuickDialogButtonBox::Position position = QQuickDialogButtonBox::Footer;
QPlatformDialogHelper::StandardButtons standardButtons = QPlatformDialogHelper::NoButton;
diff --git a/src/quicktemplates2/qquickicon.cpp b/src/quicktemplates2/qquickicon.cpp
index 5a689108..bf0a4658 100644
--- a/src/quicktemplates2/qquickicon.cpp
+++ b/src/quicktemplates2/qquickicon.cpp
@@ -112,12 +112,14 @@ void QQuickIcon::setName(const QString &name)
if ((d->resolveMask & QQuickIconPrivate::NameResolved) && d->name == name)
return;
+ d.detach();
d->name = name;
d->resolveMask |= QQuickIconPrivate::NameResolved;
}
void QQuickIcon::resetName()
{
+ d.detach();
d->name = QString();
d->resolveMask &= ~QQuickIconPrivate::NameResolved;
}
@@ -132,12 +134,14 @@ void QQuickIcon::setSource(const QUrl &source)
if ((d->resolveMask & QQuickIconPrivate::SourceResolved) && d->source == source)
return;
+ d.detach();
d->source = source;
d->resolveMask |= QQuickIconPrivate::SourceResolved;
}
void QQuickIcon::resetSource()
{
+ d.detach();
d->source = QString();
d->resolveMask &= ~QQuickIconPrivate::SourceResolved;
}
@@ -152,12 +156,14 @@ void QQuickIcon::setWidth(int width)
if ((d->resolveMask & QQuickIconPrivate::WidthResolved) && d->width == width)
return;
+ d.detach();
d->width = width;
d->resolveMask |= QQuickIconPrivate::WidthResolved;
}
void QQuickIcon::resetWidth()
{
+ d.detach();
d->width = 0;
d->resolveMask &= ~QQuickIconPrivate::WidthResolved;
}
@@ -172,12 +178,14 @@ void QQuickIcon::setHeight(int height)
if ((d->resolveMask & QQuickIconPrivate::HeightResolved) && d->height == height)
return;
+ d.detach();
d->height = height;
d->resolveMask |= QQuickIconPrivate::HeightResolved;
}
void QQuickIcon::resetHeight()
{
+ d.detach();
d->height = 0;
d->resolveMask &= ~QQuickIconPrivate::HeightResolved;
}
@@ -192,12 +200,14 @@ void QQuickIcon::setColor(const QColor &color)
if ((d->resolveMask & QQuickIconPrivate::ColorResolved) && d->color == color)
return;
+ d.detach();
d->color = color;
d->resolveMask |= QQuickIconPrivate::ColorResolved;
}
void QQuickIcon::resetColor()
{
+ d.detach();
d->color = Qt::transparent;
d->resolveMask &= ~QQuickIconPrivate::ColorResolved;
}
@@ -212,12 +222,14 @@ void QQuickIcon::setCache(bool cache)
if ((d->resolveMask & QQuickIconPrivate::CacheResolved) && d->cache == cache)
return;
+ d.detach();
d->cache = cache;
d->resolveMask |= QQuickIconPrivate::CacheResolved;
}
void QQuickIcon::resetCache()
{
+ d.detach();
d->cache = true;
d->resolveMask &= ~QQuickIconPrivate::CacheResolved;
}
@@ -225,24 +237,25 @@ void QQuickIcon::resetCache()
QQuickIcon QQuickIcon::resolve(const QQuickIcon &other) const
{
QQuickIcon resolved = *this;
+ resolved.d.detach();
if (!(d->resolveMask & QQuickIconPrivate::NameResolved))
- resolved.setName(other.name());
+ resolved.d->name = other.d->name;
if (!(d->resolveMask & QQuickIconPrivate::SourceResolved))
- resolved.setSource(other.source());
+ resolved.d->source = other.d->source;
if (!(d->resolveMask & QQuickIconPrivate::WidthResolved))
- resolved.setWidth(other.width());
+ resolved.d->width = other.d->width;
if (!(d->resolveMask & QQuickIconPrivate::HeightResolved))
- resolved.setHeight(other.height());
+ resolved.d->height = other.d->height;
if (!(d->resolveMask & QQuickIconPrivate::ColorResolved))
- resolved.setColor(other.color());
+ resolved.d->color = other.d->color;
if (!(d->resolveMask & QQuickIconPrivate::CacheResolved))
- resolved.setCache(other.cache());
+ resolved.d->cache = other.d->cache;
return resolved;
}
diff --git a/src/quicktemplates2/qquickicon_p.h b/src/quicktemplates2/qquickicon_p.h
index 57cab720..1835585d 100644
--- a/src/quicktemplates2/qquickicon_p.h
+++ b/src/quicktemplates2/qquickicon_p.h
@@ -107,7 +107,7 @@ public:
QQuickIcon resolve(const QQuickIcon &other) const;
private:
- QSharedDataPointer<QQuickIconPrivate> d;
+ QExplicitlySharedDataPointer<QQuickIconPrivate> d;
};
QT_END_NAMESPACE
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index 80155f69..ee26a6d6 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -599,7 +599,7 @@ TestCase {
AbstractButton {
action: Action {
text: "Default"
- icon.name: "default"
+ icon.name: checked ? "checked" : "unchecked"
icon.source: "qrc:/icons/default.png"
checkable: true
checked: true
@@ -617,6 +617,7 @@ TestCase {
compare(control.checkable, true)
compare(control.checked, true)
compare(control.enabled, false)
+ compare(control.icon.name, "checked")
var textSpy = signalSpy.createObject(control, { target: control, signalName: "textChanged" })
verify(textSpy.valid)
@@ -630,6 +631,7 @@ TestCase {
compare(control.checkable, false) // propagates
compare(control.checked, false) // propagates
compare(control.enabled, true) // propagates
+ compare(control.icon.name, "unchecked") // propagates
compare(textSpy.count, 1)
// changes via button
@@ -637,19 +639,23 @@ TestCase {
control.checkable = true
control.checked = true
control.enabled = false
+ control.icon.name = "default"
compare(control.text, "Button")
compare(control.checkable, true)
compare(control.checked, true)
compare(control.enabled, false)
+ compare(control.icon.name, "default")
compare(control.action.text, "Action") // does NOT propagate
compare(control.action.checkable, true) // propagates
compare(control.action.checked, true) // propagates
compare(control.action.enabled, true) // does NOT propagate
+ compare(control.action.icon.name, control.action.checked ? "checked" : "unchecked") // does NOT propagate
compare(textSpy.count, 2)
// remove the action so that only the button's properties are left
control.action = null
compare(control.text, "Button")
+ compare(control.icon.name, "default")
compare(textSpy.count, 2)
// setting an action while button has a particular property set
diff --git a/tests/auto/controls/data/tst_dial.qml b/tests/auto/controls/data/tst_dial.qml
index cd2f6112..86999594 100644
--- a/tests/auto/controls/data/tst_dial.qml
+++ b/tests/auto/controls/data/tst_dial.qml
@@ -470,15 +470,15 @@ TestCase {
function test_snapMode_data(immediate) {
return [
- { tag: "NoSnap", snapMode: Slider.NoSnap, from: 0, to: 2, values: [0, 0, 1], positions: [0, 0.5, 0.5] },
- { tag: "SnapAlways (0..2)", snapMode: Slider.SnapAlways, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapAlways (1..3)", snapMode: Slider.SnapAlways, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapAlways (-1..1)", snapMode: Slider.SnapAlways, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [0.5, 0.5, 0.5] },
- { tag: "SnapAlways (1..-1)", snapMode: Slider.SnapAlways, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapOnRelease (0..2)", snapMode: Slider.SnapOnRelease, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapOnRelease (1..3)", snapMode: Slider.SnapOnRelease, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
- { tag: "SnapOnRelease (-1..1)", snapMode: Slider.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [immediate ? 0.0 : 0.5, 0.5, 0.5] },
- { tag: "SnapOnRelease (1..-1)", snapMode: Slider.SnapOnRelease, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] }
+ { tag: "NoSnap", snapMode: Dial.NoSnap, from: 0, to: 2, values: [0, 0, 1], positions: [0, 0.5, 0.5] },
+ { tag: "SnapAlways (0..2)", snapMode: Dial.SnapAlways, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapAlways (1..3)", snapMode: Dial.SnapAlways, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapAlways (-1..1)", snapMode: Dial.SnapAlways, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [0.5, 0.5, 0.5] },
+ { tag: "SnapAlways (1..-1)", snapMode: Dial.SnapAlways, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (0..2)", snapMode: Dial.SnapOnRelease, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (1..3)", snapMode: Dial.SnapOnRelease, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (-1..1)", snapMode: Dial.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [immediate ? 0.0 : 0.5, 0.5, 0.5] },
+ { tag: "SnapOnRelease (1..-1)", snapMode: Dial.SnapOnRelease, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] }
]
}
diff --git a/tests/auto/translation/data/dialogButtonBox.qml b/tests/auto/translation/data/dialogButtonBox.qml
new file mode 100644
index 00000000..03a3ae0e
--- /dev/null
+++ b/tests/auto/translation/data/dialogButtonBox.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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 The Qt Company Ltd 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.13
+import QtQuick.Controls 2.13
+
+Item {
+ property Dialog dialog: Dialog {
+ width: 300
+ height: 300
+ visible: true
+ standardButtons: DialogButtonBox.Save | DialogButtonBox.Discard
+ }
+}
diff --git a/tests/auto/translation/qtbase_fr.ts b/tests/auto/translation/qtbase_fr.ts
new file mode 100644
index 00000000..a2a05a07
--- /dev/null
+++ b/tests/auto/translation/qtbase_fr.ts
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="fr_FR">
+<context>
+ <name>QPlatformTheme</name>
+ <message>
+ <source>Save</source>
+ <translation>Enregistrer</translation>
+ </message>
+ <message>
+ <source>Discard</source>
+ <translation>Ne pas tenir compte</translation>
+ </message>
+</context>
+<context>
+ <name>QGnomeTheme</name>
+ <message>
+ <source>&amp;Save</source>
+ <translation>&amp;Enregistrer</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/translation/translation.pro b/tests/auto/translation/translation.pro
new file mode 100644
index 00000000..d2d9d6ee
--- /dev/null
+++ b/tests/auto/translation/translation.pro
@@ -0,0 +1,19 @@
+CONFIG += testcase
+TARGET = tst_translation
+SOURCES += tst_translation.cpp
+
+macos:CONFIG -= app_bundle
+
+QT += testlib gui-private quicktemplates2-private
+
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/*.qml
+
+# We only want to run lrelease, which is why we use EXTRA_TRANSLATIONS.
+EXTRA_TRANSLATIONS = qtbase_fr.ts
+# Embed the translations in a qrc file.
+CONFIG += lrelease embed_translations
diff --git a/tests/auto/translation/tst_translation.cpp b/tests/auto/translation/tst_translation.cpp
new file mode 100644
index 00000000..9cbca915
--- /dev/null
+++ b/tests/auto/translation/tst_translation.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** 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.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/qtest.h>
+#include "../shared/visualtestutil.h"
+
+#include <QtCore/qtranslator.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+#include <QtQuickTemplates2/private/qquickdialog_p.h>
+#include <QtQuickTemplates2/private/qquickdialogbuttonbox_p.h>
+
+using namespace QQuickVisualTestUtil;
+
+class tst_translation : public QQmlDataTest
+{
+ Q_OBJECT
+
+private slots:
+ void dialogButtonBox();
+};
+
+void tst_translation::dialogButtonBox()
+{
+ QQuickView view(testFileUrl("dialogButtonBox.qml"));
+ if (view.status() != QQuickView::Ready)
+ QFAIL("Failed to load QML file");
+ view.show();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+
+ QQuickDialog *dialog = view.rootObject()->property("dialog").value<QQuickDialog*>();
+ QVERIFY(dialog);
+
+ QQuickDialogButtonBox *dialogButtonBox = qobject_cast<QQuickDialogButtonBox*>(dialog->footer());
+ QVERIFY(dialogButtonBox);
+
+ QQuickAbstractButton *saveButton = dialogButtonBox->standardButton(QPlatformDialogHelper::Save);
+ QVERIFY(saveButton);
+ QString defaultSaveText = QGuiApplicationPrivate::platformTheme()->standardButtonText(QPlatformDialogHelper::Save);
+ defaultSaveText = QPlatformTheme::removeMnemonics(defaultSaveText);
+ QCOMPARE(saveButton->text(), defaultSaveText);
+
+ QQuickAbstractButton *discardButton = dialogButtonBox->standardButton(QPlatformDialogHelper::Discard);
+ QVERIFY(discardButton);
+ QString defaultDiscardText = QGuiApplicationPrivate::platformTheme()->standardButtonText(QPlatformDialogHelper::Discard);
+ defaultDiscardText = QPlatformTheme::removeMnemonics(defaultDiscardText);
+ QCOMPARE(discardButton->text(), defaultDiscardText);
+
+ QTranslator translator;
+ QVERIFY(translator.load(":/i18n/qtbase_fr.qm"));
+ QVERIFY(qApp->installTranslator(&translator));
+ view.engine()->retranslate();
+
+ QString translatedSaveText = QGuiApplicationPrivate::platformTheme()->standardButtonText(QPlatformDialogHelper::Save);
+ translatedSaveText = QPlatformTheme::removeMnemonics(translatedSaveText);
+ QCOMPARE(saveButton->text(), translatedSaveText);
+
+ QString translatedDiscardText = QGuiApplicationPrivate::platformTheme()->standardButtonText(QPlatformDialogHelper::Discard);
+ translatedDiscardText = QPlatformTheme::removeMnemonics(translatedDiscardText);
+ QCOMPARE(discardButton->text(), translatedDiscardText);
+}
+
+QTEST_MAIN(tst_translation)
+
+#include "tst_translation.moc"