Results 1 to 5 of 5

Thread: QtQuick structure

  1. #1
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default QtQuick structure

    Hello friends,

    I am a little bit confused about the structure of an qml app.

    How can I export QObject to my app written in qml:

    Qt Code:
    1. import QtQuick 2.1
    2. import QtQuick.Controls 1.0
    3. import QtQuick.Layouts 1.0
    4. import QtQuick.Window 2.0
    5.  
    6. ApplicationWindow {
    7. width: 640
    8. height: 480
    9.  
    10. menuBar: MenuBar {
    11. Menu {
    12. title: qsTr("File")
    13. MenuItem {
    14. text: qsTr("Exit")
    15. onTriggered: Qt.quit();
    16. }
    17. }
    18. }
    19. statusBar: StatusBar{
    20. Text{
    21. anchors.centerIn: parent
    22. text: "Ready"
    23. font.family: "Verdana"
    24. }
    25. }
    26. }
    To copy to clipboard, switch view to plain text mode 

    The Problem is I cannot imagine how to register my new qobject type without a main.cpp!
    Could anybody provide an example project with exporting new c++ types to an app written with
    Qt Code:
    1. ApplicationWindow {}
    To copy to clipboard, switch view to plain text mode 

    Yours,

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtQuick structure

    If you don't want to have a main.cpp then you need to export all your types as a QML plugin and then import that plugin into your QML code and declare items of types you exported in the plugin. Other than that, you can create a regular application that will create a QQuickView or QQuickWindow, load your QtQuick code and optionally expose everything you want exposed.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: QtQuick structure

    Thank you very much. Ok I use the Plugin approach.
    But when it comes to running on debug it comes to this error:

    The plugin 'C:/Users/xxxxx/xxxxx/xxxxx/xxxx/ProjectRoot/MyPluginPlugin/qmltestplugin.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)
    Compiling debug is not the problem. In release everything is ok.

    Yours,

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtQuick structure

    Quote Originally Posted by codeman View Post
    Compiling debug is not the problem. In release everything is ok.
    Hmm... so what's the problem if both are ok?

    And seriously, build your plugin in release mode.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: QtQuick structure

    I mean compiling in Debug is not the problem, but when I try to run the program it says " (Cannot mix debug and release libraries.)"

    In release I can compile and run the program...

    Yours,

Similar Threads

  1. QtQuick 2.1
    By shadowroot in forum Qt Quick
    Replies: 1
    Last Post: 6th April 2013, 08:44
  2. What is QtQuick/QML really for?
    By Huk in forum Qt Quick
    Replies: 7
    Last Post: 21st June 2012, 20:33
  3. Designer or QtQuick?
    By Jeffb in forum Qt Quick
    Replies: 5
    Last Post: 9th August 2011, 06:38
  4. Replies: 12
    Last Post: 26th June 2011, 11:26
  5. Linking Sql Database in QtQuick
    By chronoski in forum Newbie
    Replies: 1
    Last Post: 17th March 2011, 03:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.