[Qt-qml] Transient info widgets

joona.t.petrell at nokia.com joona.t.petrell at nokia.com
Tue Mar 30 09:39:42 CEST 2010


> Using states seems a bit overkill, and it would probably result in a state space explosion.

Transient behavior like information popups is more imperative than declarative in it's nature, so I would  just use a JavaScript function that can be called to show the popup, for example after an appropriate signal was emitted. I would also create a state for the visible popup (by default popup is hidden) so that I can easily animate it with transitions. Timer element can be added to dismiss the popup after a certain timeout. See attachements for a short example.

MyApp { 
    onSignal: popup.show("You have mail")
    ...
    MyPopup {
        id: popup
        function show(text_) {
            text = text_;
            popup.state = "visible";
        }
        Timer {
            interval: 1000
            onTriggered: {
                popup.state = ""
            } 
            ...
        }
        ...
    }
}

Cheers,

Joona

-----Original Message-----
From: qt-qml-bounces at trolltech.com [mailto:qt-qml-bounces at trolltech.com] On Behalf Of Kellomaki Pertti (Nokia-D/Tampere)
Sent: Tuesday, March 30, 2010 4:30 PM
To: qt-qml at trolltech.com
Subject: [Qt-qml] Transient info widgets

Hi,

What is the true QML way to deal with transient widgets that pop up on their own, and go away after a little while? Something like the little "you have mail" messages that pop up every time you are giving that very important presentation. Using states seems a bit overkill, and it would probably result in a state space explosion.
--
Pertti

_______________________________________________
Qt-qml mailing list
Qt-qml at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: popupexample.qml
Type: application/octet-stream
Size: 2462 bytes
Desc: popupexample.qml
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100330/f7f96650/attachment.obj 


More information about the Qt-qml mailing list