Commit 73e64612 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Allow hiding disabled tabs from TabBar

parent 91c86152
Pipeline #991 passed with stage
in 7 seconds
...@@ -67,6 +67,7 @@ FocusScope { ...@@ -67,6 +67,7 @@ FocusScope {
TextLabel { TextLabel {
text: parent.text; text: parent.text;
emphasis: parent.active;
} }
} }
anchors.verticalCenter: (parent ? parent.verticalCenter : undefined); anchors.verticalCenter: (parent ? parent.verticalCenter : undefined);
......
...@@ -15,17 +15,6 @@ Item { ...@@ -15,17 +15,6 @@ Item {
default property alias content : container.children; default property alias content : container.children;
readonly property var tabs : {
var ret = [];
for (var idx = 0; idx < content.length; idx++) {
var item = content [idx];
if (Introspector.isGroupItem (item)) {
ret.push (item);
}
}
return ret;
}
Rectangle { Rectangle {
id: rect; id: rect;
color: Style.colorSecondary; color: Style.colorSecondary;
...@@ -36,23 +25,31 @@ Item { ...@@ -36,23 +25,31 @@ Item {
anchors.bottom: bar.bottom; anchors.bottom: bar.bottom;
ExtraAnchors.horizontalFill: parent; ExtraAnchors.horizontalFill: parent;
} }
GridContainer { RowContainer {
id: bar; id: bar;
clip: true; clip: true;
cols: capacity; spacing: Style.spacingSmall;
capacity: tabs.length;
colSpacing: Style.spacingSmall;
anchors { anchors {
topMargin: bar.colSpacing; topMargin: bar.spacing;
leftMargin: (bar.colSpacing + extraPaddingBeforeTabs); leftMargin: (bar.spacing + extraPaddingBeforeTabs);
rightMargin: (bar.colSpacing + extraPaddingAfterTabs); rightMargin: (bar.spacing + extraPaddingAfterTabs);
} }
ExtraAnchors.topDock: parent; ExtraAnchors.topDock: parent;
Repeater { Repeater {
model: tabs; model: {
var ret = [];
for (var idx = 0; idx < base.content.length; idx++) {
var item = base.content [idx];
if (Introspector.isGroupItem (item)) {
ret.push (item);
}
}
return ret;
}
delegate: MouseArea { delegate: MouseArea {
id: clicker; id: clicker;
visible: (clicker.group && clicker.group.enabled);
implicitHeight: tabsSize; implicitHeight: tabsSize;
states: [ states: [
State { State {
...@@ -127,7 +124,10 @@ Item { ...@@ -127,7 +124,10 @@ Item {
} }
} }
] ]
onClicked: { currentTab = modelData; } Container.horizontalStretch: 1;
onClicked: {
currentTab = modelData;
}
readonly property Group group : modelData; readonly property Group group : modelData;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment