Add a QIconItem to the containment, works :)

This commit is contained in:
Sebastian Kügler 2013-02-14 02:08:33 +01:00
parent 1d666bfcb1
commit a43d85cf3f
2 changed files with 36 additions and 11 deletions

View File

@ -18,7 +18,7 @@
import QtQuick 2.0 import QtQuick 2.0
import org.kde.plasma.core 0.1 as PlasmaCore //import org.kde.plasma.core 0.1 as PlasmaCore
Rectangle { Rectangle {
id: root id: root

View File

@ -20,6 +20,7 @@ import QtQuick 2.0
import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.qtextracomponents 0.1 as QtExtras
Rectangle { Rectangle {
id: root id: root
@ -51,14 +52,20 @@ Rectangle {
id: appletContainerComponent id: appletContainerComponent
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
id: frame id: frame
x: 50 x: 50 - tmargin
y: 50 y: 50 - lmargin
width: large width: large + lmargin + rmargin
height: large height: large + tmargin + bmargin
property alias applet: appletContainer.children property alias applet: appletContainer.children
property int small: 90 property int small: 90
property int large: root.width /2 property int large: 400
property int lmargin: imagePath != "" ? frame.margins.left : 0
property int rmargin: imagePath != "" ? frame.margins.right : 0
property int tmargin: imagePath != "" ? frame.margins.top : 0
property int bmargin: imagePath != "" ? frame.margins.bottom : 0
imagePath: applet.length > 0 && applet[0].backgroundHints == 0 ? "" : "widgets/background" imagePath: applet.length > 0 && applet[0].backgroundHints == 0 ? "" : "widgets/background"
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -70,10 +77,6 @@ Rectangle {
frame.width = s frame.width = s
} }
} }
Behavior on x { PropertyAnimation { easing.type: Easing.OutElastic; duration: 800 } }
//Behavior on y { PropertyAnimation { easing.type: Easing.OutElastic; duration: 800 } }
Behavior on width { PropertyAnimation { easing.type: Easing.InOutDouble; duration: 300 } }
Behavior on height { PropertyAnimation { easing.type: Easing.InOutDouble; duration: 300 } }
Item { Item {
id: appletContainer id: appletContainer
@ -106,13 +109,35 @@ Rectangle {
} }
} }
QtExtras.QIconItem {
icon: "preferences-desktop-icons"
width: 96
height: width
MouseArea {
anchors.fill: parent
drag.target: parent
onClicked: {
var n = parent.width == 96 ? 256 : 96;
parent.width = n;
parent.height = n;
}
}
Behavior on width { PropertyAnimation { easing.type: Easing.InOutDouble; duration: 100 } }
Behavior on height { PropertyAnimation { easing.type: Easing.InOutDouble; duration: 100 } }
}
PlasmaCore.IconItem { PlasmaCore.IconItem {
source: "accessories-dictionary" source: "accessories-dictionary"
x: 50 x: 50
y: 350 y: 350
width: 48 width: 48
height: 48 height: 48
Rectangle { color: "white"; opacity: 0.2; anchors.fill: parent; } //Rectangle { color: "white"; opacity: 0.2; anchors.fill: parent; }
MouseArea {
anchors.fill: parent
drag.target: parent
}
} }
Component.onCompleted: { Component.onCompleted: {