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 Update on Monday, May 27th 2025

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 587 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.
  • S Offline
    S Offline
    sush123
    wrote on 4 May 2020, 09:29 last edited by
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 4 May 2020, 18:05 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 4 May 2020, 18:44
      0
      • S SGaist
        4 May 2020, 18:05

        Hi,

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

        S Offline
        S Offline
        sush123
        wrote on 4 May 2020, 18:44 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 4 May 2020, 19:27
        0
        • E Offline
          E Offline
          eyllanesc
          wrote on 4 May 2020, 19:15 last edited by eyllanesc 5 Apr 2020, 19:17
          #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 4 May 2020, 20:08
          0
          • S sush123
            4 May 2020, 18:44

            @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 4 May 2020, 19:27 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • E eyllanesc
              4 May 2020, 19:15

              @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 4 May 2020, 20:08 last edited by
              #6
              This post is deleted!
              J 1 Reply Last reply 5 May 2020, 05:21
              0
              • S sush123
                4 May 2020, 20:08

                This post is deleted!

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 5 May 2020, 05:21 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 5 May 2020, 06:39
                0
                • J jsulm
                  5 May 2020, 05:21

                  @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 5 May 2020, 06:39 last edited by sush123 5 May 2020, 07:27
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0

                  1/8

                  4 May 2020, 09:29

                  • Login

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