2
0
mirror of synced 2025-02-16 16:47:07 +00:00

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:
Pascal Precht 2021-08-31 17:12:28 +02:00
parent b45aba4be8
commit 50c9a4ca87
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
8 changed files with 117 additions and 0 deletions

View 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"
}
}
}

View File

@ -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

View 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
}
}
}

View 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
}
}

View File

@ -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

View File

@ -177,5 +177,9 @@ ThemePalette {
property QtObject statusChatInput: QtObject {
property color secondaryBackgroundColor: "#414141"
}
property QtObject statusSwitchTab: QtObject {
property color backgroundColor: baseColor3
}
}

View File

@ -175,5 +175,9 @@ ThemePalette {
property QtObject statusChatInput: QtObject {
property color secondaryBackgroundColor: "#E2E6E8"
}
property QtObject statusSwitchTab: QtObject {
property color backgroundColor: white
}
}

View File

@ -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