Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How to set two color rectangle

    QML and Qt Quick
    2
    4
    95
    Loading More Posts
    • 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.
    • N
      NullByte last edited by

      Hello to everyone. How can I design a rectangle like in the image below with qml?

      alt text
      alt text

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        For the line:

        • use 2 rectangles (this is easy to do but impacts performance)
        • or make a custom QQuickItem and implement custom painting for it in updatePaintNode() (harder to do, no performance penalty)

        For the circle:

        • use QQuickPaintedItem item (easy but a bit slow)
        • or make a custom QQuickItem and implement custom painting for it in updatePaintNode() (harder to do, no performance penalty)
        • you can probably use Shapes QML module for this, too

        (Z(:^

        1 Reply Last reply Reply Quote 1
        • N
          NullByte last edited by

          Thank for reply @sierdzio . Your suggestions will do my job as a design. The colors that I will use to show these graphics may not be half and half, is there anything you can suggest for this?

          1 Reply Last reply Reply Quote 0
          • sierdzio
            sierdzio Moderators last edited by

            All of my previous suggestion support the case when color rectangles are not equal. It's up to the implementation to handle it.

            (Z(:^

            1 Reply Last reply Reply Quote 0
            • First post
              Last post