new graphics for tabbars

This commit is contained in:
Marco Martin 2014-03-05 20:14:26 +01:00
parent 0f4654643f
commit 6fe147f4d7
2 changed files with 26 additions and 13 deletions

Binary file not shown.

View File

@ -79,16 +79,9 @@ FocusScope {
*/ */
property alias tabPosition: tabBarLayout.tabPosition property alias tabPosition: tabBarLayout.tabPosition
implicitWidth: layout.implicitWidth + backgroundFrame.margins.left + backgroundFrame.margins.right implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight + backgroundFrame.margins.top + backgroundFrame.margins.bottom implicitHeight: layout.implicitHeight
PlasmaCore.FrameSvgItem {
id: backgroundFrame
anchors.fill: parent
imagePath: "widgets/frame"
prefix: "sunken"
}
Item { Item {
id: buttonCutter id: buttonCutter
@ -100,6 +93,7 @@ FocusScope {
bottomMargin: (buttonsLayout.visible && !layout.isHorizontal? buttonsLayout.height : 0) + 1 bottomMargin: (buttonsLayout.visible && !layout.isHorizontal? buttonsLayout.height : 0) + 1
} }
clip: true clip: true
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
id: buttonFrame id: buttonFrame
@ -108,8 +102,27 @@ FocusScope {
y: layout.isHorizontal ? 0 : tabBarLayout.y + currentTab.y y: layout.isHorizontal ? 0 : tabBarLayout.y + currentTab.y
width: layout.isHorizontal ? currentTab.width + margins.left + margins.right -1 : parent.width width: layout.isHorizontal ? currentTab.width + margins.left + margins.right -1 : parent.width
height: layout.isHorizontal ? parent.height : currentTab.height + margins.top + margins.bottom height: layout.isHorizontal ? parent.height : currentTab.height + margins.top + margins.bottom
imagePath: "widgets/button" imagePath: "widgets/tabbar"
prefix: "normal" prefix: {
var prefix;
switch (tabPosition) {
case Qt.LeftEdge:
prefix = "west-active-tab";
break;
case Qt.TopEdge:
prefix = "north-active-tab";
break;
case Qt.RightEdge:
prefix = "east-active-tab";
break;
default:
prefix = "south-active-tab";
}
if (!hasElementPrefix(prefix)) {
prefix = "active-tab";
}
return prefix;
}
Behavior on x { Behavior on x {
PropertyAnimation { PropertyAnimation {
easing.type: Easing.InQuad easing.type: Easing.InQuad
@ -230,8 +243,8 @@ FocusScope {
verticalCenter: layout.isHorizontal ? parent.verticalCenter : undefined verticalCenter: layout.isHorizontal ? parent.verticalCenter : undefined
bottom: !layout.isHorizontal ? parent.bottom : undefined bottom: !layout.isHorizontal ? parent.bottom : undefined
horizontalCenter: !layout.isHorizontal ? parent.horizontalCenter : undefined horizontalCenter: !layout.isHorizontal ? parent.horizontalCenter : undefined
rightMargin: Math.min(y, backgroundFrame.margins.right) rightMargin: y
bottomMargin: Math.min(y, backgroundFrame.margins.bottom) bottomMargin: y
} }
ToolButton { ToolButton {
height: Math.min(parent.height, parent.width) height: Math.min(parent.height, parent.width)