[Qt-qml] "Cheating" in startup.qml?
Jens Bache-Wiig
jens.bache-wiig at nokia.com
Wed Sep 15 13:36:49 CEST 2010
Well the GraphicsItem effects are actually available, but due to
performance reasons you have to make them visible to QML explicitly.
Just add these lines to your your application and you can use them at
runtime:
qmlRegisterType<QGraphicsBlurEffect>("Effects",1,0,"Blur");
qmlRegisterType<QGraphicsDropShadowEffect>("Effects",1,0,"DropShadow");
For your suggestion it sounds a bit like the Canvas element I have been
experimenting with here: http://qt.gitorious.org/qt-labs/qmlcanvas.
The idea is to add html5-style canvas syntax to qml elements. This way
you can draw arbitrary graphics onto a Canvas element and essentially
use it like any other item. It is also possible to do a
canvas.save(filename).
Jens
> Imagine:
> Rectangle { id: rect1
> y: 100; width: 80; height: 80 gradient: Gradient {
> GradientStop { position: 0.0; color: "lightsteelblue" } GradientStop {
> position: 1.0; color: "blue" } } }then calling something like
> export(rect1, "rect1.png") In this way, QML can be used as a compisting engine.
>
> I thought there were Blur, DropShadow, etc, so I guess my question is why were
> they not used?
>
> Also, I would like to alert you to a documentation discrepancy. In QtCreator's
> help under "Qt4.7: QML Elements: Home: QML Elements" the Effects listed are all
> particle effects, and grayed out. The "QML Reference: Home: Elements" page
> however has the full complement listed. It might be just rc-status, but it might
> not.
>
> But I am so excited to be using QML!
>
>
>
More information about the Qt-qml
mailing list