Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit 4cc0d2b

Browse files
committed
feat(StatusQ.Controls): introduce StatusChatCommandButton
Usage: ```qml StatusChatCommandButton { icon.name: "send" icon.color: Theme.palette.miscColor2 text: "Send transaction" } ``` Closes #429
1 parent 4bcd89b commit 4cc0d2b

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import QtQuick 2.14
2+
import QtQuick.Controls 2.14
3+
import QtQuick.Layouts 1.14
4+
5+
import StatusQ.Core 0.1
6+
import StatusQ.Core.Theme 0.1
7+
import StatusQ.Controls 0.1
8+
9+
import Sandbox 0.1
10+
11+
Column {
12+
spacing: 8
13+
14+
StatusChatCommandButton {
15+
icon.name: "send"
16+
icon.color: Theme.palette.miscColor2
17+
text: "Send transaction"
18+
}
19+
20+
StatusChatCommandButton {
21+
icon.name: "send"
22+
icon.rotation: 180
23+
icon.color: Theme.palette.miscColor8
24+
text: "Receive transaction"
25+
}
26+
}

sandbox/main.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ StatusWindow {
143143
selected: page.sourceComponent == statusTabSwitchesComponent
144144
onClicked: page.sourceComponent = statusTabSwitchesComponent
145145
}
146+
StatusNavigationListItem {
147+
title: "StatusChatCommandButton"
148+
selected: page.sourceComponent == statusChatCommandButtonPageComponent
149+
onClicked: page.sourceComponent = statusChatCommandButtonPageComponent
150+
}
146151
StatusNavigationListItem {
147152
title: "Controls"
148153
selected: page.sourceComponent == controlsComponent
@@ -336,6 +341,11 @@ StatusWindow {
336341
Buttons {}
337342
}
338343

344+
Component {
345+
id: statusChatCommandButtonPageComponent
346+
StatusChatCommandButtonPage {}
347+
}
348+
339349
Component {
340350
id: popupMenuComponent
341351
StatusPopupMenuPage {}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import QtQuick 2.13
2+
import QtQuick.Controls 2.13
3+
4+
import StatusQ.Core 0.1
5+
import StatusQ.Core.Theme 0.1
6+
import StatusQ.Components 0.1
7+
8+
Rectangle {
9+
id: root
10+
implicitWidth: 168
11+
implicitHeight: 95
12+
13+
property string text: ""
14+
property bool highlighted: false
15+
property bool enabled: true
16+
17+
signal clicked(var mouse)
18+
19+
property StatusIconSettings icon: StatusIconSettings {
20+
width: 24
21+
height: 24
22+
background: StatusIconBackgroundSettings {}
23+
}
24+
25+
color: {
26+
let actualColor = Qt.darker(root.icon.color, 1)
27+
actualColor.a = sensor.containsMouse && enabled ? 0.3 : 0.2
28+
return actualColor
29+
}
30+
31+
radius: 16
32+
33+
MouseArea {
34+
id: sensor
35+
cursorShape: root.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
36+
anchors.fill: parent
37+
hoverEnabled: true
38+
39+
onClicked: function (mouse) {
40+
root.clicked(mouse)
41+
}
42+
43+
StatusRoundIcon {
44+
icon.name: root.icon.name
45+
icon.width: root.icon.width
46+
icon.height: root.icon.height
47+
icon.rotation: root.icon.rotation
48+
icon.color: Theme.palette.white
49+
icon.background.width: 40
50+
icon.background.height: 40
51+
icon.background.color: root.icon.color
52+
anchors.top: parent.top
53+
anchors.topMargin: 8
54+
anchors.left: parent.left
55+
anchors.leftMargin: 8
56+
}
57+
58+
StatusBaseText {
59+
text: root.text
60+
anchors.left: parent.left
61+
anchors.leftMargin: 8
62+
anchors.bottom: parent.bottom
63+
anchors.bottomMargin: 8
64+
font.pixelSize: 13
65+
font.weight: Font.Medium
66+
color: Theme.palette.white
67+
}
68+
}
69+
}
70+
71+

src/StatusQ/Controls/qmldir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module StatusQ.Controls
22

33
StatusAccountSelector 0.1 StatusAccountSelector.qml
44
StatusAssetSelector 0.1 StatusAssetSelector.qml
5+
StatusChatCommandButton 0.1 StatusChatCommandButton.qml
56
StatusChatInfoButton 0.1 StatusChatInfoButton.qml
67
StatusChatListCategoryItemButton 0.1 StatusChatListCategoryItemButton.qml
78
StatusColorSelector 0.1 StatusColorSelector.qml

0 commit comments

Comments
 (0)