refactor: fishui tabbar

pull/25/merge
kateleet 4 years ago
parent 8089f744db
commit fd33abe631

@ -24,62 +24,51 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FishUI 1.0 as FishUI
TabBar {
Item {
id: control
implicitWidth: _content.width
default property alias content : _content.data
property bool newTabVisibile: true
property alias model: _listView.model
property alias delegate: _listView.delegate
property alias count: _listView.count
property alias currentIndex: _listView.currentIndex
signal newTabClicked()
background: Rectangle {
color: "transparent"
}
contentItem: Item {
RowLayout {
anchors.fill: parent
spacing: FishUI.Units.smallSpacing
ScrollView {
id: _scrollView
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
RowLayout {
anchors.fill: parent
spacing: FishUI.Units.smallSpacing / 2
ListView {
id: _listView
Layout.fillHeight: true
Layout.preferredWidth: _listView.childrenRect.width
Layout.alignment: Qt.AlignLeft
orientation: ListView.Horizontal
highlightMoveDuration: 0
highlightResizeDuration: 0
clip: true
}
clip: true
Loader {
active: control.newTabVisibile
visible: active
asynchronous: true
Flickable {
id: _flickable
// Layout.fillHeight: true
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.preferredHeight: 31
Layout.preferredWidth: visible ? height : 0
Row {
id: _content
width: _scrollView.width
height: _scrollView.height
}
}
sourceComponent: FishUI.RoundImageButton {
source: "qrc:/images/" + (FishUI.Theme.darkMode ? "dark/" : "light/") + "add.svg"
onClicked: control.newTabClicked()
iconMargins: 2
}
}
Loader {
active: control.newTabVisibile
visible: active
asynchronous: true
// Layout.fillHeight: true
Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: 31
Layout.preferredWidth: visible ? height : 0
sourceComponent: FishUI.RoundImageButton {
source: "qrc:/images/" + (FishUI.Theme.darkMode ? "dark/" : "light/") + "add.svg"
onClicked: control.newTabClicked()
}
}
Item {
Layout.fillWidth: true
}
}
}

@ -227,12 +227,16 @@ Window {
// Border line
Rectangle {
property var borderColor: compositing ? FishUI.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.05) : Qt.rgba(0, 0, 0, 0.05) : FishUI.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.15) : Qt.rgba(0, 0, 0, 0.15)
anchors.fill: parent
property var borderColor: compositing ? FishUI.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.3)
: Qt.rgba(0, 0, 0, 0.2) : FishUI.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.15)
: Qt.rgba(0, 0, 0, 0.15)
color: "transparent"
radius: control.windowRadius
border.color: borderColor
border.width: 1 / Screen.devicePixelRatio
border.pixelAligned: Screen.devicePixelRatio > 1 ? false : true
antialiasing: true
visible: !isMaximized && !isFullScreen
z: 999

@ -26,4 +26,4 @@ T.TabButton {
font: control.font
color: !control.enabled ? FishUI.Theme.disabledTextColor : control.pressed ? pressedColor : control.checked ? FishUI.Theme.textColor : FishUI.Theme.textColor
}
}
}

Loading…
Cancel
Save