Add checked icon to the accent color item

pull/11/head
cutefishd 5 years ago
parent 72b81f6511
commit 8e333720a6

@ -24,18 +24,18 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="22.4" inkscape:zoom="22.4"
inkscape:cx="14.682205" inkscape:cx="3.5661336"
inkscape:cy="9.2685141" inkscape:cy="9.2685141"
inkscape:document-units="mm" inkscape:document-units="mm"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
inkscape:document-rotation="0" inkscape:document-rotation="0"
showgrid="false" showgrid="false"
units="px" units="px"
inkscape:window-width="1629" inkscape:window-width="2160"
inkscape:window-height="997" inkscape:window-height="1304"
inkscape:window-x="262" inkscape:window-x="0"
inkscape:window-y="168" inkscape:window-y="0"
inkscape:window-maximized="0" /> inkscape:window-maximized="1" />
<metadata <metadata
id="metadata5"> id="metadata5">
<rdf:RDF> <rdf:RDF>
@ -44,7 +44,7 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title> <dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
@ -53,15 +53,14 @@
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer1"> id="layer1">
<g <g
transform="matrix(0.97013889,0,0,1.164148,-413.7488,-626.64923)" id="g6"
id="g7" transform="matrix(0.01136932,0,0,0.01548149,-1.2712161e-4,-1.0528341)">
style="fill:#000000;fill-opacity:1"> <g
id="g4">
<path <path
class="ColorScheme-Text" d="m 504.502,75.496 c -9.997,-9.998 -26.205,-9.998 -36.204,0 L 161.594,382.203 43.702,264.311 c -9.997,-9.998 -26.205,-9.997 -36.204,0 -9.998,9.997 -9.998,26.205 0,36.203 l 135.994,135.992 c 9.994,9.997 26.214,9.99 36.204,0 L 504.502,111.7 c 9.998,-9.997 9.997,-26.206 0,-36.204 z"
d="m 431.82,538.29 -3.1484,3.6094 -1.5254,-1.5527 -0.66211,0.67578 2.2266,2.2676 3.7734,-4.3223 z" id="path2" />
fill="currentColor" </g>
id="path5-3"
style="fill:#000000;fill-opacity:1" />
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -1,6 +1,8 @@
import QtQuick 2.4 import QtQuick 2.4
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import Cutefish.Settings 1.0 import Cutefish.Settings 1.0
import MeuiKit 1.0 as Meui import MeuiKit 1.0 as Meui
@ -105,13 +107,16 @@ ItemPage {
} }
GridView { GridView {
height: 32 + Meui.Units.largeSpacing * 2 id: accentColorView
height: itemSize + Meui.Units.largeSpacing * 2
Layout.fillWidth: true Layout.fillWidth: true
cellWidth: height cellWidth: height
cellHeight: height cellHeight: height
interactive: false interactive: false
model: ListModel {} model: ListModel {}
property var itemSize: 32
Component.onCompleted: { Component.onCompleted: {
model.append({"accentColor": String(Meui.Theme.blueColor)}) model.append({"accentColor": String(Meui.Theme.blueColor)})
model.append({"accentColor": String(Meui.Theme.redColor)}) model.append({"accentColor": String(Meui.Theme.redColor)})
@ -122,13 +127,16 @@ ItemPage {
} }
delegate: Rectangle { delegate: Rectangle {
property bool isSelected: Qt.colorEqual(Meui.Theme.highlightColor, accentColor) property bool checked: Qt.colorEqual(Meui.Theme.highlightColor, accentColor)
width: 32 + Meui.Units.largeSpacing
width: accentColorView.itemSize + Meui.Units.largeSpacing
height: width height: width
color: "transparent" color: "transparent"
radius: width / 2 radius: width / 2
border.color: Meui.Theme.highlightColor border.color: Qt.rgba(Meui.Theme.highlightColor.r,
border.width: isSelected ? 2 : 0 Meui.Theme.highlightColor.g,
Meui.Theme.highlightColor.b, 0.5)
border.width: checked ? 2 : 0
MouseArea { MouseArea {
id: _mouseArea id: _mouseArea
@ -142,6 +150,23 @@ ItemPage {
anchors.centerIn: parent anchors.centerIn: parent
radius: width / 2 radius: width / 2
Image {
anchors.centerIn: parent
width: parent.height * 0.5
height: width
sourceSize: Qt.size(width, height)
source: "qrc:/images/checked.svg"
visible: checked
ColorOverlay {
anchors.fill: parent
source: parent
color: Meui.Theme.highlightedTextColor
opacity: 1
visible: true
}
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: function() { onClicked: function() {

@ -9,6 +9,6 @@ Page {
property string headerTitle property string headerTitle
background: Rectangle { background: Rectangle {
color: Meui.Theme.backgroundColor color: "transparent"
} }
} }

@ -19,8 +19,8 @@ Item {
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: 0 duration: 250
easing.type: Easing.InOutCubic easing.type: Easing.Linear
} }
} }
} }

@ -24,6 +24,13 @@ Meui.Window {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
implicitWidth: sideBar.width implicitWidth: sideBar.width
color: Meui.Theme.secondBackgroundColor color: Meui.Theme.secondBackgroundColor
Behavior on color {
ColorAnimation {
duration: 250
easing.type: Easing.Linear
}
}
} }
RowLayout { RowLayout {

Loading…
Cancel
Save