fix to make sure titlebar height adjusts to both the button size or title text size.

BUG:335906
wilder-pre-rebase
Andrew Lake 12 years ago
parent c7b9e1abf8
commit 41adcd1edb
  1. 34
      windec/package/contents/ui/main.qml

@ -110,6 +110,11 @@ Decoration {
padding.left = 10; padding.left = 10;
padding.right = 20; padding.right = 20;
padding.bottom = 20; padding.bottom = 20;
titleRow.height = Math.max(root.buttonSize, caption.implicitHeight);
top.height = titleRow.anchors.topMargin +
titleRow.height +
4 +
titleBarSpacer.height;
} }
ColorHelper { ColorHelper {
id: colorHelper id: colorHelper
@ -205,10 +210,11 @@ Decoration {
left: parent.left left: parent.left
right: parent.right right: parent.right
top: parent.top top: parent.top
topMargin: decoration.maximized ? -1*titleRow.anchors.topMargin : 0
} }
height: titleRow.anchors.topMargin + height: titleRow.anchors.topMargin +
titleRow.height + titleRow.height +
(decoration.maximized ? 2 : 4) + 4 +
titleBarSpacer.height titleBarSpacer.height
radius: decoration.maximized ? 0 : 3 radius: decoration.maximized ? 0 : 3
gradient: Gradient { gradient: Gradient {
@ -275,12 +281,12 @@ Decoration {
Item { Item {
id: titleRow id: titleRow
height: Math.max(root.buttonSize, caption.implicitHeight) height: root.buttonSize
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
top: parent.top top: parent.top
topMargin: decoration.maximized ? 0 : 4 topMargin: 4
leftMargin: decoration.maximized ? 0 : 4 leftMargin: decoration.maximized ? 0 : 4
rightMargin: decoration.maximized ? 0 : 4 rightMargin: decoration.maximized ? 0 : 4
} }
@ -308,12 +314,11 @@ Decoration {
id: caption id: caption
textFormat: Text.PlainText textFormat: Text.PlainText
anchors { anchors {
top: parent.top verticalCenter: parent.verticalCenter
left: leftButtonGroup.right left: leftButtonGroup.right
right: rightButtonGroup.left right: rightButtonGroup.left
rightMargin: 4 rightMargin: 4
leftMargin: 4 leftMargin: 4
topMargin: 3
} }
color: options.fontColor color: options.fontColor
Behavior on color { Behavior on color {
@ -350,19 +355,16 @@ Decoration {
Item { Item {
id: innerBorder id: innerBorder
anchors.fill: parent anchors {
fill: parent
leftMargin: root.borders.left
rightMargin: root.borders.right
top: top.bottom
bottomMargin: root.borders.bottom
}
Rectangle { Rectangle {
anchors { anchors.fill: parent
fill: parent
leftMargin: root.borders.left
rightMargin: root.borders.right
topMargin: root.borders.top + top.height
bottomMargin: root.borders.bottom
}
border {
width: 0
}
visible: !decoration.maximized visible: !decoration.maximized
color: "transparent" color: "transparent"
} }

Loading…
Cancel
Save