diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml index 995404668..01ca894d3 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml @@ -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) { diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/MenuItem.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/MenuItem.qml index 9ef171d5c..16f2546b9 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/MenuItem.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/MenuItem.qml @@ -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 {