aboutsummaryrefslogtreecommitdiffstats
path: root/src/controls
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/controls.pri8
-rw-r--r--src/controls/controls.pro6
-rw-r--r--src/controls/controls.qrc5
-rw-r--r--src/controls/qquickabstractapplicationwindow.cpp47
-rw-r--r--src/controls/qquickabstractapplicationwindow_p.h12
-rw-r--r--src/controls/qquickabstracttextarea.cpp71
-rw-r--r--src/controls/qquickabstracttextarea_p.h13
-rw-r--r--src/controls/qquickabstracttextfield.cpp71
-rw-r--r--src/controls/qquickabstracttextfield_p.h13
-rw-r--r--src/controls/qquickcontrol.cpp72
-rw-r--r--src/controls/qquickcontrol_p.h14
-rw-r--r--src/controls/qquickcontrol_p_p.h5
-rw-r--r--src/controls/qquickstylable_p.h73
-rw-r--r--src/controls/qquickstyle.cpp204
-rw-r--r--src/controls/qquickstyle_p.h122
-rw-r--r--src/controls/qquickstyle_p_p.h64
-rw-r--r--src/controls/style.json16
17 files changed, 11 insertions, 805 deletions
diff --git a/src/controls/controls.pri b/src/controls/controls.pri
index 189ed27e..0a2e647d 100644
--- a/src/controls/controls.pri
+++ b/src/controls/controls.pri
@@ -30,10 +30,7 @@ HEADERS += \
$$PWD/qquickabstracttoolbar_p.h \
$$PWD/qquickcontrol_p.h \
$$PWD/qquickcontrol_p_p.h \
- $$PWD/qquickexclusivegroup_p.h \
- $$PWD/qquickstylable_p.h \
- $$PWD/qquickstyle_p_p.h \
- $$PWD/qquickstyle_p.h
+ $$PWD/qquickexclusivegroup_p.h
SOURCES += \
$$PWD/qquickabstractapplicationwindow.cpp \
@@ -61,5 +58,4 @@ SOURCES += \
$$PWD/qquickabstracttogglebutton.cpp \
$$PWD/qquickabstracttoolbar.cpp \
$$PWD/qquickcontrol.cpp \
- $$PWD/qquickexclusivegroup.cpp \
- $$PWD/qquickstyle.cpp
+ $$PWD/qquickexclusivegroup.cpp
diff --git a/src/controls/controls.pro b/src/controls/controls.pro
index c4a1ff87..ae69b57b 100644
--- a/src/controls/controls.pro
+++ b/src/controls/controls.pro
@@ -12,11 +12,5 @@ QMAKE_DOCS = $$PWD/doc/qtquickcontrols2.qdocconf
HEADERS += \
$$PWD/qtquickcontrolsglobal_p.h
-OTHER_FILES += \
- $$PWD/style.json
-
-RESOURCES += \
- $$PWD/controls.qrc
-
include(controls.pri)
load(qt_module)
diff --git a/src/controls/controls.qrc b/src/controls/controls.qrc
deleted file mode 100644
index c1dded8a..00000000
--- a/src/controls/controls.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/qtquickcontrols">
- <file>style.json</file>
-</qresource>
-</RCC>
diff --git a/src/controls/qquickabstractapplicationwindow.cpp b/src/controls/qquickabstractapplicationwindow.cpp
index 1800e302..1ac37d7e 100644
--- a/src/controls/qquickabstractapplicationwindow.cpp
+++ b/src/controls/qquickabstractapplicationwindow.cpp
@@ -35,9 +35,7 @@
****************************************************************************/
#include "qquickabstractapplicationwindow_p.h"
-#include "qquickstyle_p.h"
-#include <QtCore/qcoreapplication.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickitemchangelistener_p.h>
@@ -59,8 +57,7 @@ class QQuickAbstractApplicationWindowPrivate : public QQuickItemChangeListener
Q_DECLARE_PUBLIC(QQuickAbstractApplicationWindow)
public:
- QQuickAbstractApplicationWindowPrivate() : contentWidth(0), contentHeight(0),
- header(Q_NULLPTR), footer(Q_NULLPTR), hasStyle(false), style(Q_NULLPTR) { }
+ QQuickAbstractApplicationWindowPrivate() : contentWidth(0), contentHeight(0), header(Q_NULLPTR), footer(Q_NULLPTR) { }
void relayout();
@@ -71,8 +68,6 @@ public:
qreal contentHeight;
QQuickItem *header;
QQuickItem *footer;
- bool hasStyle;
- mutable QQuickStyle *style;
QQuickAbstractApplicationWindow *q_ptr;
};
@@ -176,46 +171,6 @@ void QQuickAbstractApplicationWindow::setFooter(QQuickItem *footer)
}
/*!
- \qmlproperty Style QtQuickControls2::ApplicationWindow::style
-
- TODO
-*/
-QQuickStyle *QQuickAbstractApplicationWindow::style() const
-{
- Q_D(const QQuickAbstractApplicationWindow);
- if (!d->style)
- d->style = QQuickStyle::instance(qmlEngine(this));
- return d->style;
-}
-
-void QQuickAbstractApplicationWindow::setStyle(QQuickStyle *style)
-{
- Q_D(QQuickAbstractApplicationWindow);
- if (d->style != style) {
- d->style = style;
- d->hasStyle = style;
- emit styleChanged();
-
- QEvent change(QEvent::StyleChange);
- foreach (QQuickItem *item, contentItem()->findChildren<QQuickItem *>()) {
- if (qobject_cast<QQuickStylable *>(item))
- QCoreApplication::sendEvent(item, &change);
- }
- }
-}
-
-bool QQuickAbstractApplicationWindow::hasStyle() const
-{
- Q_D(const QQuickAbstractApplicationWindow);
- return d->hasStyle;
-}
-
-void QQuickAbstractApplicationWindow::resetStyle()
-{
- setStyle(Q_NULLPTR);
-}
-
-/*!
\qmlproperty real QtQuickControls2::ApplicationWindow::contentWidth
TODO
diff --git a/src/controls/qquickabstractapplicationwindow_p.h b/src/controls/qquickabstractapplicationwindow_p.h
index 8438a278..4b378123 100644
--- a/src/controls/qquickabstractapplicationwindow_p.h
+++ b/src/controls/qquickabstractapplicationwindow_p.h
@@ -50,20 +50,16 @@
#include <QtQuick/private/qquickwindowmodule_p.h>
#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
-#include <QtQuickControls/private/qquickstylable_p.h>
QT_BEGIN_NAMESPACE
-class QQuickStyle;
class QQuickAbstractApplicationWindowPrivate;
-class Q_QUICKCONTROLS_EXPORT QQuickAbstractApplicationWindow : public QQuickWindowQmlImpl, public QQuickStylable
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractApplicationWindow : public QQuickWindowQmlImpl
{
Q_OBJECT
- Q_INTERFACES(QQuickStylable)
Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
- Q_PROPERTY(QQuickStyle *style READ style WRITE setStyle NOTIFY styleChanged FINAL)
Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
@@ -77,11 +73,6 @@ public:
QQuickItem *footer() const;
void setFooter(QQuickItem *footer);
- QQuickStyle *style() const Q_DECL_OVERRIDE;
- void setStyle(QQuickStyle *style) Q_DECL_OVERRIDE;
- bool hasStyle() const Q_DECL_OVERRIDE;
- void resetStyle() Q_DECL_OVERRIDE;
-
qreal contentWidth() const;
void setContentWidth(qreal width);
@@ -91,7 +82,6 @@ public:
Q_SIGNALS:
void headerChanged();
void footerChanged();
- void styleChanged();
void contentWidthChanged();
void contentHeightChanged();
diff --git a/src/controls/qquickabstracttextarea.cpp b/src/controls/qquickabstracttextarea.cpp
index 0da6cdb1..8f4219d6 100644
--- a/src/controls/qquickabstracttextarea.cpp
+++ b/src/controls/qquickabstracttextarea.cpp
@@ -35,14 +35,10 @@
****************************************************************************/
#include "qquickabstracttextarea_p.h"
-#include "qquickabstractapplicationwindow_p.h"
-#include "qquickstyle_p_p.h"
-#include "qquickstyle_p.h"
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquicktext_p.h>
#include <QtQuick/private/qquickclipnode_p.h>
-#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
@@ -51,28 +47,13 @@ class QQuickAbstractTextAreaPrivate
Q_DECLARE_PUBLIC(QQuickAbstractTextArea)
public:
- QQuickAbstractTextAreaPrivate() : hasStyle(false), style(Q_NULLPTR),
- background(Q_NULLPTR), placeholder(Q_NULLPTR) { }
+ QQuickAbstractTextAreaPrivate() : background(Q_NULLPTR), placeholder(Q_NULLPTR) { }
- void resolveStyle(QQuickStyle *other = 0); // TODO
-
- bool hasStyle;
- QQuickStyle *style;
QQuickItem *background;
QQuickText *placeholder;
QQuickAbstractTextArea *q_ptr;
};
-void QQuickAbstractTextAreaPrivate::resolveStyle(QQuickStyle *res)
-{
- Q_Q(QQuickAbstractTextArea);
- res = QQuickStylePrivate::resolve(q, res);
- if (style != res) {
- style = res;
- emit q->styleChanged();
- }
-}
-
QQuickAbstractTextArea::QQuickAbstractTextArea(QQuickItem *parent) :
QQuickTextEdit(parent), d_ptr(new QQuickAbstractTextAreaPrivate)
{
@@ -84,40 +65,6 @@ QQuickAbstractTextArea::~QQuickAbstractTextArea()
{
}
-QQuickStyle *QQuickAbstractTextArea::style() const
-{
- Q_D(const QQuickAbstractTextArea);
- if (!d->style)
- const_cast<QQuickAbstractTextArea *>(this)->d_func()->resolveStyle();
- return d->style;
-}
-
-void QQuickAbstractTextArea::setStyle(QQuickStyle *style)
-{
- Q_D(QQuickAbstractTextArea);
- if (d->style != style) {
- d->hasStyle = true;
- d->resolveStyle(style);
-
- QEvent change(QEvent::StyleChange);
- foreach (QObject *object, findChildren<QObject *>()) {
- if (qobject_cast<QQuickStylable *>(object))
- QCoreApplication::sendEvent(object, &change);
- }
- }
-}
-
-bool QQuickAbstractTextArea::hasStyle() const
-{
- Q_D(const QQuickAbstractTextArea);
- return d->hasStyle;
-}
-
-void QQuickAbstractTextArea::resetStyle()
-{
- setStyle(Q_NULLPTR);
-}
-
QQuickItem *QQuickAbstractTextArea::background() const
{
Q_D(const QQuickAbstractTextArea);
@@ -157,22 +104,6 @@ void QQuickAbstractTextArea::setPlaceholder(QQuickText *placeholder)
}
}
-bool QQuickAbstractTextArea::event(QEvent *event)
-{
- Q_D(QQuickAbstractTextArea);
- if (event->type() == QEvent::StyleChange)
- d->resolveStyle();
- return QQuickTextEdit::event(event);
-}
-
-void QQuickAbstractTextArea::itemChange(ItemChange change, const ItemChangeData &data)
-{
- Q_D(QQuickAbstractTextArea);
- QQuickTextEdit::itemChange(change, data);
- if (change == ItemSceneChange || change == ItemParentHasChanged)
- d->resolveStyle();
-}
-
void QQuickAbstractTextArea::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickAbstractTextArea);
diff --git a/src/controls/qquickabstracttextarea_p.h b/src/controls/qquickabstracttextarea_p.h
index e937a16a..24e76d29 100644
--- a/src/controls/qquickabstracttextarea_p.h
+++ b/src/controls/qquickabstracttextarea_p.h
@@ -50,18 +50,15 @@
#include <QtQuick/private/qquicktextedit_p.h>
#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
-#include <QtQuickControls/private/qquickstylable_p.h>
QT_BEGIN_NAMESPACE
class QQuickText;
class QQuickAbstractTextAreaPrivate;
-class Q_QUICKCONTROLS_EXPORT QQuickAbstractTextArea : public QQuickTextEdit, public QQuickStylable
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractTextArea : public QQuickTextEdit
{
Q_OBJECT
- Q_INTERFACES(QQuickStylable)
- Q_PROPERTY(QQuickStyle *style READ style WRITE setStyle RESET resetStyle NOTIFY styleChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickText *placeholder READ placeholder WRITE setPlaceholder NOTIFY placeholderChanged FINAL)
@@ -69,11 +66,6 @@ public:
explicit QQuickAbstractTextArea(QQuickItem *parent = Q_NULLPTR);
~QQuickAbstractTextArea();
- QQuickStyle *style() const;
- void setStyle(QQuickStyle *style);
- bool hasStyle() const;
- void resetStyle();
-
QQuickItem *background() const;
void setBackground(QQuickItem *background);
@@ -81,13 +73,10 @@ public:
void setPlaceholder(QQuickText *placeholder);
Q_SIGNALS:
- void styleChanged();
void backgroundChanged();
void placeholderChanged();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void itemChange(ItemChange, const ItemChangeData &data) Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE;
diff --git a/src/controls/qquickabstracttextfield.cpp b/src/controls/qquickabstracttextfield.cpp
index ced75544..82825ce4 100644
--- a/src/controls/qquickabstracttextfield.cpp
+++ b/src/controls/qquickabstracttextfield.cpp
@@ -35,14 +35,10 @@
****************************************************************************/
#include "qquickabstracttextfield_p.h"
-#include "qquickabstractapplicationwindow_p.h"
-#include "qquickstyle_p_p.h"
-#include "qquickstyle_p.h"
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquicktext_p.h>
#include <QtQuick/private/qquickclipnode_p.h>
-#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
@@ -51,28 +47,13 @@ class QQuickAbstractTextFieldPrivate
Q_DECLARE_PUBLIC(QQuickAbstractTextField)
public:
- QQuickAbstractTextFieldPrivate() : hasStyle(false), style(Q_NULLPTR),
- background(Q_NULLPTR), placeholder(Q_NULLPTR) { }
+ QQuickAbstractTextFieldPrivate() : background(Q_NULLPTR), placeholder(Q_NULLPTR) { }
- void resolveStyle(QQuickStyle *other = 0); // TODO
-
- bool hasStyle;
- QQuickStyle *style;
QQuickItem *background;
QQuickText *placeholder;
QQuickAbstractTextField *q_ptr;
};
-void QQuickAbstractTextFieldPrivate::resolveStyle(QQuickStyle *res)
-{
- Q_Q(QQuickAbstractTextField);
- res = QQuickStylePrivate::resolve(q, res);
- if (style != res) {
- style = res;
- emit q->styleChanged();
- }
-}
-
QQuickAbstractTextField::QQuickAbstractTextField(QQuickItem *parent) :
QQuickTextInput(parent), d_ptr(new QQuickAbstractTextFieldPrivate)
{
@@ -84,40 +65,6 @@ QQuickAbstractTextField::~QQuickAbstractTextField()
{
}
-QQuickStyle *QQuickAbstractTextField::style() const
-{
- Q_D(const QQuickAbstractTextField);
- if (!d->style)
- const_cast<QQuickAbstractTextField *>(this)->d_func()->resolveStyle();
- return d->style;
-}
-
-void QQuickAbstractTextField::setStyle(QQuickStyle *style)
-{
- Q_D(QQuickAbstractTextField);
- if (d->style != style) {
- d->hasStyle = true;
- d->resolveStyle(style);
-
- QEvent change(QEvent::StyleChange);
- foreach (QObject *object, findChildren<QObject *>()) {
- if (qobject_cast<QQuickStylable *>(object))
- QCoreApplication::sendEvent(object, &change);
- }
- }
-}
-
-bool QQuickAbstractTextField::hasStyle() const
-{
- Q_D(const QQuickAbstractTextField);
- return d->hasStyle;
-}
-
-void QQuickAbstractTextField::resetStyle()
-{
- setStyle(Q_NULLPTR);
-}
-
QQuickItem *QQuickAbstractTextField::background() const
{
Q_D(const QQuickAbstractTextField);
@@ -157,22 +104,6 @@ void QQuickAbstractTextField::setPlaceholder(QQuickText *placeholder)
}
}
-bool QQuickAbstractTextField::event(QEvent *event)
-{
- Q_D(QQuickAbstractTextField);
- if (event->type() == QEvent::StyleChange)
- d->resolveStyle();
- return QQuickTextInput::event(event);
-}
-
-void QQuickAbstractTextField::itemChange(ItemChange change, const ItemChangeData &data)
-{
- Q_D(QQuickAbstractTextField);
- QQuickTextInput::itemChange(change, data);
- if (change == ItemSceneChange || change == ItemParentHasChanged)
- d->resolveStyle();
-}
-
void QQuickAbstractTextField::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickAbstractTextField);
diff --git a/src/controls/qquickabstracttextfield_p.h b/src/controls/qquickabstracttextfield_p.h
index e666fa9b..248c6a55 100644
--- a/src/controls/qquickabstracttextfield_p.h
+++ b/src/controls/qquickabstracttextfield_p.h
@@ -50,18 +50,15 @@
#include <QtQuick/private/qquicktextinput_p.h>
#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
-#include <QtQuickControls/private/qquickstylable_p.h>
QT_BEGIN_NAMESPACE
class QQuickText;
class QQuickAbstractTextFieldPrivate;
-class Q_QUICKCONTROLS_EXPORT QQuickAbstractTextField : public QQuickTextInput, public QQuickStylable
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractTextField : public QQuickTextInput
{
Q_OBJECT
- Q_INTERFACES(QQuickStylable)
- Q_PROPERTY(QQuickStyle *style READ style WRITE setStyle RESET resetStyle NOTIFY styleChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickText *placeholder READ placeholder WRITE setPlaceholder NOTIFY placeholderChanged FINAL)
@@ -69,11 +66,6 @@ public:
explicit QQuickAbstractTextField(QQuickItem *parent = Q_NULLPTR);
~QQuickAbstractTextField();
- QQuickStyle *style() const;
- void setStyle(QQuickStyle *style);
- bool hasStyle() const;
- void resetStyle();
-
QQuickItem *background() const;
void setBackground(QQuickItem *background);
@@ -81,13 +73,10 @@ public:
void setPlaceholder(QQuickText *placeholder);
Q_SIGNALS:
- void styleChanged();
void backgroundChanged();
void placeholderChanged();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void itemChange(ItemChange, const ItemChangeData &data) Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE;
diff --git a/src/controls/qquickcontrol.cpp b/src/controls/qquickcontrol.cpp
index 1d843597..61389ad6 100644
--- a/src/controls/qquickcontrol.cpp
+++ b/src/controls/qquickcontrol.cpp
@@ -36,9 +36,6 @@
#include "qquickcontrol_p.h"
#include "qquickcontrol_p_p.h"
-#include "qquickstyle_p_p.h"
-
-#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
@@ -53,9 +50,9 @@ QT_BEGIN_NAMESPACE
*/
QQuickControlPrivate::QQuickControlPrivate() :
- hasStyle(false), hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false),
+ hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false),
padding(0), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0),
- background(Q_NULLPTR), style(Q_NULLPTR)
+ background(Q_NULLPTR)
{
}
@@ -105,16 +102,6 @@ void QQuickControlPrivate::setBottomPadding(qreal value, bool reset)
emit q->bottomPaddingChanged();
}
-void QQuickControlPrivate::resolveStyle(QQuickStyle *res)
-{
- Q_Q(QQuickControl);
- res = QQuickStylePrivate::resolve(q, res);
- if (style != res) {
- style = res;
- emit q->styleChanged();
- }
-}
-
QQuickControl::QQuickControl(QQuickItem *parent) :
QQuickItem(*(new QQuickControlPrivate), parent)
{
@@ -268,61 +255,6 @@ void QQuickControl::setBackground(QQuickItem *background)
}
}
-/*!
- \qmlproperty Style QtQuickControls2::Control::style
-
- This property holds the style.
-*/
-QQuickStyle *QQuickControl::style() const
-{
- Q_D(const QQuickControl);
- if (!d->style)
- const_cast<QQuickControl *>(this)->d_func()->resolveStyle();
- return d->style;
-}
-
-void QQuickControl::setStyle(QQuickStyle *style)
-{
- Q_D(QQuickControl);
- if (d->style != style) {
- d->hasStyle = style;
- d->resolveStyle(style);
-
- QEvent change(QEvent::StyleChange);
- foreach (QQuickItem *item, findChildren<QQuickItem *>()) {
- if (qobject_cast<QQuickStylable *>(item))
- QCoreApplication::sendEvent(item, &change);
- }
- }
-}
-
-bool QQuickControl::hasStyle() const
-{
- Q_D(const QQuickControl);
- return d->hasStyle;
-}
-
-void QQuickControl::resetStyle()
-{
- setStyle(Q_NULLPTR);
-}
-
-bool QQuickControl::event(QEvent *event)
-{
- Q_D(QQuickControl);
- if (event->type() == QEvent::StyleChange)
- d->resolveStyle();
- return QQuickItem::event(event);
-}
-
-void QQuickControl::itemChange(ItemChange change, const ItemChangeData &data)
-{
- Q_D(QQuickControl);
- QQuickItem::itemChange(change, data);
- if (change == ItemSceneChange || change == ItemParentHasChanged)
- d->resolveStyle();
-}
-
void QQuickControl::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickControl);
diff --git a/src/controls/qquickcontrol_p.h b/src/controls/qquickcontrol_p.h
index 3744700e..d0da80fe 100644
--- a/src/controls/qquickcontrol_p.h
+++ b/src/controls/qquickcontrol_p.h
@@ -50,24 +50,20 @@
#include <QtQuick/qquickitem.h>
#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
-#include <QtQuickControls/private/qquickstylable_p.h>
QT_BEGIN_NAMESPACE
-class QQuickStyle;
class QQuickControlPrivate;
-class Q_QUICKCONTROLS_EXPORT QQuickControl : public QQuickItem, public QQuickStylable
+class Q_QUICKCONTROLS_EXPORT QQuickControl : public QQuickItem
{
Q_OBJECT
- Q_INTERFACES(QQuickStylable)
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)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
- Q_PROPERTY(QQuickStyle *style READ style WRITE setStyle RESET resetStyle NOTIFY styleChanged FINAL)
public:
explicit QQuickControl(QQuickItem *parent = Q_NULLPTR);
@@ -95,11 +91,6 @@ public:
QQuickItem *background() const;
void setBackground(QQuickItem *background);
- QQuickStyle *style() const Q_DECL_OVERRIDE;
- void setStyle(QQuickStyle *style) Q_DECL_OVERRIDE;
- bool hasStyle() const Q_DECL_OVERRIDE;
- void resetStyle() Q_DECL_OVERRIDE;
-
Q_SIGNALS:
void paddingChanged();
void topPaddingChanged();
@@ -107,13 +98,10 @@ Q_SIGNALS:
void rightPaddingChanged();
void bottomPaddingChanged();
void backgroundChanged();
- void styleChanged();
protected:
QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void itemChange(ItemChange, const ItemChangeData &data) Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
bool isMirrored() const;
diff --git a/src/controls/qquickcontrol_p_p.h b/src/controls/qquickcontrol_p_p.h
index afd05385..4a3cf8af 100644
--- a/src/controls/qquickcontrol_p_p.h
+++ b/src/controls/qquickcontrol_p_p.h
@@ -49,7 +49,6 @@
//
#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuickControls/private/qquickstyle_p.h>
QT_BEGIN_NAMESPACE
@@ -67,9 +66,6 @@ public:
void setRightPadding(qreal value, bool reset = false);
void setBottomPadding(qreal value, bool reset = false);
- void resolveStyle(QQuickStyle *other = 0);
-
- bool hasStyle;
bool hasTopPadding;
bool hasLeftPadding;
bool hasRightPadding;
@@ -80,7 +76,6 @@ public:
qreal rightPadding;
qreal bottomPadding;
QQuickItem *background;
- QQuickStyle *style;
};
QT_END_NAMESPACE
diff --git a/src/controls/qquickstylable_p.h b/src/controls/qquickstylable_p.h
deleted file mode 100644
index d3a72882..00000000
--- a/src/controls/qquickstylable_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick 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 QQUICKSTYLABLE_P_H
-#define QQUICKSTYLABLE_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/qobject.h>
-#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickStyle;
-
-class Q_QUICKCONTROLS_EXPORT QQuickStylable
-{
-public:
- virtual ~QQuickStylable() { }
-
- virtual QQuickStyle *style() const = 0;
- virtual void setStyle(QQuickStyle *style) = 0;
- virtual bool hasStyle() const = 0;
- virtual void resetStyle() = 0;
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_INTERFACE(QQuickStylable, "io.qt.QQuickStylable")
-
-#endif // QQUICKSTYLABLE_P_H
diff --git a/src/controls/qquickstyle.cpp b/src/controls/qquickstyle.cpp
deleted file mode 100644
index 8b3612c6..00000000
--- a/src/controls/qquickstyle.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick 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_p.h"
-#include "qquickstyle_p_p.h"
-#include "qquickstylable_p.h"
-
-#include <QtCore/qfile.h>
-#include <QtCore/qjsondocument.h>
-#include <QtCore/qjsonobject.h>
-#include <QtCore/qjsonvalue.h>
-#include <QtCore/qdebug.h>
-#include <QtQml/qqmlengine.h>
-#include <QtQuick/qquickitem.h>
-#include <QtQuick/qquickwindow.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Style
- \inherits QtObject
- \instantiates QQuickStyle
- \inqmlmodule QtQuick.Controls
- \ingroup utilities
- \brief A style interface.
-
- TODO
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::accentColor
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::backgroundColor
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::focusColor
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::frameColor
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::pressColor
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::selectedTextColor
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::selectionColor
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::shadowColor
-*/
-
-/*!
- \qmlproperty color QtQuickControls2::Style::textColor
-*/
-
-/*!
- \qmlproperty int QtQuickControls2::Style::padding
-*/
-
-/*!
- \qmlproperty int QtQuickControls2::Style::roundness
-*/
-
-/*!
- \qmlproperty int QtQuickControls2::Style::spacing
-*/
-
-/*!
- \qmlproperty real QtQuickControls2::Style::disabledOpacity
-*/
-
-QQuickStyle *QQuickStylePrivate::resolve(QQuickItem *item, QQuickStyle *res)
-{
- QQuickStylable *stylable = qobject_cast<QQuickStylable *>(item);
- Q_ASSERT(stylable);
-
- if (!res && stylable->hasStyle())
- return stylable->style();
-
- // lookup parent style
- if (!res) {
- QQuickItem *parent = item->parentItem();
- while (!res && parent) {
- QQuickStylable *stylable = qobject_cast<QQuickStylable *>(parent);
- if (stylable && stylable->hasStyle())
- res = stylable->style();
- parent = parent->parentItem();
- }
- }
-
- // fallback to window or global style
- if (!res) {
- QQuickStylable *window = qobject_cast<QQuickStylable *>(item->window());
- if (window)
- res = window->style();
- if (!res)
- res = QQuickStyle::instance(qmlEngine(item));
- }
-
- return res;
-}
-
-static QColor readColorValue(const QJsonValue &value, const QColor &defaultValue)
-{
- if (value.isString())
- return QColor(value.toString());
- return QColor::fromRgba(value.toInt(defaultValue.rgba()));
-}
-
-static double readNumberValue(const QJsonValue &value, double defaultValue)
-{
- return value.toDouble(defaultValue);
-}
-
-QQuickStyle::QQuickStyle(QObject *parent) : QObject(parent)
-{
- QJsonDocument doc;
-
- QFile file(QStringLiteral(":/qtquickcontrols/style.json"));
- if (!file.open(QFile::ReadOnly | QFile::Text)) {
- qDebug() << file.error();
- qWarning() << "QQuickStyle: failed to open ':/qtquickcontrols/style.json': " << qPrintable(file.errorString());
- } else {
- QJsonParseError error;
- doc = QJsonDocument::fromJson(file.readAll(), &error);
- if (error.error != QJsonParseError::NoError)
- qWarning() << "QQuickStyle: failed to parse ':/qtquickcontrols/style.json': " << qPrintable(error.errorString());
- }
-
- QJsonObject style = doc.object();
- accentColor = readColorValue(style.value(QStringLiteral("accentColor")), QColor("#7bc258"));
- backgroundColor = readColorValue(style.value(QStringLiteral("backgroundColor")), QColor("#ffffff"));
- baseColor = readColorValue(style.value(QStringLiteral("baseColor")), QColor("#eeeeee"));
- focusColor = readColorValue(style.value(QStringLiteral("focusColor")), QColor("#45a7d7"));
- frameColor = readColorValue(style.value(QStringLiteral("frameColor")), QColor("#bdbebf"));
- pressColor = readColorValue(style.value(QStringLiteral("pressColor")), QColor("#33333333"));
- selectedTextColor = readColorValue(style.value(QStringLiteral("selectedTextColor")), QColor("#ffffff"));
- selectionColor = readColorValue(style.value(QStringLiteral("selectionColor")), QColor("#45a7d7"));
- shadowColor = readColorValue(style.value(QStringLiteral("shadowColor")), QColor("#28282a"));
- textColor = readColorValue(style.value(QStringLiteral("textColor")), QColor("#26282a"));
- padding = readNumberValue(style.value(QStringLiteral("padding")), 6);
- roundness = readNumberValue(style.value(QStringLiteral("roundness")), 3);
- spacing = readNumberValue(style.value(QStringLiteral("spacing")), 6);
- disabledOpacity = readNumberValue(style.value(QStringLiteral("disabledOpacity")), 0.3);
-}
-
-QQuickStyle *QQuickStyle::instance(QQmlEngine *engine)
-{
- static QHash<QQmlEngine *, QQuickStyle *> styles;
- QHash<QQmlEngine *, QQuickStyle *>::iterator it = styles.find(engine);
- if (it == styles.end())
- it = styles.insert(engine, new QQuickStyle(engine));
- return it.value();
-}
-
-QQuickStyle *QQuickStyle::qmlAttachedProperties(QObject *object)
-{
- return instance(qmlEngine(object));
-}
-
-QT_END_NAMESPACE
diff --git a/src/controls/qquickstyle_p.h b/src/controls/qquickstyle_p.h
deleted file mode 100644
index 4b04ddac..00000000
--- a/src/controls/qquickstyle_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick 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_P_H
-#define QQUICKSTYLE_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/qobject.h>
-#include <QtGui/qcolor.h>
-#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQmlEngine;
-class QJSEngine;
-
-class Q_QUICKCONTROLS_EXPORT QQuickStyle : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QColor accentColor MEMBER accentColor NOTIFY accentColorChanged FINAL)
- Q_PROPERTY(QColor backgroundColor MEMBER backgroundColor NOTIFY backgroundColorChanged FINAL)
- Q_PROPERTY(QColor baseColor MEMBER baseColor NOTIFY baseColorChanged FINAL)
- Q_PROPERTY(QColor focusColor MEMBER focusColor NOTIFY focusColorChanged FINAL)
- Q_PROPERTY(QColor frameColor MEMBER frameColor NOTIFY frameColorChanged FINAL)
- Q_PROPERTY(QColor pressColor MEMBER pressColor NOTIFY pressColorChanged FINAL)
- Q_PROPERTY(QColor selectedTextColor MEMBER selectedTextColor NOTIFY selectedTextColorChanged FINAL)
- Q_PROPERTY(QColor selectionColor MEMBER selectionColor NOTIFY selectionColorChanged FINAL)
- Q_PROPERTY(QColor shadowColor MEMBER shadowColor NOTIFY shadowColorChanged FINAL)
- Q_PROPERTY(QColor textColor MEMBER textColor NOTIFY textColorChanged FINAL)
- Q_PROPERTY(int padding MEMBER padding NOTIFY paddingChanged FINAL)
- Q_PROPERTY(int roundness MEMBER roundness NOTIFY roundnessChanged FINAL)
- Q_PROPERTY(int spacing MEMBER spacing NOTIFY spacingChanged FINAL)
- Q_PROPERTY(qreal disabledOpacity MEMBER disabledOpacity NOTIFY disabledOpacityChanged FINAL)
-
-public:
- explicit QQuickStyle(QObject *parent = Q_NULLPTR);
-
- static QQuickStyle *instance(QQmlEngine *engine);
- static QQuickStyle *qmlAttachedProperties(QObject *object);
-
-Q_SIGNALS:
- void accentColorChanged();
- void backgroundColorChanged();
- void baseColorChanged();
- void focusColorChanged();
- void frameColorChanged();
- void pressColorChanged();
- void selectedTextColorChanged();
- void selectionColorChanged();
- void shadowColorChanged();
- void textColorChanged();
- void paddingChanged();
- void roundnessChanged();
- void spacingChanged();
- void disabledOpacityChanged();
-
-private:
- QColor accentColor;
- QColor baseColor;
- QColor backgroundColor;
- QColor focusColor;
- QColor frameColor;
- QColor pressColor;
- QColor selectedTextColor;
- QColor selectionColor;
- QColor shadowColor;
- QColor textColor;
- int padding;
- int spacing;
- int roundness;
- qreal disabledOpacity;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPEINFO(QQuickStyle, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQUICKSTYLE_P_H
diff --git a/src/controls/qquickstyle_p_p.h b/src/controls/qquickstyle_p_p.h
deleted file mode 100644
index 276ce6aa..00000000
--- a/src/controls/qquickstyle_p_p.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick 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_P_P_H
-#define QQUICKSTYLE_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.
-//
-
-QT_BEGIN_NAMESPACE
-
-class QQuickItem;
-class QQuickStylable;
-
-class QQuickStylePrivate
-{
-public:
- static QQuickStyle *resolve(QQuickItem *item, QQuickStyle *other = 0);
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKSTYLE_P_P_H
diff --git a/src/controls/style.json b/src/controls/style.json
deleted file mode 100644
index a1a79969..00000000
--- a/src/controls/style.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "accentColor": "#7bc258",
- "backgroundColor": "#ffffff",
- "baseColor": "#eeeeee",
- "focusColor": "#45a7d7",
- "frameColor": "#bdbebf",
- "pressColor": "#33333333",
- "selectedTextColor": "#ffffff",
- "selectionColor": "#45a7d7",
- "shadowColor": "#28282a",
- "textColor": "#26282a",
- "padding": 6,
- "roundness": 3,
- "disabledOpacity": 0.3,
- "spacing": 6
-}