Are you looking for blueRectangle to initially be positioned at rectRectangle.x + 120, but not bound to it? (so changing redRectangle.x does not cause blueRectangle to move?) In that case you could either use an absolute value for the position of blueRectangle, or assign a value to blueRectangle.x at component completion:
// this assigns a value, and does not establish a binding
Component.onCompleted: blueRectangle.x = redRectangle.x+120 @
By default, the first item to accept a mouse press "grabs" the mouse (for more on this behavior, see docs "here":http://doc.qt.nokia.com/4.7/qgraphicsitem.html#mousePressEvent). So currently only one MouseArea can actively handle mouse events. We'd like to make this more flexible -- the task tracking this is "QTBUG-13007":http://bugreports.qt.nokia.com/browse/QTBUG-13007
Thanks, that worked very well. For reference, "this page":http://doc.trolltech.com/4.7/qtbinding.html describes putting QML files into an application as resources.
[edit: link highlighted / Denis Kormalev]
[quote author="Gary_" date="1287690827"]It is the exact way I wish to access my model. However, it uses private classes/headers to achieve this. I assume it is so they can be flexible with the engine logic without impacting the public SDK.[/quote]
That's exactly right. The bug that tracks this is:
[quote author="Gary_" date="1287690827"]Is it possible to safely implement their approach using the public SDK? If not, what is the most efficient way to do it?[/quote]
There is "this thread":http://lists.trolltech.com/pipermail/qt-qml/2010-September/001313.html that mentions two approaches to accessing the engine (one using private headers). Alternatively, what about returning a QDeclarativePropertyMap instead of a QScriptValue (may depend on planned ownership of this value)?
When 4.8 is released, the plan is that you will be able to continue using old import statements, or switch to new import statements if you want to use any of the new features provided.
The reason QtQuick 1.0 was introduced was to decouple QML versioning from Qt versioning. That will hopefully allow us to add new properties, etc within a minor release (e.g. 4.7), rather than having to wait for the next minor release (e.g. 4.8). This flexibility is important because QML is a new technology -- I think its natural that it grows at a different rate from Qt as a whole, which is overall quite mature.
A mouse up/down can be used in the following code to increment/dec the text value when the cursor is over top the item. What is the best way to make the scroll wheel do the same? Note, I need this for many items on a single screen. With a QDeclarativeItem subclass, would I need to implement the below in C++?
With the "implement in mainWindow and sync with qml", would this approach work and how does it look from a high level?
I'm still climbing the QML learning curve, so so looking for a high level overview or a place to start.
property color default_color: "white"
property alias text: text.text
property alias text_color: text.color
property int default_pixel_size
anchors.centerIn: parent; anchors.verticalCenterOffset: -1
font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5
text.text = text.text - (-1)
text.text = text.text - 1
default_pixel_size = text.font.pixelSize
text.font.pixelSize = default_pixel_size + 5
parent.color = "yellow"
valuebox.focus = true
text.font.pixelSize = default_pixel_size
parent.color = default_color
valuebox.focus = false
Working with a direct QObject-derived subclass rather than a QDeclarativeItem-derived subclass shouldn't be a problem (the engine itself knows nothing about QDeclarativeItem; to the engine QDeclarativeItem is simply another QObject with properties). Note that QDeclarativeParserStatus is an interface that is meant to be multiply inherited from (i.e. you would inherit from both QObject and QDeclarativeParserStatus to use it).
There was a great presentation on mixing C++ and QML at the "DevDays":http://qt.nokia.com/qtdevdays2010/. Maybe you can still make it to the San Francisco event?
The presentations were recorded, I have no idea when those videos will become available though.
Qt Components is in an, let's say, alpha stage. If you get interested, in the repository pointed by danilocesar you'll find in the master branch a widget set for MeeGo (in progress). Also, check the branch mx, where you can see a widget set created in QML with the look and feel of the "MX toolkit":http://www.ohloh.net/p/mx-toolkit.
In "this wiki page":http://developer.qt.nokia.com/wiki/Qt_Quick_Components you can find how to contact the developers and contribute with your opinions (and, maybe, with code =).
Stay tuned when the Qt Developer Days videos and/or slides become available and check the "talk about the project":http://qt.nokia.com/qtdevdays2010/qt-technical-sessions#qtcomponents.
A developer sprint happened last week in Oslo, so there will be new stuff soon. (Probably nothing appeared yet because of the Qt DevDays Munich =)
Ultimately almost all of the painting in the QML graphical elements is cached into pixmaps for performance reasons. This is done in the elements themselves (have a look at QDeclarativeRectangle::generateBorderedRect(), for example), so I can't think of an easy way to get around this without hacking all of the elements, or writing your own set of vector-based elements.
yes the value in myDelegate will be undefined.A solution to this problem is to reset the variable in myDelegate to NULL whenever the list starts moving( onMovementStarted: ) just to make sure it doesn't point to an invalid object/delegate
Do you have a ".qmlproject" file in your project directory? It has a QmlFiles field where it instructs Qt Creator where to find qml files. If you don't have one, it's possible that it's causing the need to reopen the project in order to load the new files, because, like Schneidi said, normally reopening is not necessary.
Hey guys, your are so great this actually solves the problem at the first sight.
before calling the QApplication constructor.
Now I get a pretty good performance on my Quad processor maybe I have validate this on
a weaker system, but I guess this should solve the performance problems we had.
Thanks mbrasser I already knew this page but I just forgot to consult this one ^^
[quote author="JesseOnRails" date="1286006941"]>ls /Developer/Applications/Qt/imports/
Okay, it looks like this has "old" contents (there should be a QtWebKit rather than an org) -- I've added a note to "QTBUG-13888":http://bugreports.qt.nokia.com/browse/QTBUG-13888.
[quote author="Thorbjørn Lindeijer" date="1285697851"]We've been reluctant to add additional primitives because of speed concerns. For example I wrote an Ellipse element, but it was not accepted since there is no way to make it fast.
However, there is a project that will allow arbitrary things to be drawn into a QML scene, emulating the HTML5 canvas rendering API:
You can do a lot of cool things with some imperative drawing code, but you should also be able to write a simple Line component in pure QML based on that.[/quote]
Ah, thank you for the response.
[quote author="nicola1" date="1285657479"]I added Q_OBJECT and now is working, Thanks. I should understand because i need Q_OBJECT when y class inherit from QSqlTableModel.
You'll need to install Mobility (see "here":http://qt.nokia.com/products/appdev/add-on-products/catalog/4/new-qt-apis/mobility or "here":http://qt.nokia.com/developer/new-qt-apis for the downloads). You can then use the elements as described in the documentation -- for example, here's how you could use the "SoundEffect element":http://doc.qt.nokia.com/qtmobility-1.0/qml-soundeffect.html.
Perhaps it wasn't included in the release. If you get the tar ball from gitorious it probably works. "http://qt.gitorious.org/qt/qt/archive-tarball/4.7":http://qt.gitorious.org/qt/qt/archive-tarball/4.7