layout fixes

This commit is contained in:
Marco Martin 2012-01-02 15:17:37 +01:00
parent fc0b0b8ed1
commit f8bbc358ba
2 changed files with 44 additions and 9 deletions

View File

@ -44,6 +44,24 @@ Item {
dialog.visible = false dialog.visible = false
} }
function addMenuItem(item)
{
item.parent = visualModel
}
onChildrenChanged: {
//if is a menuitem move to visualModel
for (var i = 0; i < children.length; ++i) {
var item = children[i]
print("AAAAA"+item+(item.separator !== undefined))
if (item.separator !== undefined) {
print("BBBB"+item.parent)
item.parent = visualModel
print("CCCC"+item.parent)
}
}
}
visible: false visible: false
PlasmaCore.Dialog { PlasmaCore.Dialog {
@ -61,18 +79,18 @@ Item {
mainItem: Item { mainItem: Item {
id: contentItem id: contentItem
width: theme.defaultFont.mSize.width * 12 width: Math.max(visualModel.width, theme.defaultFont.mSize.width * 12)
height: Math.min(listView.contentHeight, theme.defaultFont.mSize.height * 25) height: Math.min(visualModel.height, theme.defaultFont.mSize.height * 25)
ListView {
Flickable {
id: listView id: listView
anchors.fill: parent anchors.fill: parent
currentIndex : -1
clip: true clip: true
model: VisualItemModel { Column {
id: visualModel id: visualModel
onChildrenChanged: { onChildrenChanged: {
for (var i = 0; i < children.length; ++i) { for (var i = 0; i < children.length; ++i) {

View File

@ -38,8 +38,9 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 1.0 import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.core 0.1 as PlasmaCore
import "private" as Private
Item { Item {
id: root id: root
@ -48,16 +49,32 @@ Item {
signal clicked signal clicked
property int implicitWidth: textArea.paintedWidth + 6 implicitWidth: textArea.paintedWidth + iconLoader.width*2 + 6
width: parent.width implicitHeight: textArea.paintedHeight + 6
height: textArea.paintedHeight + 6
property bool separator: false
property alias icon: iconLoader.source
Private.IconLoader {
id: iconLoader
width: parent.height
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
top: parent.top
bottom: parent.bottom
}
}
Label { Label {
id: textArea id: textArea
anchors.centerIn: parent anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight elide: Text.ElideRight
} }
/*Component.onCompleted: {
contentItem.width = 300//Math.max(contentItem.width, root.width)
}*/
MouseArea { MouseArea {