[Qt-qml] The best way to use a QML button to start a new process?

Peter Matuchniak pmatuchniak at imsco-us.com
Sat Apr 10 18:17:58 CEST 2010


Thanks Colin, but I already visited that link before and although it explains some of the pieces involved, I don't see a coherent picture of how these things fit together -- it lacks context and a step-by-step approach.

It seems to me that this should be similar to the way Silverlight works, with the front-end XAML calling a client-side code-behind C# library.  I'd imagine that the QML is the same as XAML and that it is coupled with some shared library where I'd write my C++.

However, in the .NET environment I found the IDE made this pretty straightforward and I could also reference plenty of examples and tutorials.  Sometimes you just need that one "noob" example to get something working end-eto-end and then you can easily tackle a really complicated case.

Searching through the QML examples and demos that come with the source-build I see that under the "declarative" folder there's something called "minehunt" that looks very close to the mechanics of what I need to do.  I guess I'll have to do some trial and error to see if I can mimic that, but I wish there was a guide for how to build something like that from scratch.

QML looks very interesting and, like Silverlight/XAML, it's positioned well to do some very nice UI.

Cheers
Peter


-----Original Message-----
From: Colin Kern [mailto:colin.kern at gmail.com]
Sent: Friday, April 09, 2010 11:07 PM
To: Peter Matuchniak
Subject: Re: [Qt-qml] The best way to use a QML button to start a new process?

On Fri, Apr 9, 2010 at 6:04 PM, Peter Matuchniak
<pmatuchniak at imsco-us.com> wrote:
> On my QML window I have a button that I want to start another application.
> Essentially fork a new process that is separate from QML.  For example it
> could start a Terminal Window or open up a text editor or an Email
> application....etc.
>
> Is there a way to do this directly within QML inside the "OnClicked" event?
>
> Or do we need to bind the button to some "code-behind" C++?
>
> Any examples or pointers would be greatly appreciated -- I'm new to both Qt
> and QML.  It would be nice if there's a step by step tutorial that can be
> followed that show how to set up a QML button and have it invoke a C++
> function...

I'm pretty sure you'd need to call C++ code, unless Javascript has a
way.  Look here for calling C++ code in QML:
http://qt.nokia.com/doc/4.7-snapshot/qtbinding.html#calling-c-+
methods-from-qml

Colin



---------------------------------------------------------------------------
This email and any files transmitted with it are confidential & proprietary to Systems and
Software Enterprises, Inc. (dba IMS). This information is intended solely for the use of
the individual or entity to which it is addressed. Access or transmittal of the information
contained in this e-mail, in full or in part, to any other organization or persons is not
authorized.
---------------------------------------------------------------------------




More information about the Qt-qml mailing list