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 two color rectangle
Forum Updated to NodeBB v4.3 + New Features

How to set two color rectangle

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 583 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

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

    alt text
    alt text

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

      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
      1
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        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
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          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
          0

          • Login

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