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 set different colors from cpp to the rectangle in Qml
Forum Updated to NodeBB v4.3 + New Features

How to set different colors from cpp to the rectangle in Qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
8 Posts 4 Posters 649 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.
  • S Offline
    S Offline
    sush123
    wrote on last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should share a minimal compilable example. Otherwise its impossible to guess what is going wrong.

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

      S 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You should share a minimal compilable example. Otherwise its impossible to guess what is going wrong.

        S Offline
        S Offline
        sush123
        wrote on last edited by
        #3

        @SGaist

        I need to set x and y position and color from Cpp model instead of setting in qml , how can i set it using QStandardItemModel?

        S 1 Reply Last reply
        0
        • eyllanescE Offline
          eyllanescE Offline
          eyllanesc
          wrote on last edited by eyllanesc
          #4

          @sush123 See my answer of similar question in SO: https://stackoverflow.com/questions/51300494/drawing-multiple-rectangles-into-image-in-qml Or https://stackoverflow.com/questions/54858514/qml-nested-rectangles, The last post is written for PySide2 but the logic can be translated for Qt/C++

          If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

          S 1 Reply Last reply
          0
          • S sush123

            @SGaist

            I need to set x and y position and color from Cpp model instead of setting in qml , how can i set it using QStandardItemModel?

            S Offline
            S Offline
            sush123
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • eyllanescE eyllanesc

              @sush123 See my answer of similar question in SO: https://stackoverflow.com/questions/51300494/drawing-multiple-rectangles-into-image-in-qml Or https://stackoverflow.com/questions/54858514/qml-nested-rectangles, The last post is written for PySide2 but the logic can be translated for Qt/C++

              S Offline
              S Offline
              sush123
              wrote on last edited by
              #6
              This post is deleted!
              jsulmJ 1 Reply Last reply
              0
              • S sush123

                This post is deleted!

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @sush123 Which exact line in your code causes this error?
                The error message already suggest you a solution: https://doc.qt.io/qt-5/qmetatype.html#Q_DECLARE_METATYPE

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                S 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @sush123 Which exact line in your code causes this error?
                  The error message already suggest you a solution: https://doc.qt.io/qt-5/qmetatype.html#Q_DECLARE_METATYPE

                  S Offline
                  S Offline
                  sush123
                  wrote on last edited by sush123
                  #8
                  This post is deleted!
                  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