chore(StatusSwitchTab*): simplify and make the beta tag highlighted
- make the StatusBetaTag highlighted when used inside an active/checked StatusSwitchTabButton - simplify the components, get rid of MouseArea just for the sake of setting the cursorShape
This commit is contained in:
parent
c50c970e42
commit
1df3503dfb
|
@ -1,13 +1,14 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
TabBar {
|
||||
id: statusSwitchTabBar
|
||||
padding: 1
|
||||
|
||||
background: Rectangle {
|
||||
implicitHeight: 36
|
||||
|
||||
background: Rectangle {
|
||||
color: Theme.palette.statusSwitchTab.barBackgroundColor
|
||||
radius: 8
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtGraphicalEffects 1.13
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Components 0.1
|
||||
|
@ -9,20 +9,14 @@ import StatusQ.Core.Theme 0.1
|
|||
TabButton {
|
||||
id: root
|
||||
|
||||
property int fontPixelSize: 15
|
||||
property bool showBetaTag: false
|
||||
|
||||
implicitHeight: 36
|
||||
implicitWidth: 148
|
||||
|
||||
font.pixelSize: 15
|
||||
|
||||
contentItem: Item {
|
||||
height: 36
|
||||
MouseArea {
|
||||
id: sensor
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: mouse.accepted = false
|
||||
onReleased: mouse.accepted = false
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: 8
|
||||
|
@ -34,23 +28,20 @@ TabButton {
|
|||
Theme.palette.statusSwitchTab.selectedTextColor :
|
||||
Theme.palette.statusSwitchTab.textColor
|
||||
font.weight: Font.Medium
|
||||
font.pixelSize: root.fontPixelSize
|
||||
font.pixelSize: root.font.pixelSize
|
||||
}
|
||||
|
||||
StatusBetaTag {
|
||||
visible: root.showBetaTag
|
||||
}
|
||||
fgColor: root.checked ? Theme.palette.statusSwitchTab.selectedTextColor
|
||||
: Theme.palette.baseColor1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
id: controlBackground
|
||||
implicitHeight: 36
|
||||
implicitWidth: 148
|
||||
color: root.checked ?
|
||||
Theme.palette.statusSwitchTab.buttonBackgroundColor :
|
||||
"transparent"
|
||||
color: root.checked ? Theme.palette.statusSwitchTab.buttonBackgroundColor
|
||||
: "transparent"
|
||||
radius: 8
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
|
@ -61,5 +52,9 @@ TabButton {
|
|||
spread: 0
|
||||
color: Theme.palette.dropShadow
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: hovered ? Qt.PointingHandCursor : undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ StatusDropdown {
|
|||
|
||||
StatusSwitchTabButton {
|
||||
text: modelData
|
||||
fontPixelSize: d.tabBarTextSize
|
||||
font.pixelSize: d.tabBarTextSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue