fix left sidebar

This commit is contained in:
Marco Martin 2013-08-13 14:08:08 +02:00
parent 32d04b1809
commit 2a293e0680
2 changed files with 20 additions and 12 deletions

View File

@ -113,19 +113,25 @@ Rectangle {
contentHeight: childrenRect.height
anchors.fill: parent
property Item currentItem
property Item currentItem: categoriesColumn.children[1]
Rectangle {
Item {
id: categories
width: parent.width
height: Math.max(categoriesView.height, categoriesColumn.height)
color: syspal.base
height: categoriesColumn.height
Rectangle {
color: syspal.highlight
Item {
width: parent.width
height: theme.iconSizes.IconSizeHuge
y: index * height
height: categoriesView.currentItem.height
y: categoriesView.currentItem.y
Rectangle {
color: syspal.highlight
radius: 3
anchors {
fill: parent
margins: 2
}
}
Behavior on y {
NumberAnimation {
duration: 250

View File

@ -29,7 +29,7 @@ MouseArea {
}
//BEGIN properties
width: childrenRect.width
height: childrenRect.height
height: childrenRect.height + 4
property bool current: model.source == main.sourceFile
//END properties
@ -39,8 +39,8 @@ MouseArea {
if (delegate.current) {
return
} else {
if (typeof(categoriesView.currentIndex) != "undefined") {
categoriesView.currentIndex = index;
if (typeof(categoriesView.currentItem) !== "undefined") {
categoriesView.currentItem = delegate;
}
main.sourceFile = model.source
root.restoreConfig()
@ -48,7 +48,7 @@ MouseArea {
}
onCurrentChanged: {
if (current) {
categoriesView.currentIndex = index
categoriesView.currentItem = delegate;
}
}
//END connections
@ -57,6 +57,7 @@ MouseArea {
Column {
spacing: 4
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
right: parent.right
topMargin: _m
@ -75,6 +76,7 @@ MouseArea {
text: model.name
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
color: current ? syspal.highlightedText : syspal.text
}
}
//END UI components