diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-04-13 17:26:45 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-04-13 18:18:24 +0000 |
commit | 4bc65664627c6359c45754fb89022e00d616441b (patch) | |
tree | 8c7407e146c69daa3045833ad4e131e5e31e818a /src/quickcontrols2 | |
parent | 9cc38f6d17643978b5f65829c08c105a7783ac10 (diff) |
Controls: rename the C++ module to qtquickcontrols2
Change-Id: I087a39baebc296a340739161874636926adaa56c
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/quickcontrols2')
21 files changed, 2061 insertions, 0 deletions
diff --git a/src/quickcontrols2/qquickcolorimageprovider.cpp b/src/quickcontrols2/qquickcolorimageprovider.cpp new file mode 100644 index 00000000..9fc55d00 --- /dev/null +++ b/src/quickcontrols2/qquickcolorimageprovider.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickcolorimageprovider_p.h" + +#include <QtCore/qdebug.h> +#include <QtGui/qpainter.h> +#include <QtGui/qguiapplication.h> +#include <QtGui/qscreen.h> +#include <QtGui/qicon.h> + +QT_BEGIN_NAMESPACE + +QQuickColorImageProvider::QQuickColorImageProvider(const QString &path) + : QQuickImageProvider(Image), m_path(path) +{ +} + +QImage QQuickColorImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) +{ + Q_UNUSED(requestedSize); + + int sep = id.indexOf(QLatin1Char('/')); + const QStringRef name = id.leftRef(sep); + qreal dpr = qApp->primaryScreen()->devicePixelRatio(); + QString file = qt_findAtNxFile(m_path + QLatin1Char('/') + name + QLatin1String(".png"), dpr); + + QImage image(file); + if (image.isNull()) { + qWarning() << "QQuickColorImageProvider: unknown id:" << id; + return QImage(); + } + + if (size) + *size = image.size(); + + const QString color = id.mid(sep + 1); + if (!color.isEmpty()) { + QPainter painter(&image); + painter.setCompositionMode(QPainter::CompositionMode_SourceIn); + painter.fillRect(image.rect(), QColor(color)); + } + + return image; +} + +QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickcolorimageprovider_p.h b/src/quickcontrols2/qquickcolorimageprovider_p.h new file mode 100644 index 00000000..9264983e --- /dev/null +++ b/src/quickcontrols2/qquickcolorimageprovider_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKCOLORIMAGEPROVIDER_P_H +#define QQUICKCOLORIMAGEPROVIDER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuick/qquickimageprovider.h> +#include <QtQuickControls2/private/qtquickcontrols2global_p.h> + +QT_BEGIN_NAMESPACE + +class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickColorImageProvider : public QQuickImageProvider +{ +public: + QQuickColorImageProvider(const QString &path); + + QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override; + +private: + QString m_path; +}; + +QT_END_NAMESPACE + +#endif // QQUICKOCOLORIMAGEPROVIDER_P_H diff --git a/src/quickcontrols2/qquickpaddedrectangle.cpp b/src/quickcontrols2/qquickpaddedrectangle.cpp new file mode 100644 index 00000000..9542ca5f --- /dev/null +++ b/src/quickcontrols2/qquickpaddedrectangle.cpp @@ -0,0 +1,210 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickpaddedrectangle_p.h" + +#include <QtQuick/private/qsgadaptationlayer_p.h> + +QT_BEGIN_NAMESPACE + +QQuickPaddedRectangle::QQuickPaddedRectangle(QQuickItem *parent) : + QQuickRectangle(parent), m_padding(0), + m_topPadding(0), m_leftPadding(0), m_rightPadding(0), m_bottomPadding(0), + m_hasTopPadding(false), m_hasLeftPadding(false), m_hasRightPadding(false), m_hasBottomPadding(false) +{ +} + +qreal QQuickPaddedRectangle::padding() const +{ + return m_padding; +} + +void QQuickPaddedRectangle::setPadding(qreal padding) +{ + if (!qFuzzyCompare(m_padding, padding)) { + m_padding = padding; + update(); + emit paddingChanged(); + if (m_hasTopPadding) + emit topPaddingChanged(); + if (!m_hasLeftPadding) + emit leftPaddingChanged(); + if (!m_hasRightPadding) + emit rightPaddingChanged(); + if (!m_hasBottomPadding) + emit bottomPaddingChanged(); + } +} + +void QQuickPaddedRectangle::resetPadding() +{ + setPadding(0); +} + +qreal QQuickPaddedRectangle::topPadding() const +{ + return m_hasTopPadding ? m_topPadding : m_padding; +} + +void QQuickPaddedRectangle::setTopPadding(qreal padding) +{ + setTopPadding(padding, true); +} + +void QQuickPaddedRectangle::resetTopPadding() +{ + setTopPadding(0, false); +} + +qreal QQuickPaddedRectangle::leftPadding() const +{ + return m_hasLeftPadding ? m_leftPadding : m_padding; +} + +void QQuickPaddedRectangle::setLeftPadding(qreal padding) +{ + setLeftPadding(padding, true); +} + +void QQuickPaddedRectangle::resetLeftPadding() +{ + setLeftPadding(0, false); +} + +qreal QQuickPaddedRectangle::rightPadding() const +{ + return m_hasRightPadding ? m_rightPadding : m_padding; +} + +void QQuickPaddedRectangle::setRightPadding(qreal padding) +{ + setRightPadding(padding, true); +} + +void QQuickPaddedRectangle::resetRightPadding() +{ + setRightPadding(0, false); +} + +qreal QQuickPaddedRectangle::bottomPadding() const +{ + return m_hasBottomPadding ? m_bottomPadding : m_padding; +} + +void QQuickPaddedRectangle::setBottomPadding(qreal padding) +{ + setBottomPadding(padding, true); +} + +void QQuickPaddedRectangle::resetBottomPadding() +{ + setBottomPadding(0, false); +} + +void QQuickPaddedRectangle::setTopPadding(qreal padding, bool has) +{ + qreal oldPadding = topPadding(); + m_hasTopPadding = has; + m_topPadding = padding; + if (!qFuzzyCompare(oldPadding, padding)) { + update(); + emit topPaddingChanged(); + } +} + +void QQuickPaddedRectangle::setLeftPadding(qreal padding, bool has) +{ + qreal oldPadding = leftPadding(); + m_hasLeftPadding = has; + m_leftPadding = padding; + if (!qFuzzyCompare(oldPadding, padding)) { + update(); + emit leftPaddingChanged(); + } +} + +void QQuickPaddedRectangle::setRightPadding(qreal padding, bool has) +{ + qreal oldPadding = rightPadding(); + m_hasRightPadding = has; + m_rightPadding = padding; + if (!qFuzzyCompare(oldPadding, padding)) { + update(); + emit rightPaddingChanged(); + } +} + +void QQuickPaddedRectangle::setBottomPadding(qreal padding, bool has) +{ + qreal oldPadding = bottomPadding(); + m_hasBottomPadding = has; + m_bottomPadding = padding; + if (!qFuzzyCompare(oldPadding, padding)) { + update(); + emit bottomPaddingChanged(); + } +} + +QSGNode *QQuickPaddedRectangle::updatePaintNode(QSGNode *node, UpdatePaintNodeData *data) +{ + QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(node); + if (!transformNode) + transformNode = new QSGTransformNode; + + QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(QQuickRectangle::updatePaintNode(transformNode->firstChild(), data)); + + if (rectNode) { + if (!transformNode->firstChild()) + transformNode->appendChildNode(rectNode); + + qreal top = topPadding(); + qreal left = leftPadding(); + qreal right = rightPadding(); + qreal bottom = bottomPadding(); + + if (!qFuzzyIsNull(top) || !qFuzzyIsNull(left) || !qFuzzyIsNull(right) || !qFuzzyIsNull(bottom)) { + QMatrix4x4 m; + m.translate(left, top); + transformNode->setMatrix(m); + + rectNode->setRect(boundingRect().adjusted(0, 0, -left-right, -top-bottom)); + rectNode->update(); + } + } + return transformNode; +} + +QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickpaddedrectangle_p.h b/src/quickcontrols2/qquickpaddedrectangle_p.h new file mode 100644 index 00000000..8760b272 --- /dev/null +++ b/src/quickcontrols2/qquickpaddedrectangle_p.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKPADDEDRECTANGLE_P_H +#define QQUICKPADDEDRECTANGLE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuick/private/qquickrectangle_p.h> +#include <QtQuickControls2/private/qtquickcontrols2global_p.h> + +QT_BEGIN_NAMESPACE + +class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickPaddedRectangle : public QQuickRectangle +{ + Q_OBJECT + Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL) + Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL) + Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL) + Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL) + Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL) + +public: + QQuickPaddedRectangle(QQuickItem *parent = nullptr); + + qreal padding() const; + void setPadding(qreal padding); + void resetPadding(); + + qreal topPadding() const; + void setTopPadding(qreal padding); + void resetTopPadding(); + + qreal leftPadding() const; + void setLeftPadding(qreal padding); + void resetLeftPadding(); + + qreal rightPadding() const; + void setRightPadding(qreal padding); + void resetRightPadding(); + + qreal bottomPadding() const; + void setBottomPadding(qreal padding); + void resetBottomPadding(); + +Q_SIGNALS: + void paddingChanged(); + void topPaddingChanged(); + void leftPaddingChanged(); + void rightPaddingChanged(); + void bottomPaddingChanged(); + +protected: + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; + +private: + void setTopPadding(qreal padding, bool has); + void setLeftPadding(qreal padding, bool has); + void setRightPadding(qreal padding, bool has); + void setBottomPadding(qreal padding, bool has); + + qreal m_padding; + qreal m_topPadding; + qreal m_leftPadding; + qreal m_rightPadding; + qreal m_bottomPadding; + bool m_hasTopPadding; + bool m_hasLeftPadding; + bool m_hasRightPadding; + bool m_hasBottomPadding; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QQuickPaddedRectangle) + +#endif // QQUICKPADDEDRECTANGLE_P_H diff --git a/src/quickcontrols2/qquickpluginutils.cpp b/src/quickcontrols2/qquickpluginutils.cpp new file mode 100644 index 00000000..d67912ce --- /dev/null +++ b/src/quickcontrols2/qquickpluginutils.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +#include "qquickpluginutils_p.h" + +#include "qquickstyle.h" + +QT_BEGIN_NAMESPACE + +/* + Returns either a file system path if Qt was built as shared libraries, + or a QRC path if Qt was built statically. +*/ +QString QQuickPluginUtils::pluginBasePath(const QQmlExtensionPlugin &plugin) +{ +#ifdef QT_STATIC + return QLatin1String("qrc") + plugin.baseUrl().path(); +#else + return plugin.baseUrl().toString(); +#endif +} + +/* + Returns either a file system URL if Qt was built as shared libraries, + or a QRC URL if Qt was built statically. +*/ +QUrl QQuickPluginUtils::pluginBaseUrl(const QQmlExtensionPlugin &plugin) +{ + return QUrl(pluginBasePath(plugin)); +} + +QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickpluginutils_p.h b/src/quickcontrols2/qquickpluginutils_p.h new file mode 100644 index 00000000..2dc5ddd1 --- /dev/null +++ b/src/quickcontrols2/qquickpluginutils_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +#ifndef QQUICKPLUGINUTILS_H +#define QQUICKPLUGINUTILS_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qurl.h> +#include <QtCore/qstring.h> +#include <QtQml/qqmlextensionplugin.h> +#include <QtQuickControls2/private/qtquickcontrols2global_p.h> + +QT_BEGIN_NAMESPACE + +namespace QQuickPluginUtils +{ + Q_QUICKCONTROLS2_PRIVATE_EXPORT QString pluginBasePath(const QQmlExtensionPlugin &plugin); + Q_QUICKCONTROLS2_PRIVATE_EXPORT QUrl pluginBaseUrl(const QQmlExtensionPlugin &plugin); +} + +QT_END_NAMESPACE + +#endif // QQUICKPLUGINUTILS_H diff --git a/src/quickcontrols2/qquickproxytheme.cpp b/src/quickcontrols2/qquickproxytheme.cpp new file mode 100644 index 00000000..03ccb3b2 --- /dev/null +++ b/src/quickcontrols2/qquickproxytheme.cpp @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickproxytheme_p.h" + +#include <QtGui/private/qguiapplication_p.h> +#include <QtGui/qpixmap.h> +#include <QtGui/qfont.h> + +QT_BEGIN_NAMESPACE + +QQuickProxyTheme::QQuickProxyTheme(QPlatformTheme *theme) + : m_theme(theme ? theme : QGuiApplicationPrivate::platform_theme) +{ +} + +QQuickProxyTheme::~QQuickProxyTheme() +{ + if (QGuiApplicationPrivate::platform_theme == this) + QGuiApplicationPrivate::platform_theme = m_theme; +} + +QPlatformTheme *QQuickProxyTheme::theme() const +{ + return m_theme; +} + +QPlatformMenuItem *QQuickProxyTheme::createPlatformMenuItem() const +{ + if (m_theme) + return m_theme->createPlatformMenuItem(); + return QPlatformTheme::createPlatformMenuItem(); +} + +QPlatformMenu *QQuickProxyTheme::createPlatformMenu() const +{ + if (m_theme) + return m_theme->createPlatformMenu(); + return QPlatformTheme::createPlatformMenu(); +} + +QPlatformMenuBar *QQuickProxyTheme::createPlatformMenuBar() const +{ + if (m_theme) + return m_theme->createPlatformMenuBar(); + return QPlatformTheme::createPlatformMenuBar(); +} + +void QQuickProxyTheme::showPlatformMenuBar() +{ + if (m_theme) + m_theme->showPlatformMenuBar(); + QPlatformTheme::showPlatformMenuBar(); +} + +bool QQuickProxyTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const +{ + if (m_theme) + return m_theme->usePlatformNativeDialog(type); + return QPlatformTheme::usePlatformNativeDialog(type); +} + +QPlatformDialogHelper *QQuickProxyTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const +{ + if (m_theme) + return m_theme->createPlatformDialogHelper(type); + return QPlatformTheme::createPlatformDialogHelper(type); +} + +#ifndef QT_NO_SYSTEMTRAYICON +QPlatformSystemTrayIcon *QQuickProxyTheme::createPlatformSystemTrayIcon() const +{ + if (m_theme) + return m_theme->createPlatformSystemTrayIcon(); + return QPlatformTheme::createPlatformSystemTrayIcon(); +} +#endif + +const QPalette *QQuickProxyTheme::palette(QPlatformTheme::Palette type) const +{ + if (m_theme) + return m_theme->palette(type); + return QPlatformTheme::palette(type); +} + +const QFont *QQuickProxyTheme::font(QPlatformTheme::Font type) const +{ + if (m_theme) + return m_theme->font(type); + return QPlatformTheme::font(type); +} + +QVariant QQuickProxyTheme::themeHint(QPlatformTheme::ThemeHint hint) const +{ + if (m_theme) + return m_theme->themeHint(hint); + return QPlatformTheme::themeHint(hint); +} + +QPixmap QQuickProxyTheme::standardPixmap(QPlatformTheme::StandardPixmap sp, const QSizeF &size) const +{ + if (m_theme) + return m_theme->standardPixmap(sp, size); + return QPlatformTheme::standardPixmap(sp, size); +} + +QPixmap QQuickProxyTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, QPlatformTheme::IconOptions iconOptions) const +{ + if (m_theme) + return m_theme->fileIconPixmap(fileInfo, size, iconOptions); + return QPlatformTheme::fileIconPixmap(fileInfo, size, iconOptions); +} + +QIconEngine *QQuickProxyTheme::createIconEngine(const QString &iconName) const +{ + if (m_theme) + return m_theme->createIconEngine(iconName); + return QPlatformTheme::createIconEngine(iconName); +} + +QList<QKeySequence> QQuickProxyTheme::keyBindings(QKeySequence::StandardKey key) const +{ + if (m_theme) + return m_theme->keyBindings(key); + return QPlatformTheme::keyBindings(key); +} + +QString QQuickProxyTheme::standardButtonText(int button) const +{ + if (m_theme) + return m_theme->standardButtonText(button); + return QPlatformTheme::standardButtonText(button); +} + +QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickproxytheme_p.h b/src/quickcontrols2/qquickproxytheme_p.h new file mode 100644 index 00000000..5e4b6769 --- /dev/null +++ b/src/quickcontrols2/qquickproxytheme_p.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKPROXYTHEME_P_H +#define QQUICKPROXYTHEME_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtGui/qpa/qplatformtheme.h> +#include <QtQuickControls2/private/qtquickcontrols2global_p.h> + +QT_BEGIN_NAMESPACE + +class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickProxyTheme : public QPlatformTheme +{ +public: + explicit QQuickProxyTheme(QPlatformTheme *theme = nullptr); + ~QQuickProxyTheme(); + + QPlatformTheme* theme() const; + + QPlatformMenuItem* createPlatformMenuItem() const override; + QPlatformMenu* createPlatformMenu() const override; + QPlatformMenuBar* createPlatformMenuBar() const override; + void showPlatformMenuBar() override; + + bool usePlatformNativeDialog(DialogType type) const override; + QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override; + +#ifndef QT_NO_SYSTEMTRAYICON + QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; +#endif + + const QPalette *palette(Palette type = SystemPalette) const override; + + const QFont *font(Font type = SystemFont) const override; + + QVariant themeHint(ThemeHint hint) const override; + + QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override; + QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, + QPlatformTheme::IconOptions iconOptions = 0) const override; + + QIconEngine *createIconEngine(const QString &iconName) const override; + + QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const override; + + QString standardButtonText(int button) const override; + +private: + QPlatformTheme *m_theme; +}; + +QT_END_NAMESPACE + +#endif // QQUICKPROXYTHEME_P_H diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp new file mode 100644 index 00000000..917907c6 --- /dev/null +++ b/src/quickcontrols2/qquickstyle.cpp @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +#include "qquickstyle.h" +#include "qquickstyleattached_p.h" + +#include <QtCore/qsettings.h> +#include <QtGui/private/qguiapplication_p.h> +#include <QtQml/private/qqmlmetatype_p.h> +#include <QtQml/qqmlfile.h> + +QT_BEGIN_NAMESPACE + +/*! + \class QQuickStyle + \brief The QQQuickStyle class allows configuring the application style. + \inmodule QtLabsControls + + QQuickStyle provides API for querying and configuring the application + \l {Styling Qt Quick Controls 2}{styles} of Qt Quick Controls 2. + + \code + #include <QGuiApplication> + #include <QQmlApplicationEngine> + #include <QQuickStyle> + + int main(int argc, char *argv[]) + { + QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QGuiApplication app(argc, argv); + + QQuickStyle::setStyle("Material"); + + QQmlApplicationEngine engine; + engine.load(QUrl("qrc:/main.qml")); + + return app.exec(); + } + \endcode + + \note The style must be configured \b before loading QML that imports + Qt Quick Controls 2. It is not possible to change the style after the QML + types have been registered. + + \sa {Styling Qt Quick Controls 2} +*/ + +struct QQuickStyleSpec +{ + QQuickStyleSpec() : resolved(false) { } + + QString name() + { + if (!resolved) + resolve(); + return style.mid(style.lastIndexOf(QLatin1Char('/')) + 1); + } + + QString path() + { + if (!resolved) + resolve(); + QString s = style; + if (QQmlFile::isLocalFile(s)) + s = QQmlFile::urlToLocalFileOrQrc(s); + return s.left(s.lastIndexOf(QLatin1Char('/')) + 1); + } + + void setStyle(const QString &s) + { + style = s; + resolved = !s.isEmpty(); + } + + void resolve() + { + style = QGuiApplicationPrivate::styleOverride; + if (style.isEmpty()) + style = QString::fromLatin1(qgetenv("QT_LABS_CONTROLS_STYLE")); + if (style.isEmpty()) { + QSharedPointer<QSettings> settings = QQuickStyleAttached::settings(QStringLiteral("Controls")); + if (settings) + style = settings->value(QStringLiteral("Style")).toString(); + } + resolved = QGuiApplication::instance(); + } + + bool resolved; + QString style; +}; + +Q_GLOBAL_STATIC(QQuickStyleSpec, styleSpec) + +/*! + Returns the name of the application style. + + \note The application style can be specified by passing a \c -style command + line argument. Therefore \c name() may not return a fully resolved + value if called before constructing a QGuiApplication. +*/ +QString QQuickStyle::name() +{ + return styleSpec()->name(); +} + +/*! + Returns the path of an overridden application style, or an empty + string if the style is one of the built-in Qt Quick Controls 2 styles. + + \note The application style can be specified by passing a \c -style command + line argument. Therefore \c path() may not return a fully resolved + value if called before constructing a QGuiApplication. +*/ +QString QQuickStyle::path() +{ + return styleSpec()->path(); +} + +/*! + Sets the application style. + + \note The style must be configured \b before loading QML that imports Qt Quick Controls 2. + It is not possible to change the style after the QML types have been registered. +*/ +void QQuickStyle::setStyle(const QString &style) +{ + if (QQmlMetaType::isModule(QStringLiteral("Qt.labs.controls"), 1, 0)) { + qWarning() << "ERROR: QQuickStyle::setStyle() must be called before loading QML that imports Qt Quick Controls 2."; + return; + } + + styleSpec()->setStyle(style); +} + +QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickstyle.h b/src/quickcontrols2/qquickstyle.h new file mode 100644 index 00000000..87452cb7 --- /dev/null +++ b/src/quickcontrols2/qquickstyle.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +#ifndef QQUICKSTYLE_H +#define QQUICKSTYLE_H + +#include <QtCore/qurl.h> +#include <QtCore/qstring.h> +#include <QtQuickControls2/qtquickcontrols2global.h> + +QT_BEGIN_NAMESPACE + +class Q_QUICKCONTROLS2_EXPORT QQuickStyle +{ +public: + static QString name(); + static QString path(); + static void setStyle(const QString &style); +}; + +QT_END_NAMESPACE + +#endif // QQUICKSTYLE_H diff --git a/src/quickcontrols2/qquickstyleattached.cpp b/src/quickcontrols2/qquickstyleattached.cpp new file mode 100644 index 00000000..a815b956 --- /dev/null +++ b/src/quickcontrols2/qquickstyleattached.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "qquickstyleattached_p.h" + +#include <QtCore/qfile.h> +#include <QtCore/qsettings.h> +#include <QtCore/qfileselector.h> +#include <QtQuick/private/qquickitem_p.h> +#include <QtQuickTemplates2/private/qquickpopup_p.h> + +QT_BEGIN_NAMESPACE + +static QQuickStyleAttached *attachedStyle(const QMetaObject *type, QObject *object, bool create = false) +{ + if (!object) + return nullptr; + int idx = -1; + return qobject_cast<QQuickStyleAttached *>(qmlAttachedPropertiesObject(&idx, object, type, create)); +} + +static QQuickStyleAttached *findParentStyle(const QMetaObject *type, QObject *object) +{ + QQuickItem *item = qobject_cast<QQuickItem *>(object); + if (item) { + // lookup parent items and popups + QQuickItem *parent = item->parentItem(); + while (parent) { + QQuickStyleAttached *style = attachedStyle(type, parent); + if (style) + return style; + + QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent->parent()); + if (popup) + return attachedStyle(type, popup); + + parent = parent->parentItem(); + } + + // fallback to item's window + QQuickStyleAttached *style = attachedStyle(type, item->window()); + if (style) + return style; + } else { + // lookup popup's window + QQuickPopup *popup = qobject_cast<QQuickPopup *>(object); + if (popup) + return attachedStyle(type, popup->popupItem()->window()); + } + + // lookup parent window + QQuickWindow *window = qobject_cast<QQuickWindow *>(object); + if (window) { + QQuickWindow *parentWindow = qobject_cast<QQuickWindow *>(window->parent()); + if (parentWindow) { + QQuickStyleAttached *style = attachedStyle(type, window); + if (style) + return style; + } + } + + // fallback to engine (global) + if (object) { + QQmlEngine *engine = qmlEngine(object); + if (engine) { + QByteArray name = QByteArray("_q_") + type->className(); + QQuickStyleAttached *style = engine->property(name).value<QQuickStyleAttached*>(); + if (!style) { + style = attachedStyle(type, engine, true); + engine->setProperty(name, QVariant::fromValue(style)); + } + return style; + } + } + + return nullptr; +} + +static QList<QQuickStyleAttached *> findChildStyles(const QMetaObject *type, QObject *object) +{ + QList<QQuickStyleAttached *> children; + + QQuickItem *item = qobject_cast<QQuickItem *>(object); + if (!item) { + QQuickWindow *window = qobject_cast<QQuickWindow *>(object); + if (window) { + item = window->contentItem(); + + const auto windowChildren = window->children(); + for (QObject *child : windowChildren) { + QQuickWindow *childWindow = qobject_cast<QQuickWindow *>(child); + if (childWindow) { + QQuickStyleAttached *style = attachedStyle(type, childWindow); + if (style) + children += style; + } + } + } + } + + if (item) { + const auto childItems = item->childItems(); + for (QQuickItem *child : childItems) { + QQuickStyleAttached *style = attachedStyle(type, child); + if (style) + children += style; + else + children += findChildStyles(type, child); + } + } + + return children; +} + +QQuickStyleAttached::QQuickStyleAttached(QObject *parent) : QObject(parent) +{ + QQuickItem *item = qobject_cast<QQuickItem *>(parent); + if (!item) { + QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent); + if (popup) + item = popup->popupItem(); + } + + if (item) + QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Parent); +} + +QQuickStyleAttached::~QQuickStyleAttached() +{ + QQuickItem *item = qobject_cast<QQuickItem *>(parent()); + if (item) + QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent); + + setParentStyle(nullptr); +} + +QSharedPointer<QSettings> QQuickStyleAttached::settings(const QString &group) +{ +#ifndef QT_NO_SETTINGS + const QString filePath = QStringLiteral(":/qtquickcontrols.conf"); + if (QFile::exists(filePath)) { + QFileSelector selector; + QSettings *settings = new QSettings(selector.select(filePath), QSettings::IniFormat); + if (!group.isEmpty()) + settings->beginGroup(group); + return QSharedPointer<QSettings>(settings); + } +#endif // QT_NO_SETTINGS + return QSharedPointer<QSettings>(); +} + +QList<QQuickStyleAttached *> QQuickStyleAttached::childStyles() const +{ + return m_childStyles; +} + +QQuickStyleAttached *QQuickStyleAttached::parentStyle() const +{ + return m_parentStyle; +} + +void QQuickStyleAttached::setParentStyle(QQuickStyleAttached *style) +{ + if (m_parentStyle != style) { + QQuickStyleAttached *oldParent = m_parentStyle; + if (m_parentStyle) + m_parentStyle->m_childStyles.removeOne(this); + m_parentStyle = style; + if (style) + style->m_childStyles.append(this); + parentStyleChange(style, oldParent); + } +} + +void QQuickStyleAttached::init() +{ + QQuickStyleAttached *parentStyle = findParentStyle(metaObject(), parent()); + if (parentStyle) + setParentStyle(parentStyle); + + const QList<QQuickStyleAttached *> children = findChildStyles(metaObject(), parent()); + for (QQuickStyleAttached *child : children) + child->setParentStyle(this); +} + +void QQuickStyleAttached::parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent) +{ + Q_UNUSED(newParent); + Q_UNUSED(oldParent); +} + +void QQuickStyleAttached::itemParentChanged(QQuickItem *item, QQuickItem *parent) +{ + Q_UNUSED(parent); + setParentStyle(findParentStyle(metaObject(), item)); +} + +QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickstyleattached_p.h b/src/quickcontrols2/qquickstyleattached_p.h new file mode 100644 index 00000000..2140f2b7 --- /dev/null +++ b/src/quickcontrols2/qquickstyleattached_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QQUICKSTYLEATTACHED_P_H +#define QQUICKSTYLEATTACHED_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQml/qqml.h> +#include <QtCore/qlist.h> +#include <QtCore/qobject.h> +#include <QtCore/qpointer.h> +#include <QtCore/qsharedpointer.h> +#include <QtQuick/private/qquickitemchangelistener_p.h> +#include <QtQuickControls2/private/qtquickcontrols2global_p.h> + +QT_BEGIN_NAMESPACE + +class QSettings; + +class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStyleAttached : public QObject, public QQuickItemChangeListener +{ + Q_OBJECT + +public: + explicit QQuickStyleAttached(QObject *parent = nullptr); + ~QQuickStyleAttached(); + + static QSharedPointer<QSettings> settings(const QString &group = QString()); + +protected: + void init(); + + QList<QQuickStyleAttached *> childStyles() const; + + QQuickStyleAttached *parentStyle() const; + void setParentStyle(QQuickStyleAttached *style); + + virtual void parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent); + + void itemParentChanged(QQuickItem *item, QQuickItem *parent) override; + +private: + QList<QQuickStyleAttached *> m_childStyles; + QPointer<QQuickStyleAttached> m_parentStyle; +}; + +QT_END_NAMESPACE + +#endif // QQUICKSTYLEATTACHED_P_H diff --git a/src/quickcontrols2/qquickstyleplugin.cpp b/src/quickcontrols2/qquickstyleplugin.cpp new file mode 100644 index 00000000..ceb6531e --- /dev/null +++ b/src/quickcontrols2/qquickstyleplugin.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +#include "qquickstyleplugin_p.h" +#include "qquickproxytheme_p.h" +#include "qquickstyle.h" + +#include <QtGui/private/qguiapplication_p.h> + +QT_BEGIN_NAMESPACE + +QQuickStylePlugin::QQuickStylePlugin(QObject *parent) : QQmlExtensionPlugin(parent) +{ +} + +QQuickStylePlugin::~QQuickStylePlugin() +{ +} + +void QQuickStylePlugin::registerTypes(const char *uri) +{ + Q_UNUSED(uri); +} + +void QQuickStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri) +{ + Q_UNUSED(engine); + Q_UNUSED(uri); + + const QString style = name(); + if (!style.isEmpty() && style.compare(QQuickStyle::name(), Qt::CaseInsensitive) == 0) { + m_theme.reset(createTheme()); + if (m_theme) + QGuiApplicationPrivate::platform_theme = m_theme.data(); + } +} + +QString QQuickStylePlugin::name() const +{ + return QString(); +} + +QQuickProxyTheme *QQuickStylePlugin::createTheme() const +{ + return nullptr; +} + +QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickstyleplugin_p.h b/src/quickcontrols2/qquickstyleplugin_p.h new file mode 100644 index 00000000..b636ac27 --- /dev/null +++ b/src/quickcontrols2/qquickstyleplugin_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +#ifndef QQUICKSTYLEPLUGIN_P_H +#define QQUICKSTYLEPLUGIN_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qscopedpointer.h> +#include <QtQml/qqmlextensionplugin.h> +#include <QtQuickControls2/private/qtquickcontrols2global_p.h> + +QT_BEGIN_NAMESPACE + +class QQuickProxyTheme; + +class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStylePlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + +public: + explicit QQuickStylePlugin(QObject *parent = nullptr); + ~QQuickStylePlugin(); + + void registerTypes(const char *uri) override; + void initializeEngine(QQmlEngine *engine, const char *uri) override; + + virtual QString name() const; + virtual QQuickProxyTheme *createTheme() const; + +private: + QScopedPointer<QQuickProxyTheme> m_theme; +}; + +QT_END_NAMESPACE + +#endif // QQUICKSTYLEPLUGIN_P_H diff --git a/src/quickcontrols2/qquickstyleselector.cpp b/src/quickcontrols2/qquickstyleselector.cpp new file mode 100644 index 00000000..64e9d500 --- /dev/null +++ b/src/quickcontrols2/qquickstyleselector.cpp @@ -0,0 +1,193 @@ +/*************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickstyleselector_p.h" +#include "qquickstyleselector_p_p.h" +#include "qquickstyle.h" + +#include <QtCore/qdir.h> +#include <QtCore/qfile.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qsysinfo.h> +#include <QtCore/qlocale.h> + +#include <QtGui/private/qguiapplication_p.h> + +QT_BEGIN_NAMESPACE + +static bool isLocalScheme(const QString &scheme) +{ + bool local = scheme == QLatin1String("qrc"); +#ifdef Q_OS_ANDROID + local |= scheme == QLatin1String("assets"); +#endif + return local; +} + +// similar, but not identical to QSysInfo::osType +static QStringList platformSelectors() +{ + static QStringList selectors; + if (!selectors.isEmpty()) + return selectors; + +#if defined(Q_OS_WIN) + // can't fall back to QSysInfo because we need both "winphone" and "winrt" for the Windows Phone case + selectors << QStringLiteral("windows"); + selectors << QSysInfo::kernelType(); // "wince" and "winnt" +# if defined(Q_OS_WINRT) + selectors << QStringLiteral("winrt"); +# if defined(Q_OS_WINPHONE) + selectors << QStringLiteral("winphone"); +# endif +# endif +#elif defined(Q_OS_UNIX) + selectors << QStringLiteral("unix"); +# if !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) + // we don't want "linux" for Android or "qnx" for Blackberry here + selectors << QSysInfo::kernelType(); +# ifdef Q_OS_MAC + selectors << QStringLiteral("mac"); // compatibility, since kernelType() is "darwin" +# endif +# endif + QString productName = QSysInfo::productType(); + if (productName != QLatin1String("unknown")) + selectors << productName; // "opensuse", "fedora", "osx", "ios", "blackberry", "android" +#endif + return selectors; +} + +static QStringList allSelectors(bool includeStyle) +{ + QStringList selectors = platformSelectors(); + selectors += QLocale().name(); + if (includeStyle) { + QString style = QQuickStyle::name(); + if (!style.isEmpty()) + selectors.prepend(style.toLower()); + } + return selectors; +} + +static QString selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors) +{ + /* selectionHelper does a depth-first search of possible selected files. Because there is strict + selector ordering in the API, we can stop checking as soon as we find the file in a directory + which does not contain any other valid selector directories. + */ + Q_ASSERT(path.isEmpty() || path.endsWith(QLatin1Char('/'))); + + for (const QString &s : selectors) { + QString prospectiveBase = path + s + QLatin1Char('/'); + QStringList remainingSelectors = selectors; + remainingSelectors.removeAll(s); + if (!QDir(prospectiveBase).exists()) + continue; + QString prospectiveFile = selectionHelper(prospectiveBase, fileName, remainingSelectors); + if (!prospectiveFile.isEmpty()) + return prospectiveFile; + } + + // If we reach here there were no successful files found at a lower level in this branch, so we + // should check this level as a potential result. + const QString result = path + fileName; + if (!QFileInfo::exists(result)) + return QString(); + return result; +} + +QString QQuickStyleSelectorPrivate::select(const QString &filePath) const +{ + QFileInfo fi(filePath); + // If file doesn't exist, don't select + if (!fi.exists()) + return filePath; + + const QString path = fi.path(); + const QString ret = selectionHelper(path.isEmpty() ? QString() : path + QLatin1Char('/'), + fi.fileName(), allSelectors(true)); + + if (!ret.isEmpty()) + return ret; + return filePath; +} + +QQuickStyleSelector::QQuickStyleSelector() : d_ptr(new QQuickStyleSelectorPrivate) +{ +} + +QQuickStyleSelector::~QQuickStyleSelector() +{ +} + +QUrl QQuickStyleSelector::baseUrl() const +{ + Q_D(const QQuickStyleSelector); + return d->baseUrl; +} + +void QQuickStyleSelector::setBaseUrl(const QUrl &url) +{ + Q_D(QQuickStyleSelector); + d->baseUrl = url; +} + +QString QQuickStyleSelector::select(const QString &fileName) const +{ + Q_D(const QQuickStyleSelector); + const QString overridePath = QQuickStyle::path(); + if (!overridePath.isEmpty()) { + const QString stylePath = overridePath + QQuickStyle::name() + QLatin1Char('/'); + if (QFile::exists(stylePath + fileName)) { + // the style name is included to the path, so exclude it from the selectors. + // the rest of the selectors (os, locale) are still valid, though. + const QString selectedPath = selectionHelper(stylePath, fileName, allSelectors(false)); + if (selectedPath.startsWith(QLatin1Char(':'))) + return QLatin1String("qrc") + selectedPath; + return QUrl::fromLocalFile(selectedPath).toString(); + } + } + + QUrl url(d->baseUrl.toString() + QLatin1Char('/') + fileName); + if (isLocalScheme(url.scheme())) { + QString equivalentPath = QLatin1Char(':') + url.path(); + QString selectedPath = d->select(equivalentPath); + url.setPath(selectedPath.remove(0, 1)); + } else if (url.isLocalFile()) { + url = QUrl::fromLocalFile(d->select(url.toLocalFile())); + } + return url.toString(); +} + +QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickstyleselector_p.h b/src/quickcontrols2/qquickstyleselector_p.h new file mode 100644 index 00000000..3343c9da --- /dev/null +++ b/src/quickcontrols2/qquickstyleselector_p.h @@ -0,0 +1,77 @@ +/*************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKSTYLESELECTOR_P_H +#define QQUICKSTYLESELECTOR_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qurl.h> +#include <QtCore/qstring.h> +#include <QtCore/qscopedpointer.h> +#include <QtQuickControls2/private/qtquickcontrols2global_p.h> + +QT_BEGIN_NAMESPACE + +class QQuickStyleSelectorPrivate; + +class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStyleSelector +{ +public: + QQuickStyleSelector(); + ~QQuickStyleSelector(); + + QUrl baseUrl() const; + void setBaseUrl(const QUrl &url); + + QString select(const QString &fileName) const; + +private: + Q_DISABLE_COPY(QQuickStyleSelector) + Q_DECLARE_PRIVATE(QQuickStyleSelector) + QScopedPointer<QQuickStyleSelectorPrivate> d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QQUICKSTYLESELECTOR_P_H diff --git a/src/quickcontrols2/qquickstyleselector_p_p.h b/src/quickcontrols2/qquickstyleselector_p_p.h new file mode 100644 index 00000000..bd3e1700 --- /dev/null +++ b/src/quickcontrols2/qquickstyleselector_p_p.h @@ -0,0 +1,64 @@ +/*************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKSTYLESELECTOR_P_P_H +#define QQUICKSTYLESELECTOR_P_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuickControls2/private/qquickstyleselector_p.h> + +QT_BEGIN_NAMESPACE + +class QQuickStyleSelectorPrivate +{ +public: + QString select(const QString &filePath) const; + + QUrl baseUrl; +}; + +QT_END_NAMESPACE + +#endif // QQUICKSTYLESELECTOR_P_P_H + diff --git a/src/quickcontrols2/qtquickcontrols2global.h b/src/quickcontrols2/qtquickcontrols2global.h new file mode 100644 index 00000000..2088da22 --- /dev/null +++ b/src/quickcontrols2/qtquickcontrols2global.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QTQUICKCONTROLS2GLOBAL_H +#define QTQUICKCONTROLS2GLOBAL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#ifndef QT_STATIC +# if defined(QT_BUILD_QUICKCONTROLS2_LIB) +# define Q_QUICKCONTROLS2_EXPORT Q_DECL_EXPORT +# else +# define Q_QUICKCONTROLS2_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_QUICKCONTROLS2_EXPORT +#endif + +QT_END_NAMESPACE + +#endif // QTQUICKCONTROLS2GLOBAL_H diff --git a/src/quickcontrols2/qtquickcontrols2global_p.h b/src/quickcontrols2/qtquickcontrols2global_p.h new file mode 100644 index 00000000..d5dbeff1 --- /dev/null +++ b/src/quickcontrols2/qtquickcontrols2global_p.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QTQUICKCONTROLS2GLOBAL_P_H +#define QTQUICKCONTROLS2GLOBAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuickControls2/qtquickcontrols2global.h> + +#define Q_QUICKCONTROLS2_PRIVATE_EXPORT Q_QUICKCONTROLS2_EXPORT + +#endif // QTQUICKCONTROLS2GLOBAL_P_H diff --git a/src/quickcontrols2/quickcontrols2.pri b/src/quickcontrols2/quickcontrols2.pri new file mode 100644 index 00000000..5424c5c7 --- /dev/null +++ b/src/quickcontrols2/quickcontrols2.pri @@ -0,0 +1,20 @@ +HEADERS += \ + $$PWD/qquickcolorimageprovider_p.h \ + $$PWD/qquickpluginutils_p.h \ + $$PWD/qquickproxytheme_p.h \ + $$PWD/qquickstyle.h \ + $$PWD/qquickstyleattached_p.h \ + $$PWD/qquickstyleplugin_p.h \ + $$PWD/qquickstyleselector_p.h \ + $$PWD/qquickstyleselector_p_p.h \ + $$PWD/qquickpaddedrectangle_p.h + +SOURCES += \ + $$PWD/qquickcolorimageprovider.cpp \ + $$PWD/qquickpluginutils.cpp \ + $$PWD/qquickproxytheme.cpp \ + $$PWD/qquickstyle.cpp \ + $$PWD/qquickstyleattached.cpp \ + $$PWD/qquickstyleplugin.cpp \ + $$PWD/qquickstyleselector.cpp \ + $$PWD/qquickpaddedrectangle.cpp diff --git a/src/quickcontrols2/quickcontrols2.pro b/src/quickcontrols2/quickcontrols2.pro new file mode 100644 index 00000000..bdad3095 --- /dev/null +++ b/src/quickcontrols2/quickcontrols2.pro @@ -0,0 +1,14 @@ +TARGET = QtQuickControls2 +MODULE = quickcontrols2 + +QT += quick +QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private + +DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII + +HEADERS += \ + $$PWD/qtquickcontrols2global.h + $$PWD/qtquickcontrols2global_p.h + +include(quickcontrols2.pri) +load(qt_module) |