Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. how to use QML items in a QWidget MainForm.ui

how to use QML items in a QWidget MainForm.ui

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 1.3k Views
  • 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
    Cuban Akira
    wrote on last edited by Cuban Akira
    #1

    hi guys,
    i create an app for desktop, a quick widget app, and recently i discover (via this forum) the qml and qt quick, for improve visual and add animation
    i want to incorporate on my old Qt widget app some animated items, from a QML file, but dont know if i can, and, i that case, how to insert them

    reading on the qt docs im proving something like > create a QQuickWidget, and setting it the source via > ui.quickwidgetName.setsource("url");
    ui.quickwidgetName.show();
    but the program dont run, send me various errors, almost all say that>
    C:\Users\erto\mainwindow.cpp:28: error: undefined reference to `_imp___ZN12QQuickWidget9setSourceERK4QUrl'

    i dont how to do what i want

    1 Reply Last reply
    0
    • ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @Cuban-Akira hi
      see if this helps https://forum.qt.io/topic/81264/add-qml-objects-to-your-c-widget-application

      C 1 Reply Last reply
      0
      • ODБOïO ODБOï

        @Cuban-Akira hi
        see if this helps https://forum.qt.io/topic/81264/add-qml-objects-to-your-c-widget-application

        C Offline
        C Offline
        Cuban Akira
        wrote on last edited by
        #3

        @LeLev

        so usefull your answer, thanks, but im have another problem

        when i run the app on debug mode the QQuickWidget display ok, and work perfect
        but when i change to relase mode and run the app the QQuickWidget is blank, dont show anything, what i missing??

        1 Reply Last reply
        0
        • ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #4

          @Cuban-Akira
          I don't know Widgets sorry..

          In your qml component you can try to catch onCompleted signal

          Component.onCompleted : console.log("qml file loaded")
          

          also please give your Qt version and application output if there is, so someone with more experience can help you.

          1 Reply Last reply
          0
          • dheerendraD Offline
            dheerendraD Offline
            dheerendra
            Qt Champions 2022
            wrote on last edited by
            #5

            Either debug/release it should work the same. Can you show code how you are adding the QML items to Widget based App ?

            Dheerendra
            @Community Service
            Certified Qt Specialist
            http://www.pthinks.com

            C 1 Reply Last reply
            0
            • dheerendraD dheerendra

              Either debug/release it should work the same. Can you show code how you are adding the QML items to Widget based App ?

              C Offline
              C Offline
              Cuban Akira
              wrote on last edited by
              #6

              @dheerendra said in how to use QML items in a QWidget MainForm.ui:

              e it should work the same. Can you show code how you are adding the QML items to Widget b

              i create the qquickwidget in the .ui
              and then set his source
              //"wid" is the name of the QQuickWidget object
              ui->wid->setSource(QUrl("qrc:/Gi.qml"));
              //and show him
              ui->wid->show();

              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