[Interest] Executing C++ code from a QML menu item.

Rutledge Shawn Shawn.Rutledge at digia.com
Fri Jun 28 10:26:44 CEST 2013


On 28 Jun 2013, at 8:28 AM, Bache-Wiig Jens wrote:

> On Jun 27, 2013, at 11:28 PM, Joseph Crowell <joseph.w.crowell at gmail.com> wrote:
> 
>> Now that the desktop Widgets are out, I'm trying them out and seeing if 
>> I can figure out how it works. By reading and snipping code from the 
>> examples I've been able to make a simple dialog with menus, but I ran in 
>> to a snag when I wanted to add an "About Qt" menu item. How do you 
>> actually execute C++ code from QML like QApplication::AboutQt()?
> 
> You might want to read up on how to expose methods or properties from C++ to Qt Quick:
> http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-exposecppattributes.html
> 
> Note that the "Text" example provided with Qt Quick Controls is using a C++ backend. 
> (though we left AboutQt() as an exercise to the reader)

Should we have a QtQuick.Dialogs AboutDialog API?  ;-)  You could give it rich text (HTML markup) to display, which would let you insert your own logo etc., and have a markup element that expands to the About Qt info so can position it however you like.


More information about the Interest mailing list