summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2018-03-15 13:29:45 +0100
committerLorn Potter <lorn.potter@gmail.com>2018-03-16 01:18:15 +0000
commitfe955df5128bb6a3bdcbb893f8ce852478b55ead (patch)
treeae5b8afc5cf145ab6012b1ab09e9055843a09207
parent4c8cd78230c31b75b89dcc4103c368c2e0818af2 (diff)
wasm: Make widgets use fusion style by default
Add a platform theme and implement the StyleNames theme hint. Change-Id: I2e1638db31218fa24714f0c409c50670a88b786a Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r--src/plugins/platforms/html5/html5.pro6
-rw-r--r--src/plugins/platforms/html5/qhtml5integration.cpp13
-rw-r--r--src/plugins/platforms/html5/qhtml5integration.h2
-rw-r--r--src/plugins/platforms/html5/qhtml5theme.cpp52
-rw-r--r--src/plugins/platforms/html5/qhtml5theme.h56
5 files changed, 127 insertions, 2 deletions
diff --git a/src/plugins/platforms/html5/html5.pro b/src/plugins/platforms/html5/html5.pro
index 832e814282..663261866a 100644
--- a/src/plugins/platforms/html5/html5.pro
+++ b/src/plugins/platforms/html5/html5.pro
@@ -20,7 +20,8 @@ SOURCES = main.cpp \
qhtml5eventdispatcher.cpp \
qhtml5compositor.cpp \
qhtml5cursor.cpp \
- qhtml5openglcontext.cpp
+ qhtml5openglcontext.cpp \
+ qhtml5theme.cpp
HEADERS = qhtml5integration.h \
qhtml5window.h \
@@ -31,7 +32,8 @@ HEADERS = qhtml5integration.h \
qhtml5compositor.h \
qhtml5stylepixmaps_p.h \
qhtml5cursor.h \
- qhtml5openglcontext.h
+ qhtml5openglcontext.h \
+ qhtml5theme.h
RESOURCES += fonts/html5fonts.qrc
diff --git a/src/plugins/platforms/html5/qhtml5integration.cpp b/src/plugins/platforms/html5/qhtml5integration.cpp
index 574816eeab..9583542861 100644
--- a/src/plugins/platforms/html5/qhtml5integration.cpp
+++ b/src/plugins/platforms/html5/qhtml5integration.cpp
@@ -32,6 +32,7 @@
#include "qhtml5eventdispatcher.h"
#include "qhtml5compositor.h"
#include "qhtml5openglcontext.h"
+#include "qhtml5theme.h"
#include "qhtml5window.h"
#ifndef QT_NO_OPENGL
@@ -197,6 +198,18 @@ QVariant QHtml5Integration::styleHint(QPlatformIntegration::StyleHint hint) cons
return QPlatformIntegration::styleHint(hint);
}
+QStringList QHtml5Integration::themeNames() const
+{
+ return QStringList() << QLatin1String("html5");
+}
+
+QPlatformTheme *QHtml5Integration::createPlatformTheme(const QString &name) const
+{
+ if (name == QLatin1String("html5"))
+ return new QHtml5Theme();
+ return QPlatformIntegration::createPlatformTheme(name);
+}
+
int QHtml5Integration::uiEvent_cb(int eventType, const EmscriptenUiEvent *e, void *userData)
{
Q_UNUSED(e)
diff --git a/src/plugins/platforms/html5/qhtml5integration.h b/src/plugins/platforms/html5/qhtml5integration.h
index cf06040fde..4eb24ca9ba 100644
--- a/src/plugins/platforms/html5/qhtml5integration.h
+++ b/src/plugins/platforms/html5/qhtml5integration.h
@@ -66,6 +66,8 @@ public:
QPlatformFontDatabase *fontDatabase() const override;
QAbstractEventDispatcher *createEventDispatcher() const override;
QVariant styleHint(QPlatformIntegration::StyleHint hint) const override;
+ QStringList themeNames() const override;
+ QPlatformTheme *createPlatformTheme(const QString &name) const override;
static QHtml5Integration *get();
QHtml5Screen *screen() { return mScreen; }
diff --git a/src/plugins/platforms/html5/qhtml5theme.cpp b/src/plugins/platforms/html5/qhtml5theme.cpp
new file mode 100644
index 0000000000..31edcfb0cd
--- /dev/null
+++ b/src/plugins/platforms/html5/qhtml5theme.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qhtml5theme.h"
+#include <QtCore/QVariant>
+
+QT_BEGIN_NAMESPACE
+
+QHtml5Theme::QHtml5Theme()
+{
+
+}
+
+QHtml5Theme::~QHtml5Theme()
+{
+
+}
+
+QVariant QHtml5Theme::themeHint(ThemeHint hint) const
+{
+ if (hint == QPlatformTheme::StyleNames)
+ return QVariant(QStringList() << QLatin1String("fusion"));
+ return QPlatformTheme::themeHint(hint);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/html5/qhtml5theme.h b/src/plugins/platforms/html5/qhtml5theme.h
new file mode 100644
index 0000000000..7f3d58e171
--- /dev/null
+++ b/src/plugins/platforms/html5/qhtml5theme.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHTML5THEME_H
+#define QHTML5THEME_H
+
+#include <qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+class QHtml5EventTranslator;
+class QHtml5FontDatabase;
+class QHtml5Window;
+class QHtml5EventDispatcher;
+class QHtml5Screen;
+class QHtml5Compositor;
+class QHtml5BackingStore;
+
+class QHtml5Theme : public QPlatformTheme
+{
+public:
+ QHtml5Theme();
+ ~QHtml5Theme();
+
+ QVariant themeHint(ThemeHint hint) const override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QHTML5THEME_H