aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-17 15:46:46 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-18 22:14:34 +0000
commit09e83913e9bfee232d436773a9a08f153aa00a70 (patch)
tree0b907bd45dd57a2d7f410f755a0f2868aa5147c5 /src/imports
parent94136244c58ed035be44183bd8eb00314bccf7df (diff)
Cleanup QQuickProxyStyle
Install and remove the proxy theme automatically to eliminate the need for TestTheme do it in tst_applicationwindow. Furthermore, fix some Qt coding conventions, align header guards, remove unneeded empty destructor, and add missing explicit keywords for one-parameter constructors and cleanup somemeaningless ones in paremeterless ctors. Change-Id: Ib95dad003e35e468e941f3a0d2be5b21323fcccd Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/controls/material/qquickmaterialtheme.cpp4
-rw-r--r--src/imports/controls/material/qquickmaterialtheme_p.h11
-rw-r--r--src/imports/controls/material/qtlabsmaterialstyleplugin.cpp9
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme.cpp4
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme_p.h11
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp9
6 files changed, 12 insertions, 36 deletions
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp
index 5c89d382..afe6bf65 100644
--- a/src/imports/controls/material/qquickmaterialtheme.cpp
+++ b/src/imports/controls/material/qquickmaterialtheme.cpp
@@ -67,10 +67,6 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
menuItemFont.setPixelSize(16);
}
-QQuickMaterialTheme::~QQuickMaterialTheme()
-{
-}
-
const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
{
switch (type) {
diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h
index 9fd74bcc..55533ee5 100644
--- a/src/imports/controls/material/qquickmaterialtheme_p.h
+++ b/src/imports/controls/material/qquickmaterialtheme_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKMATERIALTHEME_H
-#define QQUICKMATERIALTHEME_H
+#ifndef QQUICKMATERIALTHEME_P_H
+#define QQUICKMATERIALTHEME_P_H
//
// W A R N I N G
@@ -48,7 +48,6 @@
// We mean it.
//
-#include <QtGui/qpa/qplatformtheme.h>
#include <QtGui/qfont.h>
#include <QtQuickControls/private/qquickproxytheme_p.h>
@@ -57,9 +56,7 @@ QT_BEGIN_NAMESPACE
class QQuickMaterialTheme : public QQuickProxyTheme
{
public:
- QQuickMaterialTheme(QPlatformTheme *theme);
-
- ~QQuickMaterialTheme();
+ explicit QQuickMaterialTheme(QPlatformTheme *theme = nullptr);
const QFont *font(Font type = SystemFont) const override;
@@ -72,4 +69,4 @@ private:
QT_END_NAMESPACE
-#endif // QQUICKMATERIALTHEME_H
+#endif // QQUICKMATERIALTHEME_P_H
diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
index a42424ea..ee9940f2 100644
--- a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
+++ b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
@@ -93,13 +93,8 @@ void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char
{
Q_UNUSED(engine);
- if (QQuickStyle::name().compare(QLatin1String("material"), Qt::CaseInsensitive) == 0) {
- QPlatformTheme *old = QGuiApplicationPrivate::platform_theme;
- if (old) {
- QQuickProxyTheme *theme = new QQuickMaterialTheme(old);
- QGuiApplicationPrivate::platform_theme = theme;
- }
- }
+ if (QQuickStyle::name().compare(QLatin1String("material"), Qt::CaseInsensitive) == 0)
+ QGuiApplicationPrivate::platform_theme = new QQuickMaterialTheme;
QByteArray import = QByteArray(uri) + ".impl";
qmlRegisterType<QQuickMaterialProgressRing>(import, 1, 0, "ProgressRing");
diff --git a/src/imports/controls/universal/qquickuniversaltheme.cpp b/src/imports/controls/universal/qquickuniversaltheme.cpp
index 290faa5d..066d1194 100644
--- a/src/imports/controls/universal/qquickuniversaltheme.cpp
+++ b/src/imports/controls/universal/qquickuniversaltheme.cpp
@@ -59,10 +59,6 @@ QQuickUniversalTheme::QQuickUniversalTheme(QPlatformTheme *theme)
tabButtonFont.setWeight(QFont::Light);
}
-QQuickUniversalTheme::~QQuickUniversalTheme()
-{
-}
-
const QFont *QQuickUniversalTheme::font(QPlatformTheme::Font type) const
{
switch (type) {
diff --git a/src/imports/controls/universal/qquickuniversaltheme_p.h b/src/imports/controls/universal/qquickuniversaltheme_p.h
index 07e4905d..0435d46c 100644
--- a/src/imports/controls/universal/qquickuniversaltheme_p.h
+++ b/src/imports/controls/universal/qquickuniversaltheme_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKUNIVERSALTHEME_H
-#define QQUICKUNIVERSALTHEME_H
+#ifndef QQUICKUNIVERSALTHEME_P_H
+#define QQUICKUNIVERSALTHEME_P_H
//
// W A R N I N G
@@ -48,7 +48,6 @@
// We mean it.
//
-#include <QtGui/qpa/qplatformtheme.h>
#include <QtGui/qfont.h>
#include <QtQuickControls/private/qquickproxytheme_p.h>
@@ -57,9 +56,7 @@ QT_BEGIN_NAMESPACE
class QQuickUniversalTheme : public QQuickProxyTheme
{
public:
- QQuickUniversalTheme(QPlatformTheme *theme);
-
- ~QQuickUniversalTheme();
+ explicit QQuickUniversalTheme(QPlatformTheme *theme = nullptr);
const QFont *font(Font type = SystemFont) const override;
@@ -71,4 +68,4 @@ private:
QT_END_NAMESPACE
-#endif // QQUICKUNIVERSALTHEME_H
+#endif // QQUICKUNIVERSALTHEME_P_H
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
index 15857f67..7fe69493 100644
--- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
+++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
@@ -91,13 +91,8 @@ void QtLabsUniversalStylePlugin::registerTypes(const char *uri)
void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{
- if (QQuickStyle::name().compare(QLatin1String("universal"), Qt::CaseInsensitive) == 0) {
- QPlatformTheme *old = QGuiApplicationPrivate::platform_theme;
- if (old) {
- QQuickProxyTheme *theme = new QQuickUniversalTheme(old);
- QGuiApplicationPrivate::platform_theme = theme;
- }
- }
+ if (QQuickStyle::name().compare(QLatin1String("universal"), Qt::CaseInsensitive) == 0)
+ QGuiApplicationPrivate::platform_theme = new QQuickUniversalTheme;
engine->addImageProvider(QStringLiteral("universal"), new QQuickColorImageProvider(QStringLiteral(":/qt-project.org/imports/Qt/labs/controls/universal/images")));