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
}
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
PlasmaCore.Dialog {
@ -61,18 +79,18 @@ Item {
mainItem: Item {
id: contentItem
width: theme.defaultFont.mSize.width * 12
height: Math.min(listView.contentHeight, theme.defaultFont.mSize.height * 25)
width: Math.max(visualModel.width, theme.defaultFont.mSize.width * 12)
height: Math.min(visualModel.height, theme.defaultFont.mSize.height * 25)
ListView {
Flickable {
id: listView
anchors.fill: parent
currentIndex : -1
clip: true
model: VisualItemModel {
Column {
id: visualModel
onChildrenChanged: {
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 "private" as Private
Item {
id: root
@ -48,16 +49,32 @@ Item {
signal clicked
property int implicitWidth: textArea.paintedWidth + 6
width: parent.width
height: textArea.paintedHeight + 6
implicitWidth: textArea.paintedWidth + iconLoader.width*2 + 6
implicitHeight: 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 {
id: textArea
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
}
/*Component.onCompleted: {
contentItem.width = 300//Math.max(contentItem.width, root.width)
}*/
MouseArea {