Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Build QML into an EXE
Forum Updated to NodeBB v4.3 + New Features

Build QML into an EXE

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chcw
    wrote on last edited by
    #1

    I want to make a skinned Windows desktop application, and want to seperate the GUI with the logic, so that later the application can change the skin

    dymatically, like WinAMP.

    After contacting support of Qt, they recommend me to use QML technology.

    I understand the way to load QML file dymatically when the application is running, as below:

    @
    int main(int argc, char **argv)
    {
    QApplication app(argc, argv);
    QDeclarativeView view;
    view.setSource(QUrl::fromLocalFile("myqmlfile.qml"));
    view.show();
    return app.exec();
    }
    @

    However, in such a case, I cannot find a way to bind the events(such as button click event) with the event handler(logic) written in C++(except to use a

    PlugIn, which is undesirable). Can anyone helps?

    Thanks

    Alan

    Edit: added the code tags, gerolf

    1 Reply Last reply
    0
    • F Offline
      F Offline
      frankiefrank
      wrote on last edited by
      #2

      If you want your application to be based on QML, you probably won't have to interact with something like a button click event. After all, what you load in the viewer is your User Interface. But, for interacting with other C++/Qt functionality, you better read here:

      "http://doc.qt.digia.com/4.7-snapshot/qtbinding.html":http://doc.qt.digia.com/4.7-snapshot/qtbinding.html

      "http://doc.qt.digia.com/4.7-snapshot/qml-extending.html":http://doc.qt.digia.com/4.7-snapshot/qml-extending.html

      "Roads? Where we're going, we don't need roads."

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chcw
        wrote on last edited by
        #3

        Hi,

        I check your two links.

        It seems QML is mainly used as a fast prototype in software engineering, that is, quickly building a software GUI so that the customer and know what is the look & feel of their application. However, the final delivered application may be better to use the pure Qt technology.

        Am I correct?

        Thanks

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          No. QML is perfectly suitable for the end product.
          It is true that QML allows for rapid prototyping for GUIs, but that does not mean that the system isn't suitable for the end product as well. It is true that you'd mostly keep only the GUI in QML, and write the application logic in C++. However, doing it all in QML + Javascript is possible as well.

          Edit:
          Anyway, to put the QML into your .exe, load the QML from a Qt resource instead of from a file on disk.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            chcw
            wrote on last edited by
            #5

            OK. I see. Thank you so much. It seems:

            1. If I using C++, then all the programming logic must be put outside.

            2. If put QML as a Qt resource, then it is possible for others to take the QML outside the program and decode the programming logic, which is undesirable for most of the cases.

            Thanks

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved