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. Is possible a component QWidget into QML/QtQuick 2.0.?
Forum Updated to NodeBB v4.3 + New Features

Is possible a component QWidget into QML/QtQuick 2.0.?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 773 Views 3 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.
  • elicatE Offline
    elicatE Offline
    elicat
    wrote on last edited by
    #1

    Re: Is it possible to integrate a QWidget into QML/QtQuick 2.0.

    Good Morning,
    Can i put component QTreeWidget into a QML file ?

    Saluti, Gianfranco Elicat

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      No, you can't.

      But there is a TreeView in QML: https://doc.qt.io/qt-5/qml-qtquick-controls-treeview.html

      (Z(:^

      elicatE 1 Reply Last reply
      1
      • sierdzioS sierdzio

        No, you can't.

        But there is a TreeView in QML: https://doc.qt.io/qt-5/qml-qtquick-controls-treeview.html

        elicatE Offline
        elicatE Offline
        elicat
        wrote on last edited by elicat
        #3

        @sierdzio

        Good Morning, @sierdzio
        Yes, I tried with treeView but I could not change the icon.
        As I feed the treeview by reading a database table I have created a model

        QStandardItem * item = new QStandardItem (QIcon ("qrc: /images/imagefolder.png"), "text item");
        

        Maybe I did not understand how to use the QIcon display?

        Saluti, Gianfranco Elicat

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          In QML, you're responsible to populate the delegates yourself. https://doc.qt.io/qt-5/qml-qtquick-controls-treeview.html#itemDelegate-prop You can add an Image component in the delegate and pass the path to your image through the model. Here's a tutorial for that https://doc.qt.io/qt-5/qtquick-modelviewsdata-cppmodels.html

          This does not looks very easy to do (I've never used TreeView in QML myself, though).

          (Z(:^

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            You might want to take a look at KDAB's Declarative Widget project.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • elicatE Offline
              elicatE Offline
              elicat
              wrote on last edited by
              #6

              Good morning, here in Italy are 7.50 A.M.
              The path of the model was started and also in the document "Using C ++ Models with Qt Quick" no reference is made to images or icons. Perhaps deepening is successful but I have not found any examples.
              I used the QStandardItemModel because it indicated the possibility to associate an icon with the item.

              QStandardItemModel 
              The QStandardItem class provides an item for use with the QStandardItemModel class
              
              QStandardItem(const QIcon & icon, const QString & text)
              

              Thanks for the indications of the Widget, I will ask the project manager if you can insert a widget not standard libraries.

              As I have little time and since I'm working with WebEngine I will create the tree with an html page.
              Thanks to everyone

              Saluti, Gianfranco Elicat

              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