[Qt-qml] implicitWidth and implicitHeight in QML

warwick.allison at nokia.com warwick.allison at nokia.com
Thu Jul 29 02:13:58 CEST 2010


> I mean, for every single item, if they can be instantiated without a
> given size, then there must be a way for component developers to
> specify their "default size". And to me that should be "implicitWidth"
> and "implicitHeight"

There is. They simply set the width and height in the element:

MyFoo.qml:

import Qt 4.7
Item { width: 100; height: 100; ... }

Code instantiating the element can keep this "default" size, or change it:

MyFoo { }

MyFoo { width: 200 }

MyFoo { width: 200; height: 300 }

The implicit width/height concept is provided in QDeclarativeItem for the purpose of code-reuse in elements where it makes sense. It is not a property because its semantics is sensitive to the actual element type, not a generic concept.

--
Warwick




More information about the Qt-qml mailing list