aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/universal
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-19 14:22:01 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-01-19 14:22:27 +0100
commit7cad85c2f0930e4f8531a0508c28abdae0f3e0de (patch)
tree9ffe1d390ff137aa11de472ba59947c0b96cdfbb /src/imports/controls/universal
parented30fdd7085ee8a007b990dc871afdeef0d7cbeb (diff)
parentd2a744f81272f9c0b6e987cc9f6c57f3931b67e7 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/controls/qquickstyle.cpp Change-Id: I1c8273012b01726072e5cbfd4369453a780ff03e
Diffstat (limited to 'src/imports/controls/universal')
-rw-r--r--src/imports/controls/universal/ComboBox.qml3
-rw-r--r--src/imports/controls/universal/Page.qml53
-rw-r--r--src/imports/controls/universal/ProgressBar.qml8
-rw-r--r--src/imports/controls/universal/SpinBox.qml10
-rw-r--r--src/imports/controls/universal/qquickuniversalfocusrectangle.cpp2
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle.cpp28
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp4
-rw-r--r--src/imports/controls/universal/universal.pri3
8 files changed, 84 insertions, 27 deletions
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index 56d7a983..38c8e6e2 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -55,9 +55,6 @@ T.ComboBox {
rightPadding: 10
bottomPadding: 7
- font.pixelSize: Universal.fontSize
- font.family: Universal.fontFamily
-
//! [delegate]
delegate: ItemDelegate {
width: control.width
diff --git a/src/imports/controls/universal/Page.qml b/src/imports/controls/universal/Page.qml
new file mode 100644
index 00000000..975ddfe0
--- /dev/null
+++ b/src/imports/controls/universal/Page.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module 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$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Page {
+ id: control
+
+ //! [contentItem]
+ contentItem: Item { }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ color: control.Universal.altHighColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/ProgressBar.qml b/src/imports/controls/universal/ProgressBar.qml
index df837fef..3d88fc67 100644
--- a/src/imports/controls/universal/ProgressBar.qml
+++ b/src/imports/controls/universal/ProgressBar.qml
@@ -50,9 +50,9 @@ T.ProgressBar {
//! [indicator]
indicator: Rectangle {
x: control.leftPadding
- y: control.topPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
width: control.indeterminate ? 0 : control.position * control.availableWidth
- height: control.availableHeight
+ height: 10
scale: control.mirrored ? -1 : 1
color: control.Universal.accent
@@ -81,9 +81,9 @@ T.ProgressBar {
implicitHeight: 10
x: control.leftPadding
- y: control.topPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
width: control.availableWidth
- height: control.availableHeight
+ height: 10
visible: !control.indeterminate
color: control.Universal.baseLowColor
diff --git a/src/imports/controls/universal/SpinBox.qml b/src/imports/controls/universal/SpinBox.qml
index ac027d75..77eb241e 100644
--- a/src/imports/controls/universal/SpinBox.qml
+++ b/src/imports/controls/universal/SpinBox.qml
@@ -104,8 +104,9 @@ T.SpinBox {
Image {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
- source: "image://universal/rightarrow/" + (!control.enabled ? control.Universal.chromeDisabledLowColor :
- control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
+ source: "image://universal/" + (control.mirrored ? "left" : "right") + "arrow/"
+ + (!control.enabled ? control.Universal.chromeDisabledLowColor :
+ control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
}
}
//! [up.indicator]
@@ -129,8 +130,9 @@ T.SpinBox {
Image {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
- source: "image://universal/leftarrow/" + (!control.enabled ? control.Universal.chromeDisabledLowColor :
- control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
+ source: "image://universal/" + (control.mirrored ? "right" : "left") + "arrow/"
+ + (!control.enabled ? control.Universal.chromeDisabledLowColor :
+ control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
}
}
//! [down.indicator]
diff --git a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp
index 5153f96b..a894390e 100644
--- a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp
+++ b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp
@@ -37,12 +37,14 @@
#include "qquickuniversalfocusrectangle_p.h"
#include <QtGui/qpainter.h>
+#include <QtQuick/private/qquickitem_p.h>
QT_BEGIN_NAMESPACE
QQuickUniversalFocusRectangle::QQuickUniversalFocusRectangle(QQuickItem *parent)
: QQuickPaintedItem(parent)
{
+ QQuickItemPrivate::get(this)->setTransparentForPositioner(true);
}
void QQuickUniversalFocusRectangle::paint(QPainter *painter)
diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp
index 6eaaa4c3..49b2d9f7 100644
--- a/src/imports/controls/universal/qquickuniversalstyle.cpp
+++ b/src/imports/controls/universal/qquickuniversalstyle.cpp
@@ -38,6 +38,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qsettings.h>
+#include <QtQml/qqmlinfo.h>
#include <QtLabsControls/private/qquickstyle_p.h>
QT_BEGIN_NAMESPACE
@@ -201,7 +202,7 @@ void QQuickUniversalStyle::setAccent(const QVariant &var)
if (var.type() == QVariant::Int) {
int val = var.toInt();
if (val < Lime || val > Taupe) {
- qWarning() << "QQuickUniversalStyle: unknown accent" << val;
+ qmlInfo(parent()) << "unknown Universal.accent value: " << val;
return;
}
accent = qquickuniversal_accent_color(static_cast<Accent>(val));
@@ -212,7 +213,7 @@ void QQuickUniversalStyle::setAccent(const QVariant &var)
} else {
QColor color(var.toString());
if (!color.isValid()) {
- qWarning() << "QQuickUniversalStyle: unknown accent" << var.toString();
+ qmlInfo(parent()) << "unknown Universal.accent value: " << var.toString();
return;
}
accent = color.rgba();
@@ -391,15 +392,10 @@ void QQuickUniversalStyle::parentStyleChange(QQuickStyle *newParent, QQuickStyle
}
template <typename Enum>
-static Enum readEnumValue(QSettings *settings, const QString &name, bool *ok)
+static Enum toEnumValue(const QByteArray &value, bool *ok)
{
- int value = -1;
- *ok = settings->contains(name);
- if (*ok) {
- QMetaEnum enumeration = QMetaEnum::fromType<Enum>();
- value = enumeration.keyToValue(settings->value(name).toByteArray(), ok);
- }
- return static_cast<Enum>(value);
+ QMetaEnum enumeration = QMetaEnum::fromType<Enum>();
+ return static_cast<Enum>(enumeration.keyToValue(value, ok));
}
void QQuickUniversalStyle::init()
@@ -409,17 +405,23 @@ void QQuickUniversalStyle::init()
QSharedPointer<QSettings> settings = QQuickStyle::settings(QStringLiteral("Universal"));
if (!settings.isNull()) {
bool ok = false;
- Theme theme = readEnumValue<Theme>(settings.data(), QStringLiteral("Theme"), &ok);
+ QByteArray value = settings->value(QStringLiteral("Theme")).toByteArray();
+ Theme theme = toEnumValue<Theme>(value, &ok);
if (ok)
DefaultTheme = m_theme = theme;
+ else if (!value.isEmpty())
+ qWarning().nospace().noquote() << settings->fileName() << ": unknown Universal theme value: " << value;
- Accent accent = readEnumValue<Accent>(settings.data(), QStringLiteral("Accent"), &ok);
+ value = settings->value(QStringLiteral("Accent")).toByteArray();
+ Accent accent = toEnumValue<Accent>(value, &ok);
if (ok) {
DefaultAccent = m_accent = qquickuniversal_accent_color(accent);
} else {
- QColor color(settings->value(QStringLiteral("Accent")).toString());
+ QColor color(value.constData());
if (color.isValid())
DefaultAccent = m_accent = color.rgba();
+ else if (!value.isEmpty())
+ qWarning().nospace().noquote() << settings->fileName() << ": unknown Universal accent value: " << value;
}
}
defaultsInitialized = true;
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
index 6e202ce6..305c96a1 100644
--- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
+++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
@@ -92,8 +92,8 @@ void QtLabsUniversalStylePlugin::registerTypes(const char *uri)
void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{
QQuickStyleSelector selector;
- if (selector.style() == QStringLiteral("universal")) {
- if (QFont(QStringLiteral("Segoe UI")).family() == QStringLiteral("Segoe UI")) {
+ if (selector.style() == QLatin1String("universal")) {
+ if (QFont(QStringLiteral("Segoe UI")).family() == QLatin1String("Segoe UI")) {
QPlatformTheme *old = QGuiApplicationPrivate::platform_theme;
if (old) {
QQuickProxyTheme *theme = new QQuickUniversalTheme(old);
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index e576367a..73547f4d 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -11,8 +11,9 @@ QML_FILES += \
$$PWD/Label.qml \
$$PWD/Menu.qml \
$$PWD/MenuItem.qml \
- $$PWD/Pane.qml \
+ $$PWD/Page.qml \
$$PWD/PageIndicator.qml \
+ $$PWD/Pane.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
$$PWD/RangeSlider.qml \