A new way of QML PopupApplets

Marco Martin notmart at gmail.com
Thu Mar 1 22:05:22 UTC 2012


Hi all,

right now it wasn't possible to write in qml those applets that are always 
collapsed to a tiny element, but *not* an icon, like the notifications or the 
digital clock.

today there is another piece of the puzzle got in:
an example is in kdeexamples and is called helloworldcustompopup
(also documented in the wiki)

Item {
    property int minimumWidth: 200
    property int minimumHeight: 300
    property Component compactRepresentation: Component {
        PlasmaComponents.Button {
            text: i18n("Click me")
            onClicked: plasmoid.togglePopup()
        }
    }

    PlasmaComponents.Label {
        text: i18n("Hello world")
    }
}

exporting a Component property "compactRepresentation", will use that whatever 
widgets and fancy graphics contains as icon and will be always collapsed, just 
the same behavior of the c++ ones.

to try it you need updated kde-runtime and kdelibs (for a minor behaviour 
bugfix)

what is cool about it is that will make extremely easy to get rid of the 
Popupapplet class in libplasma2, that won't be available in the qml only 
library, but the behaviour of collapsing or not will be a property of all 
applets.


Cheers, 
Marco Martin


More information about the Plasma-devel mailing list