Remove non-color properties from Theme
Better start with a minimal set. It will be also easier to transition from Theme to Palette if it gets done. Change-Id: Ic9951ac5b913f99a84e2b8efb9ae7f8d61177aee Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
This commit is contained in:
parent
44cb549108
commit
36c40a1ceb
|
@ -99,7 +99,7 @@ ApplicationWindow {
|
|||
id: title
|
||||
x: delegate.contentItem.x
|
||||
width: delegate.contentItem.width
|
||||
spacing: Theme.spacing
|
||||
spacing: 6
|
||||
Text {
|
||||
width: parent.width
|
||||
height: implicitHeight * 2
|
||||
|
|
|
@ -157,7 +157,7 @@ ApplicationWindow {
|
|||
width: flow.width
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacing
|
||||
spacing: 6
|
||||
readonly property real availableWidth: (flow.width - 12) / 2
|
||||
readonly property real contentWidth: okButton.implicitWidth + cancelButton.implicitWidth + 12
|
||||
readonly property real buttonWidth: implicitWidth > availableWidth ? (width / 2 - spacing) : (width / 2 - 2 * spacing) / 2
|
||||
|
@ -196,7 +196,7 @@ ApplicationWindow {
|
|||
width: flow.width
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacing
|
||||
spacing: 6
|
||||
ProgressBar {
|
||||
width: parent.width
|
||||
indeterminate: true
|
||||
|
@ -213,7 +213,7 @@ ApplicationWindow {
|
|||
width: flow.width
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacing
|
||||
spacing: 6
|
||||
Slider {
|
||||
id: slider
|
||||
value: 0.4
|
||||
|
|
|
@ -120,18 +120,18 @@ ApplicationWindow {
|
|||
Column {
|
||||
id: feedItem
|
||||
width: parent.width
|
||||
spacing: Theme.spacing
|
||||
spacing: 6
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Theme.frameColor
|
||||
visible: index == 0
|
||||
}
|
||||
Item { width: 1; height: Theme.spacing }
|
||||
Item { width: 1; height: 6 }
|
||||
Label {
|
||||
text: model.title
|
||||
x: Theme.padding
|
||||
width: parent.width - 2 * Theme.padding
|
||||
x: 6
|
||||
width: parent.width - 12
|
||||
elide: Text.ElideRight
|
||||
color: Theme.accentColor
|
||||
font.pointSize: 20
|
||||
|
@ -140,14 +140,14 @@ ApplicationWindow {
|
|||
Label {
|
||||
text: model.description
|
||||
textFormat: Text.StyledText
|
||||
x: Theme.padding
|
||||
width: parent.width - 2 * Theme.padding
|
||||
x: 6
|
||||
width: parent.width - 12
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
RowLayout {
|
||||
x: Theme.padding
|
||||
width: parent.width - 2 * Theme.padding
|
||||
spacing: Theme.spacing
|
||||
x: 6
|
||||
width: parent.width - 12
|
||||
spacing: 6
|
||||
Label {
|
||||
id: discoverCreator
|
||||
text: model.creator
|
||||
|
@ -211,35 +211,35 @@ ApplicationWindow {
|
|||
Column {
|
||||
id: commentItem
|
||||
width: parent.width
|
||||
spacing: Theme.spacing
|
||||
spacing: 6
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Theme.frameColor
|
||||
visible: index == 0
|
||||
}
|
||||
Item { width: 1; height: Theme.spacing }
|
||||
Item { width: 1; height: 6 }
|
||||
Label {
|
||||
text: model.title
|
||||
x: Theme.padding
|
||||
width: parent.width - 2 * Theme.padding
|
||||
x: 6
|
||||
width: parent.width - 12
|
||||
elide: Text.ElideRight
|
||||
color: Theme.accentColor
|
||||
font.pointSize: 14
|
||||
lineHeight: 0.75
|
||||
}
|
||||
Item { width: 1; height: Theme.spacing }
|
||||
Item { width: 1; height: 6 }
|
||||
Label {
|
||||
text: model.description
|
||||
textFormat: Text.StyledText
|
||||
x: Theme.padding
|
||||
width: parent.width - 2 * Theme.padding
|
||||
x: 6
|
||||
width: parent.width - 12
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
RowLayout {
|
||||
x: Theme.padding
|
||||
width: parent.width - 2 * Theme.padding
|
||||
spacing: Theme.spacing
|
||||
x: 6
|
||||
width: parent.width - 12
|
||||
spacing: 6
|
||||
Label {
|
||||
id: activityCreator
|
||||
text: model.creator
|
||||
|
|
|
@ -73,7 +73,6 @@ ApplicationWindow {
|
|||
id: pageComponent
|
||||
Control {
|
||||
id: page
|
||||
Theme.roundness: roundedToggle.checked ? 3 : 0
|
||||
Theme.accentColor: Qt.hsla(colorSlider.position, 0.5, 0.5, 1.0)
|
||||
Theme.backgroundColor: darkButton.checked ? "#444" : "#fff"
|
||||
Theme.frameColor: darkButton.checked ? "#666" : "#ccc"
|
||||
|
@ -163,20 +162,6 @@ ApplicationWindow {
|
|||
color: Theme.frameColor
|
||||
}
|
||||
|
||||
ToggleButton {
|
||||
id: roundedToggle
|
||||
width: parent.width
|
||||
text: "Rounded corners"
|
||||
layoutDirection: Qt.RightToLeft
|
||||
checked: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Theme.frameColor
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Push"
|
||||
anchors.right: parent.right
|
||||
|
|
|
@ -98,8 +98,8 @@ ApplicationWindow {
|
|||
model: VisualItemModel {
|
||||
Label {
|
||||
text: "Settings"
|
||||
x: Theme.padding
|
||||
width: parent.width - Theme.padding * 2
|
||||
x: 6
|
||||
width: parent.width - 12
|
||||
lineHeight: 2.0
|
||||
color: Theme.accentColor
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
|
|
@ -59,7 +59,7 @@ AbstractCalendarView {
|
|||
opacity: model.month === control.month ? 1 : 0
|
||||
color: model.today ? control.Theme.accentColor : control.Theme.textColor
|
||||
text: model.day
|
||||
padding: control.Theme.padding
|
||||
padding: control.padding
|
||||
}
|
||||
//! [delegate]
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ AbstractDayOfWeekRow {
|
|||
implicitHeight: Math.max(background ? background.implicitHeight : 0,
|
||||
contentItem.implicitHeight + topPadding + bottomPadding)
|
||||
|
||||
topPadding: Theme.padding
|
||||
bottomPadding: Theme.padding
|
||||
topPadding: 6
|
||||
bottomPadding: 6
|
||||
|
||||
//! [delegate]
|
||||
delegate: Text {
|
||||
|
|
|
@ -46,8 +46,8 @@ AbstractWeekNumberColumn {
|
|||
implicitHeight: Math.max(background ? background.implicitHeight : 0,
|
||||
contentItem.implicitHeight + topPadding + bottomPadding)
|
||||
|
||||
leftPadding: Theme.padding
|
||||
rightPadding: Theme.padding
|
||||
leftPadding: 6
|
||||
rightPadding: 6
|
||||
|
||||
//! [delegate]
|
||||
delegate: Text {
|
||||
|
|
|
@ -45,7 +45,7 @@ AbstractBusyIndicator {
|
|||
|
||||
Accessible.role: Accessible.Indicator
|
||||
|
||||
padding: Theme.padding
|
||||
padding: 6
|
||||
|
||||
//! [indicator]
|
||||
indicator: Item {
|
||||
|
|
|
@ -49,7 +49,7 @@ AbstractButton {
|
|||
Accessible.pressed: pressed
|
||||
Accessible.role: Accessible.Button
|
||||
|
||||
padding: Theme.padding
|
||||
padding: 6
|
||||
|
||||
//! [label]
|
||||
label: Text {
|
||||
|
@ -71,7 +71,7 @@ AbstractButton {
|
|||
implicitWidth: 26
|
||||
implicitHeight: 26
|
||||
|
||||
radius: control.Theme.roundness
|
||||
radius: 3
|
||||
color: Qt.tint(!control.enabled ? control.Theme.disabledColor :
|
||||
control.activeFocus ? control.Theme.focusColor : control.Theme.accentColor,
|
||||
control.pressed ? control.Theme.pressColor : "transparent")
|
||||
|
|
|
@ -53,8 +53,8 @@ AbstractCheckBox {
|
|||
Accessible.pressed: pressed
|
||||
Accessible.role: Accessible.CheckBox
|
||||
|
||||
padding: Theme.padding
|
||||
spacing: Theme.spacing
|
||||
padding: 6
|
||||
spacing: 6
|
||||
|
||||
//! [indicator]
|
||||
indicator: Rectangle {
|
||||
|
@ -63,7 +63,7 @@ AbstractCheckBox {
|
|||
x: text ? (control.mirrored ? parent.width - width - control.rightPadding : control.leftPadding) : (parent.width - width) / 2
|
||||
y: (parent.height - height) / 2
|
||||
|
||||
radius: control.Theme.roundness
|
||||
radius: 3
|
||||
border.width: control.activeFocus ? 2 : 1
|
||||
border.color: control.activeFocus ? control.Theme.focusColor : control.Theme.frameColor
|
||||
color: control.Theme.backgroundColor
|
||||
|
|
|
@ -46,7 +46,7 @@ AbstractFrame {
|
|||
contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
|
||||
contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
|
||||
|
||||
padding: Theme.padding
|
||||
padding: 6
|
||||
|
||||
//! [contentItem]
|
||||
contentItem: Item { }
|
||||
|
@ -57,8 +57,8 @@ AbstractFrame {
|
|||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
radius: 3
|
||||
color: "transparent"
|
||||
radius: control.Theme.roundness
|
||||
border.color: control.Theme.frameColor
|
||||
}
|
||||
//! [frame]
|
||||
|
|
|
@ -46,9 +46,9 @@ AbstractGroupBox {
|
|||
contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
|
||||
contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
|
||||
|
||||
spacing: Theme.spacing
|
||||
padding: Theme.padding
|
||||
topPadding: Theme.padding + (label && title ? label.implicitHeight + spacing : 0)
|
||||
spacing: 6
|
||||
padding: 6
|
||||
topPadding: 6 + (label && title ? label.implicitHeight + spacing : 0)
|
||||
|
||||
//! [contentItem]
|
||||
contentItem: Item { }
|
||||
|
@ -69,12 +69,12 @@ AbstractGroupBox {
|
|||
|
||||
//! [frame]
|
||||
frame: Rectangle {
|
||||
y: control.topPadding - control.Theme.padding
|
||||
y: control.topPadding - control.padding
|
||||
width: parent.width
|
||||
height: parent.height - control.topPadding + control.Theme.padding
|
||||
height: parent.height - control.topPadding + control.padding
|
||||
|
||||
radius: 3
|
||||
color: "transparent"
|
||||
radius: control.Theme.roundness
|
||||
border.color: control.Theme.frameColor
|
||||
}
|
||||
//! [frame]
|
||||
|
|
|
@ -47,8 +47,8 @@ AbstractPageIndicator {
|
|||
implicitHeight: Math.max(background ? background.implicitHeight : 0,
|
||||
contentItem.implicitHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: Theme.padding
|
||||
spacing: Theme.spacing
|
||||
padding: 6
|
||||
spacing: 6
|
||||
|
||||
//! [delegate]
|
||||
delegate: Rectangle {
|
||||
|
|
|
@ -47,7 +47,7 @@ AbstractProgressBar {
|
|||
|
||||
Accessible.role: Accessible.ProgressBar
|
||||
|
||||
padding: Theme.padding
|
||||
padding: 6
|
||||
|
||||
//! [indicator]
|
||||
indicator: Item {
|
||||
|
@ -69,8 +69,8 @@ AbstractProgressBar {
|
|||
width: offset * (parent.width - x) - 2
|
||||
height: 2
|
||||
|
||||
radius: 3
|
||||
color: control.enabled ? control.Theme.accentColor : control.Theme.disabledColor
|
||||
radius: control.Theme.roundness
|
||||
|
||||
SequentialAnimation on offset {
|
||||
loops: Animation.Infinite
|
||||
|
@ -98,7 +98,7 @@ AbstractProgressBar {
|
|||
width: control.availableWidth
|
||||
height: 6
|
||||
|
||||
radius: control.Theme.roundness
|
||||
radius: 3
|
||||
border.color: control.Theme.frameColor
|
||||
color: "transparent"
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ AbstractRadioButton {
|
|||
Accessible.pressed: pressed
|
||||
Accessible.role: Accessible.RadioButton
|
||||
|
||||
padding: Theme.padding
|
||||
spacing: Theme.spacing
|
||||
padding: 6
|
||||
spacing: 6
|
||||
|
||||
//! [indicator]
|
||||
indicator: Rectangle {
|
||||
|
|
|
@ -50,7 +50,7 @@ AbstractSlider {
|
|||
Accessible.pressed: pressed
|
||||
Accessible.role: Accessible.Slider
|
||||
|
||||
padding: Theme.padding
|
||||
padding: 6
|
||||
|
||||
//! [handle]
|
||||
handle: Rectangle {
|
||||
|
@ -89,7 +89,7 @@ AbstractSlider {
|
|||
width: horizontal ? control.availableWidth : implicitWidth
|
||||
height: horizontal ? implicitHeight : control.availableHeight
|
||||
|
||||
radius: control.Theme.roundness
|
||||
radius: 3
|
||||
border.color: control.Theme.frameColor
|
||||
color: control.Theme.backgroundColor
|
||||
scale: horizontal && control.mirrored ? -1 : 1
|
||||
|
@ -100,8 +100,8 @@ AbstractSlider {
|
|||
width: parent.horizontal ? control.position * parent.width - 4 : 2
|
||||
height: parent.horizontal ? 2 : control.position * parent.height - 4
|
||||
|
||||
radius: 3
|
||||
color: control.enabled ? control.Theme.accentColor : control.Theme.disabledColor
|
||||
radius: control.Theme.roundness
|
||||
}
|
||||
}
|
||||
//! [track]
|
||||
|
|
|
@ -54,8 +54,8 @@ AbstractSwitch {
|
|||
Accessible.pressed: pressed
|
||||
Accessible.role: Accessible.Button // TODO: Switch?
|
||||
|
||||
padding: Theme.padding
|
||||
spacing: Theme.spacing
|
||||
padding: 6
|
||||
spacing: 6
|
||||
|
||||
//! [indicator]
|
||||
indicator: Rectangle {
|
||||
|
|
|
@ -50,7 +50,7 @@ AbstractTabButton {
|
|||
Accessible.selected: checked
|
||||
Accessible.role: Accessible.PageTab
|
||||
|
||||
padding: Theme.padding
|
||||
padding: 6
|
||||
|
||||
//! [label]
|
||||
label: Text {
|
||||
|
|
|
@ -46,7 +46,7 @@ AbstractTextField {
|
|||
Accessible.description: placeholder ? placeholder.text : ""
|
||||
Accessible.passwordEdit: echoMode === TextInput.Password || echoMode === TextInput.PasswordEchoOnEdit
|
||||
|
||||
padding: Theme.padding
|
||||
padding: 6
|
||||
|
||||
color: enabled ? Theme.textColor : Theme.disabledColor
|
||||
selectionColor: Theme.selectionColor
|
||||
|
@ -68,9 +68,9 @@ AbstractTextField {
|
|||
//! [background]
|
||||
background: Rectangle {
|
||||
implicitWidth: 120 // TODO
|
||||
radius: control.Theme.roundness
|
||||
border.width: control.activeFocus ? 2 : 1
|
||||
border.color: control.activeFocus ? control.Theme.focusColor : control.Theme.frameColor
|
||||
radius: 3
|
||||
}
|
||||
//! [background]
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ AbstractToggleButton {
|
|||
Accessible.pressed: pressed
|
||||
Accessible.role: Accessible.Button
|
||||
|
||||
padding: Theme.padding
|
||||
spacing: Theme.spacing
|
||||
padding: 6
|
||||
spacing: 6
|
||||
|
||||
//! [indicator]
|
||||
indicator: Rectangle {
|
||||
|
@ -64,7 +64,7 @@ AbstractToggleButton {
|
|||
x: text ? (control.mirrored ? parent.width - width - control.rightPadding : control.leftPadding) : (parent.width - width) / 2
|
||||
y: (parent.height - height) / 2
|
||||
|
||||
radius: control.Theme.roundness
|
||||
radius: 3
|
||||
border.width: control.activeFocus ? 2 : 1
|
||||
border.color: control.activeFocus ? control.Theme.focusColor : control.Theme.frameColor
|
||||
color: control.Theme.backgroundColor
|
||||
|
|
|
@ -49,7 +49,7 @@ AbstractToolButton {
|
|||
Accessible.pressed: pressed
|
||||
Accessible.role: Accessible.Button
|
||||
|
||||
padding: Theme.padding
|
||||
padding: 6
|
||||
|
||||
//! [label]
|
||||
label: Text {
|
||||
|
|
|
@ -98,18 +98,6 @@ QT_BEGIN_NAMESPACE
|
|||
\qmlattachedproperty color QtQuickControls2::Theme::textColor
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlattachedproperty real QtQuickControls2::Theme::padding
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlattachedproperty real QtQuickControls2::Theme::roundness
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlattachedproperty real QtQuickControls2::Theme::spacing
|
||||
*/
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QQuickThemeData, globalThemeData, (QString::fromLatin1(":/qtquickcontrols/theme.json")))
|
||||
|
||||
static QQuickThemeAttached *themeInstance(QQmlEngine *engine)
|
||||
|
@ -221,10 +209,7 @@ public:
|
|||
explicitSelectedTextColor(false),
|
||||
explicitSelectionColor(false),
|
||||
explicitShadowColor(false),
|
||||
explicitTextColor(false),
|
||||
explicitPadding(false),
|
||||
explicitSpacing(false),
|
||||
explicitRoundness(false) { }
|
||||
explicitTextColor(false) { }
|
||||
|
||||
enum Method { Implicit, Explicit, Inherit };
|
||||
|
||||
|
@ -239,9 +224,6 @@ public:
|
|||
void setSelectionColor(const QColor &color, Method method);
|
||||
void setShadowColor(const QColor &color, Method method);
|
||||
void setTextColor(const QColor &color, Method method);
|
||||
void setPadding(qreal padding, Method method);
|
||||
void setRoundness(qreal roundness, Method method);
|
||||
void setSpacing(qreal spacing, Method method);
|
||||
|
||||
void inherit(QQuickThemeAttached *theme);
|
||||
|
||||
|
@ -265,9 +247,6 @@ public:
|
|||
bool explicitSelectionColor;
|
||||
bool explicitShadowColor;
|
||||
bool explicitTextColor;
|
||||
bool explicitPadding;
|
||||
bool explicitSpacing;
|
||||
bool explicitRoundness;
|
||||
};
|
||||
|
||||
void QQuickThemeAttachedPrivate::setAccentColor(const QColor &color, Method method)
|
||||
|
@ -435,51 +414,6 @@ void QQuickThemeAttachedPrivate::setTextColor(const QColor &color, Method method
|
|||
}
|
||||
}
|
||||
|
||||
void QQuickThemeAttachedPrivate::setPadding(qreal padding, Method method)
|
||||
{
|
||||
Q_Q(QQuickThemeAttached);
|
||||
if (!explicitPadding || method != Inherit) {
|
||||
explicitPadding = method == Explicit;
|
||||
if (data.padding() != padding) {
|
||||
data.setPadding(padding);
|
||||
emit q->paddingChanged();
|
||||
|
||||
foreach (QQuickThemeAttached *child, childThemes)
|
||||
child->d_func()->setPadding(padding, Inherit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickThemeAttachedPrivate::setRoundness(qreal roundness, Method method)
|
||||
{
|
||||
Q_Q(QQuickThemeAttached);
|
||||
if (!explicitRoundness || method != Inherit) {
|
||||
explicitRoundness = method == Explicit;
|
||||
if (data.roundness() != roundness) {
|
||||
data.setRoundness(roundness);
|
||||
emit q->roundnessChanged();
|
||||
|
||||
foreach (QQuickThemeAttached *child, childThemes)
|
||||
child->d_func()->setRoundness(roundness, Inherit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickThemeAttachedPrivate::setSpacing(qreal spacing, Method method)
|
||||
{
|
||||
Q_Q(QQuickThemeAttached);
|
||||
if (!explicitSpacing || method != Inherit) {
|
||||
explicitSpacing = method == Explicit;
|
||||
if (data.spacing() != spacing) {
|
||||
data.setSpacing(spacing);
|
||||
emit q->spacingChanged();
|
||||
|
||||
foreach (QQuickThemeAttached *child, childThemes)
|
||||
child->d_func()->setSpacing(spacing, Inherit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickThemeAttachedPrivate::inherit(QQuickThemeAttached *theme)
|
||||
{
|
||||
setAccentColor(theme->accentColor(), Inherit);
|
||||
|
@ -493,9 +427,6 @@ void QQuickThemeAttachedPrivate::inherit(QQuickThemeAttached *theme)
|
|||
setSelectionColor(theme->selectionColor(), Inherit);
|
||||
setShadowColor(theme->shadowColor(), Inherit);
|
||||
setTextColor(theme->textColor(), Inherit);
|
||||
setPadding(theme->padding(), Inherit);
|
||||
setRoundness(theme->roundness(), Inherit);
|
||||
setSpacing(theme->spacing(), Inherit);
|
||||
}
|
||||
|
||||
const QQuickThemeData &QQuickThemeAttachedPrivate::resolve() const
|
||||
|
@ -769,58 +700,4 @@ void QQuickThemeAttached::resetTextColor()
|
|||
d->setTextColor(d->resolve().textColor(), QQuickThemeAttachedPrivate::Implicit);
|
||||
}
|
||||
|
||||
qreal QQuickThemeAttached::padding() const
|
||||
{
|
||||
Q_D(const QQuickThemeAttached);
|
||||
return d->data.padding();
|
||||
}
|
||||
|
||||
void QQuickThemeAttached::setPadding(qreal padding)
|
||||
{
|
||||
Q_D(QQuickThemeAttached);
|
||||
d->setPadding(padding, QQuickThemeAttachedPrivate::Explicit);
|
||||
}
|
||||
|
||||
void QQuickThemeAttached::resetPadding()
|
||||
{
|
||||
Q_D(QQuickThemeAttached);
|
||||
d->setPadding(d->resolve().padding(), QQuickThemeAttachedPrivate::Implicit);
|
||||
}
|
||||
|
||||
qreal QQuickThemeAttached::roundness() const
|
||||
{
|
||||
Q_D(const QQuickThemeAttached);
|
||||
return d->data.roundness();
|
||||
}
|
||||
|
||||
void QQuickThemeAttached::setRoundness(qreal roundness)
|
||||
{
|
||||
Q_D(QQuickThemeAttached);
|
||||
d->setRoundness(roundness, QQuickThemeAttachedPrivate::Explicit);
|
||||
}
|
||||
|
||||
void QQuickThemeAttached::resetRoundness()
|
||||
{
|
||||
Q_D(QQuickThemeAttached);
|
||||
d->setRoundness(d->resolve().roundness(), QQuickThemeAttachedPrivate::Implicit);
|
||||
}
|
||||
|
||||
qreal QQuickThemeAttached::spacing() const
|
||||
{
|
||||
Q_D(const QQuickThemeAttached);
|
||||
return d->data.spacing();
|
||||
}
|
||||
|
||||
void QQuickThemeAttached::setSpacing(qreal spacing)
|
||||
{
|
||||
Q_D(QQuickThemeAttached);
|
||||
d->setSpacing(spacing, QQuickThemeAttachedPrivate::Explicit);
|
||||
}
|
||||
|
||||
void QQuickThemeAttached::resetSpacing()
|
||||
{
|
||||
Q_D(QQuickThemeAttached);
|
||||
d->setSpacing(d->resolve().spacing(), QQuickThemeAttachedPrivate::Implicit);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -71,9 +71,6 @@ class QQuickThemeAttached : public QObject
|
|||
Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor RESET resetSelectionColor NOTIFY selectionColorChanged FINAL)
|
||||
Q_PROPERTY(QColor shadowColor READ shadowColor WRITE setShadowColor RESET resetShadowColor NOTIFY shadowColorChanged FINAL)
|
||||
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor RESET resetTextColor NOTIFY textColorChanged FINAL)
|
||||
Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
|
||||
Q_PROPERTY(qreal roundness READ roundness WRITE setRoundness RESET resetRoundness NOTIFY roundnessChanged FINAL)
|
||||
Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit QQuickThemeAttached(const QQuickThemeData &data, QObject *parent = Q_NULLPTR);
|
||||
|
@ -128,18 +125,6 @@ public:
|
|||
void setTextColor(const QColor &color);
|
||||
void resetTextColor();
|
||||
|
||||
qreal padding() const;
|
||||
void setPadding(qreal padding);
|
||||
void resetPadding();
|
||||
|
||||
qreal roundness() const;
|
||||
void setRoundness(qreal roundness);
|
||||
void resetRoundness();
|
||||
|
||||
qreal spacing() const;
|
||||
void setSpacing(qreal spacing);
|
||||
void resetSpacing();
|
||||
|
||||
Q_SIGNALS:
|
||||
void accentColorChanged();
|
||||
void backgroundColorChanged();
|
||||
|
@ -152,9 +137,6 @@ Q_SIGNALS:
|
|||
void selectionColorChanged();
|
||||
void shadowColorChanged();
|
||||
void textColorChanged();
|
||||
void paddingChanged();
|
||||
void roundnessChanged();
|
||||
void spacingChanged();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QQuickThemeAttached)
|
||||
|
|
|
@ -57,11 +57,6 @@ static QColor readColorValue(const QJsonValue &value, const QColor &defaultValue
|
|||
return QColor::fromRgba(value.toInt(defaultValue.rgba()));
|
||||
}
|
||||
|
||||
static double readNumberValue(const QJsonValue &value, double defaultValue)
|
||||
{
|
||||
return value.toDouble(defaultValue);
|
||||
}
|
||||
|
||||
bool QQuickThemeData::load(const QString &filePath)
|
||||
{
|
||||
QJsonDocument doc;
|
||||
|
@ -92,9 +87,6 @@ bool QQuickThemeData::load(const QString &filePath)
|
|||
d->selectionColor = readColorValue(theme.value(QStringLiteral("selectionColor")), QColor("#45a7d7"));
|
||||
d->shadowColor = readColorValue(theme.value(QStringLiteral("shadowColor")), QColor("#28282a"));
|
||||
d->textColor = readColorValue(theme.value(QStringLiteral("textColor")), QColor("#26282a"));
|
||||
d->padding = readNumberValue(theme.value(QStringLiteral("padding")), 6);
|
||||
d->roundness = readNumberValue(theme.value(QStringLiteral("roundness")), 3);
|
||||
d->spacing = readNumberValue(theme.value(QStringLiteral("spacing")), 6);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,15 +94,6 @@ public:
|
|||
QColor textColor() const { return d->textColor; }
|
||||
void setTextColor(const QColor &color) { d->textColor = color; }
|
||||
|
||||
qreal padding() const { return d->padding; }
|
||||
void setPadding(qreal padding) { d->padding = padding; }
|
||||
|
||||
qreal roundness() const { return d->roundness; }
|
||||
void setRoundness(qreal roundness) { d->roundness = roundness; }
|
||||
|
||||
qreal spacing() const { return d->spacing; }
|
||||
void setSpacing(qreal spacing) { d->spacing = spacing; }
|
||||
|
||||
private:
|
||||
struct Data : public QSharedData {
|
||||
QColor accentColor;
|
||||
|
@ -116,9 +107,6 @@ private:
|
|||
QColor selectionColor;
|
||||
QColor shadowColor;
|
||||
QColor textColor;
|
||||
qreal padding;
|
||||
qreal spacing;
|
||||
qreal roundness;
|
||||
};
|
||||
QSharedDataPointer<Data> d;
|
||||
};
|
||||
|
|
|
@ -9,8 +9,5 @@
|
|||
"selectedTextColor": "#ffffff",
|
||||
"selectionColor": "#45a7d7",
|
||||
"shadowColor": "#28282a",
|
||||
"textColor": "#26282a",
|
||||
"padding": 6,
|
||||
"roundness": 3,
|
||||
"spacing": 6
|
||||
"textColor": "#26282a"
|
||||
}
|
||||
|
|
|
@ -69,9 +69,6 @@ TestCase {
|
|||
Theme.selectedTextColor: "#777777"
|
||||
Theme.selectionColor: "#888888"
|
||||
Theme.textColor: "#999999"
|
||||
Theme.padding: 111
|
||||
Theme.roundness: 222
|
||||
Theme.spacing: 333
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,9 +90,6 @@ TestCase {
|
|||
Theme.selectedTextColor: "#777777"
|
||||
Theme.selectionColor: "#888888"
|
||||
Theme.textColor: "#999999"
|
||||
Theme.padding: 111
|
||||
Theme.roundness: 222
|
||||
Theme.spacing: 333
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,9 +115,6 @@ TestCase {
|
|||
verify(control.Theme.selectedTextColor !== undefined)
|
||||
verify(control.Theme.selectionColor !== undefined)
|
||||
verify(control.Theme.textColor !== undefined)
|
||||
verify(control.Theme.padding !== undefined)
|
||||
verify(control.Theme.roundness !== undefined)
|
||||
verify(control.Theme.spacing !== undefined)
|
||||
control.destroy()
|
||||
}
|
||||
|
||||
|
@ -140,9 +131,6 @@ TestCase {
|
|||
control.Theme.selectedTextColor = "#777777"
|
||||
control.Theme.selectionColor = "#888888"
|
||||
control.Theme.textColor = "#999999"
|
||||
control.Theme.padding = 111
|
||||
control.Theme.roundness = 222
|
||||
control.Theme.spacing = 333
|
||||
compare(control.Theme.accentColor, "#111111")
|
||||
compare(control.Theme.backgroundColor, "#222222")
|
||||
compare(control.Theme.baseColor, "#333333")
|
||||
|
@ -153,9 +141,6 @@ TestCase {
|
|||
compare(control.Theme.selectedTextColor, "#777777")
|
||||
compare(control.Theme.selectionColor, "#888888")
|
||||
compare(control.Theme.textColor, "#999999")
|
||||
compare(control.Theme.padding, 111)
|
||||
compare(control.Theme.roundness, 222)
|
||||
compare(control.Theme.spacing, 333)
|
||||
control.destroy()
|
||||
}
|
||||
|
||||
|
@ -172,9 +157,6 @@ TestCase {
|
|||
compare(control.Theme.selectedTextColor, "#777777")
|
||||
compare(control.Theme.selectionColor, "#888888")
|
||||
compare(control.Theme.textColor, "#999999")
|
||||
compare(control.Theme.padding, 111)
|
||||
compare(control.Theme.roundness, 222)
|
||||
compare(control.Theme.spacing, 333)
|
||||
control.Theme.accentColor = undefined
|
||||
control.Theme.backgroundColor = undefined
|
||||
control.Theme.baseColor = undefined
|
||||
|
@ -185,9 +167,6 @@ TestCase {
|
|||
control.Theme.selectedTextColor = undefined
|
||||
control.Theme.selectionColor = undefined
|
||||
control.Theme.textColor = undefined
|
||||
control.Theme.padding = undefined
|
||||
control.Theme.roundness = undefined
|
||||
control.Theme.spacing = undefined
|
||||
compare(control.Theme.accentColor, testCase.Theme.accentColor)
|
||||
compare(control.Theme.backgroundColor, testCase.Theme.backgroundColor)
|
||||
compare(control.Theme.baseColor, testCase.Theme.baseColor)
|
||||
|
@ -198,9 +177,6 @@ TestCase {
|
|||
compare(control.Theme.selectedTextColor, testCase.Theme.selectedTextColor)
|
||||
compare(control.Theme.selectionColor, testCase.Theme.selectionColor)
|
||||
compare(control.Theme.textColor, testCase.Theme.textColor)
|
||||
compare(control.Theme.padding, testCase.Theme.padding)
|
||||
compare(control.Theme.roundness, testCase.Theme.roundness)
|
||||
compare(control.Theme.spacing, testCase.Theme.spacing)
|
||||
control.destroy()
|
||||
}
|
||||
|
||||
|
@ -215,10 +191,7 @@ TestCase {
|
|||
{ tag: "pressColor", value1: "#666666", value2: "#606060" },
|
||||
{ tag: "selectedTextColor", value1: "#777777", value2: "#707070" },
|
||||
{ tag: "selectionColor", value1: "#888888", value2: "#808080" },
|
||||
{ tag: "textColor", value1: "#999999", value2: "#909090" },
|
||||
{ tag: "padding", value1: 11, value2: 10 },
|
||||
{ tag: "roundness", value1: 22, value2: 20 },
|
||||
{ tag: "spacing", value1: 33, value2: 30 }
|
||||
{ tag: "textColor", value1: "#999999", value2: "#909090" }
|
||||
]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue