Hi,

> Is there a precedent with having bindable properties under Qt global
object? For now it seems to be a grab bag of functions and constants.

You're right, there is no stateful properties or functions in Qt global object 
currently, only a bunch of functions and constants. The Application element 
would be the first.

> Why not create an own root object for Qt Quick Components?
qtqc.application.active?

I would rather not pollute global namespace any more, and qtqc does not sound 
intuitive (ok that name you gave was probably just an example). We are not 
supposed to do any language changes in QtQuick 1.1, but the nice solution would 
have been to provide a mechanism for sharing global elements between QML 
components using import statement that if wanted could be put under a 
namespace, something like

import QtQuick 1.1
import QtQuick.application 1.0 as App
Rectangle {
    color: App.active ? "white" : "gray"
}

or 

import QtQuick 1.1
import QtQuick.application 1.0 as App
Rectangle {
    color: App.application.active ? "white" : "gray"
}

That way application could avoid creating a dependency in each QML component 
that needs access to some shared resource (-> making executing those QML 
components in isolation impossible), or from constructing unnecessary copies of 
an element just to avoid creating the dependency (-> less than ideal 
performance). Similar "global" properties include the current device 
orientation, default font shared by different widgets in the application, 
function used to initiate tactile feedback for your widgets, and so on.

Cheers,

Joona 

-----Original Message-----
From: ext Ville M. Vainio [mailto:vivai...@gmail.com] 
Sent: Tuesday, January 04, 2011 8:00 PM
To: Petrell Joona.T (Nokia-MS/Brisbane)
Cc: Kervinen Antti (Nokia-MS/Tampere); Laitinen Harri.T (Nokia-MS/Tampere); 
Leppanen Olli (Nokia-MS/Tampere); qt-compone...@trolltech.com; Rouvinen Timo 
(Nokia-MS/Tampere)
Subject: Re: [Qt-components] [Proposal] Visibility API for QML applications 
(Revised 2.0)

On Tue, Jan 4, 2011 at 11:48 AM,  <joona.t.petr...@nokia.com> wrote:

> The property application.active will be part of Qt global object 
> (Qt.application.active) as exposing it independently breaks any existing

Is there a precedent with having bindable properties under Qt global
object? For now it seems to be a grab bag of functions and constants.

Why not create an own root object for Qt Quick Components?
qtqc.application.active?

-- 
Ville M. Vainio @@ Forum Nokia
_______________________________________________
Qt-components mailing list
Qt-components@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-components

Reply via email to