[Qt-qml] Fw: Why can't I stylesheet a font?

Alan Alpert alan.alpert at nokia.com
Tue Jul 13 12:08:09 CEST 2010


On Tue, 13 Jul 2010 17:53:23 ext Jason H wrote:
> If that doesn't work, how about this: "Think of the children!" <rimshot>
> 
> Seriously though lets think about this in terms of apps on a desktop,
> because that has clearly not been thought about. To make a classic Qt app,
> you only need to know your system settings (fonts, color palettes),
> widgets, and their layout. In QML you don't care too much about color and
> font. But you have two options when it comes to resize events: scale or
> let the layout handlers assign pixels. In QML, we can scale, or we can use
> anchors and let one Element get it all. (It might be a composite element)
> but basically, you'll have something that resembles a classic
> centralWidget style application. The central widget will have to be
> specified in some way, with its borders touching parent or sibling
> anchors.
>

See  http://doc.qt.nokia.com/4.7-snapshot/qml-systempalette.html, for the 
system settings (colors at least, font is system font by default). The rest is 
in your QML so you have full control.

Mind you, QML is not for creating a classic Qt app. Widgets are still for 
creating a classic Qt app; you are permitted to use QMainWindow still when it 
is the best choice. And you can have some of the widgets inside be 
QDeclarativeViews where you need QML.

> Anyway, its 3:40am here, I am rambling. But let's not forget the desktop.
> Mmm kay? 

We haven't forgotten the desktop. But we do not currently have resources to 
spare for it. So now is a great time for you to join the open governance 
discussions, and maybe you can help make desktop QML happen.

> I understand more stuff will be arbitrarily sized, which makes
> the need for this property mechanism all that more important.
> Stylus-driven devices don't need a finger-sized control. But iPhones,
> Androids and N8s do. I'd like to target each one - and Android has a lot
> of screen pixel variance. If I were writing for that platform, I'd be
> using anchors as much as possible. If I were writing for more than one
> platform, I'd be using anchors as much as possible. (PS. Nokia, you are
> because MeeGo is now shipping on Aava, Quanta Redvale tablets.) And how
> will you ever handle screen rotations (essentially a resize), if your app
> is all pixel-coded?
> 
> PS. How does one handle resize/screen rotation events in QML?
> 

Resizing is that the dimensions of the root object change. Rotation changes a 
property on an object exposed by the viewer (and possibly your application). 
You can respond to these however you wish, and this enables you to radically 
relayout the application on size changes so as to always make the best use of 
the size (e.g., past a certain size it switches to two columns, and then to 
three).

Note that you can also make relative positions with bindings, not just 
anchors. E.g. x: root.width/3 .

-- 
Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks



More information about the Qt-qml mailing list