aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-02-06 13:26:02 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2018-02-15 08:48:51 +0000
commit72d5d88afe64a76f2026e4a45a4858a13917d4f0 (patch)
tree4cca3b5afe69a8a473981ebd87c09bde3345cc0e
parent544456ea001c1a2ea7917cc4923222c8dc72f41f (diff)
Promote QQuick(Proxy)Theme from libQQC2 to libQQT2
QQuickTheme needs to be part of libQtQuickTemplates to be able to provide dark and light palettes (and later, icons). Task-number: QTBUG-63331 Change-Id: If7d3d279a07b6daf6701a1d3cd3686bec1d094b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/controls/fusion/qquickfusiontheme_p.h2
-rw-r--r--src/imports/controls/imagine/qquickimaginetheme_p.h2
-rw-r--r--src/imports/controls/material/qquickmaterialtheme_p.h2
-rw-r--r--src/imports/controls/qquickdefaulttheme_p.h2
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme_p.h2
-rw-r--r--src/quickcontrols2/qquickstyleplugin.cpp2
-rw-r--r--src/quickcontrols2/quickcontrols2.pri8
-rw-r--r--src/quicktemplates2/qquickproxytheme.cpp (renamed from src/quickcontrols2/qquickproxytheme.cpp)2
-rw-r--r--src/quicktemplates2/qquickproxytheme_p.h (renamed from src/quickcontrols2/qquickproxytheme_p.h)6
-rw-r--r--src/quicktemplates2/qquicktheme.cpp (renamed from src/quickcontrols2/qquicktheme.cpp)24
-rw-r--r--src/quicktemplates2/qquicktheme_p.h (renamed from src/quickcontrols2/qquicktheme_p.h)14
-rw-r--r--src/quicktemplates2/qquicktheme_p_p.h69
-rw-r--r--src/quicktemplates2/quicktemplates2.pri5
-rw-r--r--tests/auto/font/tst_font.cpp2
-rw-r--r--tests/auto/palette/tst_palette.cpp2
-rw-r--r--tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp2
16 files changed, 115 insertions, 31 deletions
diff --git a/src/imports/controls/fusion/qquickfusiontheme_p.h b/src/imports/controls/fusion/qquickfusiontheme_p.h
index 5dcfcf61..0cd77f77 100644
--- a/src/imports/controls/fusion/qquickfusiontheme_p.h
+++ b/src/imports/controls/fusion/qquickfusiontheme_p.h
@@ -50,7 +50,7 @@
#include <QtCore/qvariant.h>
#include <QtGui/qpalette.h>
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/imports/controls/imagine/qquickimaginetheme_p.h b/src/imports/controls/imagine/qquickimaginetheme_p.h
index 4ec9dfd7..3a388a86 100644
--- a/src/imports/controls/imagine/qquickimaginetheme_p.h
+++ b/src/imports/controls/imagine/qquickimaginetheme_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h
index 1c7b1413..6abbed79 100644
--- a/src/imports/controls/material/qquickmaterialtheme_p.h
+++ b/src/imports/controls/material/qquickmaterialtheme_p.h
@@ -50,7 +50,7 @@
#include <QtCore/qvariant.h>
#include <QtGui/qfont.h>
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/imports/controls/qquickdefaulttheme_p.h b/src/imports/controls/qquickdefaulttheme_p.h
index 6b043e14..05c1c344 100644
--- a/src/imports/controls/qquickdefaulttheme_p.h
+++ b/src/imports/controls/qquickdefaulttheme_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversaltheme_p.h b/src/imports/controls/universal/qquickuniversaltheme_p.h
index 5da74470..3a4cc792 100644
--- a/src/imports/controls/universal/qquickuniversaltheme_p.h
+++ b/src/imports/controls/universal/qquickuniversaltheme_p.h
@@ -49,7 +49,7 @@
//
#include <QtGui/qfont.h>
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyleplugin.cpp b/src/quickcontrols2/qquickstyleplugin.cpp
index 6f9a6d13..0e89bb7f 100644
--- a/src/quickcontrols2/qquickstyleplugin.cpp
+++ b/src/quickcontrols2/qquickstyleplugin.cpp
@@ -35,13 +35,13 @@
****************************************************************************/
#include "qquickstyleplugin_p.h"
-#include "qquicktheme_p.h"
#include "qquickstyle.h"
#include "qquickstyle_p.h"
#include <QtCore/qmetaobject.h>
#include <QtCore/qsettings.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
#include <functional>
diff --git a/src/quickcontrols2/quickcontrols2.pri b/src/quickcontrols2/quickcontrols2.pri
index ac20b78d..781658ef 100644
--- a/src/quickcontrols2/quickcontrols2.pri
+++ b/src/quickcontrols2/quickcontrols2.pri
@@ -13,13 +13,11 @@ HEADERS += \
$$PWD/qquickmnemoniclabel_p.h \
$$PWD/qquickpaddedrectangle_p.h \
$$PWD/qquickplaceholdertext_p.h \
- $$PWD/qquickproxytheme_p.h \
$$PWD/qquickstyle.h \
$$PWD/qquickstyle_p.h \
$$PWD/qquickstyleplugin_p.h \
$$PWD/qquickstyleselector_p.h \
- $$PWD/qquickstyleselector_p_p.h \
- $$PWD/qquicktheme_p.h
+ $$PWD/qquickstyleselector_p_p.h
SOURCES += \
$$PWD/qquickanimatednode.cpp \
@@ -34,11 +32,9 @@ SOURCES += \
$$PWD/qquickmnemoniclabel.cpp \
$$PWD/qquickpaddedrectangle.cpp \
$$PWD/qquickplaceholdertext.cpp \
- $$PWD/qquickproxytheme.cpp \
$$PWD/qquickstyle.cpp \
$$PWD/qquickstyleplugin.cpp \
- $$PWD/qquickstyleselector.cpp \
- $$PWD/qquicktheme.cpp
+ $$PWD/qquickstyleselector.cpp
qtConfig(quick-listview):qtConfig(quick-pathview) {
HEADERS += \
diff --git a/src/quickcontrols2/qquickproxytheme.cpp b/src/quicktemplates2/qquickproxytheme.cpp
index 9b395b28..f6e8f773 100644
--- a/src/quickcontrols2/qquickproxytheme.cpp
+++ b/src/quicktemplates2/qquickproxytheme.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/quickcontrols2/qquickproxytheme_p.h b/src/quicktemplates2/qquickproxytheme_p.h
index 2d271e8c..f580f6c5 100644
--- a/src/quickcontrols2/qquickproxytheme_p.h
+++ b/src/quicktemplates2/qquickproxytheme_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -49,11 +49,11 @@
//
#include <QtGui/qpa/qplatformtheme.h>
-#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
QT_BEGIN_NAMESPACE
-class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickProxyTheme : public QPlatformTheme
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickProxyTheme : public QPlatformTheme
{
public:
explicit QQuickProxyTheme(QPlatformTheme *theme = nullptr);
diff --git a/src/quickcontrols2/qquicktheme.cpp b/src/quicktemplates2/qquicktheme.cpp
index 73957207..ab74a4f3 100644
--- a/src/quickcontrols2/qquicktheme.cpp
+++ b/src/quicktemplates2/qquicktheme.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,35 +35,45 @@
****************************************************************************/
#include "qquicktheme_p.h"
+#include "qquicktheme_p_p.h"
QT_BEGIN_NAMESPACE
QQuickTheme::QQuickTheme()
+ : d_ptr(new QQuickThemePrivate)
+{
+}
+
+QQuickTheme::~QQuickTheme()
{
}
const QFont *QQuickTheme::font(Font type) const
{
- Q_UNUSED(type);
- return m_defaultFont.data();
+ Q_D(const QQuickTheme);
+ Q_UNUSED(type)
+ return d->defaultFont.data();
}
const QPalette *QQuickTheme::palette(Palette type) const
{
- Q_UNUSED(type);
- return m_defaultPalette.data();
+ Q_D(const QQuickTheme);
+ Q_UNUSED(type)
+ return d->defaultPalette.data();
}
void QQuickTheme::setDefaultFont(const QFont *defaultFont)
{
- m_defaultFont.reset(defaultFont);
+ Q_D(QQuickTheme);
+ d->defaultFont.reset(defaultFont);
if (defaultFont)
resolveFonts(*defaultFont);
}
void QQuickTheme::setDefaultPalette(const QPalette *defaultPalette)
{
- m_defaultPalette.reset(defaultPalette);
+ Q_D(QQuickTheme);
+ d->defaultPalette.reset(defaultPalette);
if (defaultPalette)
resolvePalettes(*defaultPalette);
}
diff --git a/src/quickcontrols2/qquicktheme_p.h b/src/quicktemplates2/qquicktheme_p.h
index 78ff17c1..1db85426 100644
--- a/src/quickcontrols2/qquicktheme_p.h
+++ b/src/quicktemplates2/qquicktheme_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -48,17 +48,20 @@
// We mean it.
//
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
+#include <QtQuickTemplates2/private/qquickproxytheme_p.h>
#include <QtCore/qscopedpointer.h>
#include <QtGui/qfont.h>
#include <QtGui/qpalette.h>
QT_BEGIN_NAMESPACE
-class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickTheme : public QQuickProxyTheme
+class QQuickThemePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTheme : public QQuickProxyTheme
{
public:
QQuickTheme();
+ ~QQuickTheme();
const QFont *font(Font type = SystemFont) const override;
const QPalette *palette(Palette type = SystemPalette) const override;
@@ -71,8 +74,9 @@ protected:
virtual void resolvePalettes(const QPalette &defaultPalette);
private:
- QScopedPointer<const QFont> m_defaultFont;
- QScopedPointer<const QPalette> m_defaultPalette;
+ Q_DISABLE_COPY(QQuickTheme)
+ Q_DECLARE_PRIVATE(QQuickTheme)
+ QScopedPointer<QQuickThemePrivate> d_ptr;
};
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktheme_p_p.h b/src/quicktemplates2/qquicktheme_p_p.h
new file mode 100644
index 00000000..5c20610d
--- /dev/null
+++ b/src/quicktemplates2/qquicktheme_p_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 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 QQUICKTHEME_P_P_H
+#define QQUICKTHEME_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 <QtQuickTemplates2/private/qquicktheme_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickThemePrivate
+{
+public:
+ static QQuickThemePrivate *get(QQuickTheme *theme)
+ {
+ return theme->d_func();
+ }
+
+ QScopedPointer<const QFont> defaultFont;
+ QScopedPointer<const QPalette> defaultPalette;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKTHEME_P_P_H
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
index b2193ec0..c9ccc420 100644
--- a/src/quicktemplates2/quicktemplates2.pri
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -59,6 +59,7 @@ HEADERS += \
$$PWD/qquickpopuppositioner_p_p.h \
$$PWD/qquickpresshandler_p_p.h \
$$PWD/qquickprogressbar_p.h \
+ $$PWD/qquickproxytheme_p.h \
$$PWD/qquickradiobutton_p.h \
$$PWD/qquickradiodelegate_p.h \
$$PWD/qquickrangeslider_p.h \
@@ -86,6 +87,8 @@ HEADERS += \
$$PWD/qquicktextarea_p_p.h \
$$PWD/qquicktextfield_p.h \
$$PWD/qquicktextfield_p_p.h \
+ $$PWD/qquicktheme_p.h \
+ $$PWD/qquicktheme_p_p.h \
$$PWD/qquicktoolbar_p.h \
$$PWD/qquicktoolbutton_p.h \
$$PWD/qquicktoolseparator_p.h \
@@ -133,6 +136,7 @@ SOURCES += \
$$PWD/qquickpopuppositioner.cpp \
$$PWD/qquickpresshandler.cpp \
$$PWD/qquickprogressbar.cpp \
+ $$PWD/qquickproxytheme.cpp \
$$PWD/qquickradiobutton.cpp \
$$PWD/qquickradiodelegate.cpp \
$$PWD/qquickrangeslider.cpp \
@@ -155,6 +159,7 @@ SOURCES += \
$$PWD/qquicktabbutton.cpp \
$$PWD/qquicktextarea.cpp \
$$PWD/qquicktextfield.cpp \
+ $$PWD/qquicktheme.cpp \
$$PWD/qquicktoolbar.cpp \
$$PWD/qquicktoolbutton.cpp \
$$PWD/qquicktoolseparator.cpp \
diff --git a/tests/auto/font/tst_font.cpp b/tests/auto/font/tst_font.cpp
index 660f4baf..da8f3a2c 100644
--- a/tests/auto/font/tst_font.cpp
+++ b/tests/auto/font/tst_font.cpp
@@ -45,7 +45,7 @@
#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
+#include <QtQuickTemplates2/private/qquickproxytheme_p.h>
using namespace QQuickVisualTestUtil;
diff --git a/tests/auto/palette/tst_palette.cpp b/tests/auto/palette/tst_palette.cpp
index f74e358a..c0586211 100644
--- a/tests/auto/palette/tst_palette.cpp
+++ b/tests/auto/palette/tst_palette.cpp
@@ -46,7 +46,7 @@
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
+#include <QtQuickTemplates2/private/qquickproxytheme_p.h>
using namespace QQuickVisualTestUtil;
diff --git a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp
index aeeddb10..8e934e33 100644
--- a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp
+++ b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp
@@ -50,7 +50,7 @@
#include <QtQuickTemplates2/private/qquickpopup_p.h>
#include <QtQuickTemplates2/private/qquicktextarea_p.h>
#include <QtQuickTemplates2/private/qquicktextfield_p.h>
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
+#include <QtQuickTemplates2/private/qquickproxytheme_p.h>
#include "../shared/util.h"
#include "../shared/visualtestutil.h"