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

Bache-Wiig Jens Jens.Bache-Wiig at digia.com
Fri Jun 28 08:28:39 CEST 2013


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)

Regards,
Jens 


More information about the Interest mailing list