[Qt-qml] "Hello World" C++ Model on QML Flow?
Charley Bay
charleyb123 at gmail.com
Sun Oct 10 16:40:04 CEST 2010
> What is QML Flow? Do you mean ListView?
I should have clarified, "QML Flow element":
<http://doc.qt.nokia.com/4.7/qml-flow.html>
Funny you should say that -- I wanted Flow, didn't
know it existed, started to write my own, then found
that it was *included* in the standard library! ;-)
Anyway, I don't have it working yet, but I'm a lot closer
now. (It's a lot of work re-wiring my brain for QML, but
I think it's worth it.)
Part of my problem was that I misunderstood -- ListView
is a "view" element (like GridView and PathView), but
"Flow" is a "positioning" element (like Grid, Row, and
Column). So, my misunderstanding was attempting
to treat a "positioner" like a "view".
I'm still trying to understand the anatomy of the infrastructure
(e.g., differences between "views" and "positioners")
but a snapshot of the categories helped:
<http://doc.trolltech.org/4.7/overviews.html>
The docs are very good, but since this is literally a new
language and a new paradigm, I'm finding I need to read
things more than once. There is a lot of good information
in the docs, but the cross-referencing isn't yet mature, so
I've found quite a few things that I've read, and which is
helpful, but which I am unable to locate again when I
need to read it a second (or fifth) time.
But, I'm getting there. I can now debug across QML/C++
from within MSVC++2008 (Qt commercial) on Win7-64bit,
but can't get that working with QtCreator (GREAT tool) 2.0.1
nor 2.0.94. (Installed the MS debugging tools like QtCreator
requires, latest from Microsoft, but QtCreator doesn't like
this version, and can't get the path-to-the-tools on my
Win7-64bit to be accepted by QtCreator. It's not clear to me
that the mingw tools would work for my system with the
default settings (docs aren't clear), but I can't get that
working either.)
Today I'm writing a C++ class to dynamically re-load QML
files when prompted from QML (so I can by-pass qmlviewer,
and not need to re-launch my C++ app while iterating QML
changes.) This is prompted because I want to launch natively
from within MSVC++ (since that's where I'm able to debug),
and offers a (good) deployment model for at-install-changes
to the QML (but I expect a "standard" deployment model
would merely bundle QML into the Qt Resource System, but
I'm intending a command-line "override" of the bundled QML).
The initial QML "time footprint" is a bit long (15-20 seconds?
Haven't really timed it), but this is "debug" (haven't played with
release yet), so this re-load will greatly speed up development
when I'm merely tweaking the QML and don't want to re-launch
the whole C++ engine again.
Whew, this is a lot of work. Again, IMHO it's worth it, though.
--charley
On Sun, Oct 10, 2010 at 12:47 AM, Ville M. Vainio <vivainio at gmail.com> wrote:
> What is QML Flow? Do you mean ListView?
> --
> Sent from my Nokia N900
>
> ----- Original message -----
>> I'm *very* impressed with QML -- this is absolutely
>> the "right" way to build GUIs in this world of sophisticated
>> user expectation on varied platforms.
>>
>> Annoyingly, this means I've got to totally re-wire my
>> brain for how to think about GUIs. I'm willing to do it --
>> I'm sold -- but this has been a really painful couple of
>> weeks as I try to figure out "the QML way".
>>
>> Is there a "hello world" application using a QML Flow
>> that's hooked up to a C++ QAbstractItemModel?
>>
>> For example, I expect it to only be a few lines of code
>> to glob files in a directory (variable name length) in
>> a C++ model and display them in a QML Flow, with
>> item background color based on attributes (e.g., read
>> only, file extension/type). I just can't seem to get it,
>> though ... (I think I have the model but my Flow never
>> displays anything).
>>
>> I'm sure it's me. I'm just having trouble getting started...
>>
>> I've read all the QML documentation in the 4.7 release
>> (Win Commercial), but could use more ... book?
>> Snippets site? Suggestions?
>>
>> I'll get it, because I'm absolutely convinced this is
>> the "right* way to go. I just haven't gotten my "mind right"
>> yet ...
>>
>> --charley
>> _______________________________________________
>> Qt-qml mailing list
>> Qt-qml at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
>
More information about the Qt-qml
mailing list