feat(StatusQ.Controls): introduce StatusSwitchTabBar and StatusSwitchTab
This commit adds two new components to the StatusQ.Controls module: - StatusSwitchTabBar - StatusSwitchTab Usage: ```qml StatusSwitchTabBar { StatusSwitchTab { text: "Tab 1" } StatusSwitchTab { text: "Tab 2" } StatusSwitchTab { text: "Tab 3" } } ``` Closes #365
This commit is contained in:
parent
b45aba4be8
commit
50c9a4ca87
24
sandbox/StatusTabSwitchPage.qml
Normal file
24
sandbox/StatusTabSwitchPage.qml
Normal file
@ -0,0 +1,24 @@
|
||||
import QtQuick 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
import QtQuick.Controls 2.13
|
||||
|
||||
import StatusQ.Controls 0.1
|
||||
|
||||
GridLayout {
|
||||
columns: 1
|
||||
columnSpacing: 5
|
||||
rowSpacing: 5
|
||||
|
||||
StatusSwitchTabBar {
|
||||
StatusSwitchTab {
|
||||
text: "Swap"
|
||||
}
|
||||
StatusSwitchTab {
|
||||
text: "Swap & Send"
|
||||
}
|
||||
StatusSwitchTab {
|
||||
text: "Send"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +138,11 @@ StatusWindow {
|
||||
selected: page.sourceComponent == buttonsComponent
|
||||
onClicked: page.sourceComponent = buttonsComponent
|
||||
}
|
||||
StatusNavigationListItem {
|
||||
title: "StatusSwitchTab"
|
||||
selected: page.sourceComponent == statusTabSwitchesComponent
|
||||
onClicked: page.sourceComponent = statusTabSwitchesComponent
|
||||
}
|
||||
StatusNavigationListItem {
|
||||
title: "Controls"
|
||||
selected: page.sourceComponent == controlsComponent
|
||||
@ -281,6 +286,11 @@ StatusWindow {
|
||||
Popups {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: statusTabSwitchesComponent
|
||||
StatusTabSwitchPage {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: demoAppCmp
|
||||
|
||||
|
53
src/StatusQ/Controls/StatusSwitchTab.qml
Normal file
53
src/StatusQ/Controls/StatusSwitchTab.qml
Normal file
@ -0,0 +1,53 @@
|
||||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtGraphicalEffects 1.13
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
TabButton {
|
||||
id: control
|
||||
contentItem: Item {
|
||||
height: 36
|
||||
MouseArea {
|
||||
id: sensor
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: control.hovered ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: control.checked = true
|
||||
|
||||
StatusBaseText {
|
||||
id: label
|
||||
text: control.text
|
||||
color: Theme.palette.primaryColor1
|
||||
font.weight: Font.Medium
|
||||
font.pixelSize: 15
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
id: controlBackground
|
||||
implicitHeight: 36
|
||||
implicitWidth: 148
|
||||
color: control.checked ?
|
||||
Theme.palette.statusSwitchTab.backgroundColor :
|
||||
"transparent"
|
||||
radius: 8
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
width: controlBackground.width
|
||||
height: controlBackground.height
|
||||
x: controlBackground.x
|
||||
source: controlBackground
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
radius: 10
|
||||
samples: 25
|
||||
spread: 0
|
||||
color: Theme.palette.dropShadow
|
||||
}
|
||||
}
|
||||
}
|
16
src/StatusQ/Controls/StatusSwitchTabBar.qml
Normal file
16
src/StatusQ/Controls/StatusSwitchTabBar.qml
Normal file
@ -0,0 +1,16 @@
|
||||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
TabBar {
|
||||
id: control
|
||||
padding: 1
|
||||
|
||||
background: Rectangle {
|
||||
implicitHeight: 36
|
||||
color: Theme.palette.directColor7
|
||||
radius: 8
|
||||
border.width: 1
|
||||
border.color: color
|
||||
}
|
||||
}
|
@ -17,3 +17,5 @@ StatusSlider 0.1 StatusSlider.qml
|
||||
StatusBaseInput 0.1 StatusBaseInput.qml
|
||||
StatusInput 0.1 StatusInput.qml
|
||||
StatusPickerButton 0.1 StatusPickerButton.qml
|
||||
StatusSwitchTab 0.1 StatusSwitchTab.qml
|
||||
StatusSwitchTabBar 0.1 StatusSwitchTabBar.qml
|
||||
|
@ -177,5 +177,9 @@ ThemePalette {
|
||||
property QtObject statusChatInput: QtObject {
|
||||
property color secondaryBackgroundColor: "#414141"
|
||||
}
|
||||
|
||||
property QtObject statusSwitchTab: QtObject {
|
||||
property color backgroundColor: baseColor3
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,5 +175,9 @@ ThemePalette {
|
||||
property QtObject statusChatInput: QtObject {
|
||||
property color secondaryBackgroundColor: "#E2E6E8"
|
||||
}
|
||||
|
||||
property QtObject statusSwitchTab: QtObject {
|
||||
property color backgroundColor: white
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,6 +139,10 @@ QtObject {
|
||||
property color secondaryBackgroundColor
|
||||
}
|
||||
|
||||
property QtObject statusSwitchTab: QtObject {
|
||||
property color backgroundColor
|
||||
}
|
||||
|
||||
function alphaColor(color, alpha) {
|
||||
let actualColor = Qt.darker(color, 1)
|
||||
actualColor.a = alpha
|
||||
|
Loading…
x
Reference in New Issue
Block a user