Results 1 to 6 of 6

Thread: fill colors in rounded rectangle

  1. #1
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default fill colors in rounded rectangle

    hi,

    I'm having a hard time filling the rounded rectangle with borders in 2 colors.
    I tried creating 2 child rectangle and use clip property but it is not working.

    Please advise. Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: fill colors in rounded rectangle

    You'll have to provide at least some visual hint on what you want it to look like.
    While most Qt experts are telepaths, there is always a limit on range.

    Cheers,
    _

  3. #3
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: fill colors in rounded rectangle

    sorry, I forgot to include a sample.

    Actually, I tried creating a child rectangle and fill it with solid color, however it won't clip on the parent rectangle's rounded corner.

    button.png

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: fill colors in rounded rectangle

    Ah. This use case it probably better solved using a border image.
    http://doc.qt.io/qt-5/qml-qtquick-borderimage.html

    Cheers,
    _

  5. #5
    Join Date
    Oct 2014
    Posts
    104
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: fill colors in rounded rectangle

    Quote Originally Posted by anda_skoa View Post
    Ah. This use case it probably better solved using a border image.
    http://doc.qt.io/qt-5/qml-qtquick-borderimage.html

    Cheers,
    _
    you mean, I should have an image to implement it.
    meaning, clipping is not possible on rounded rectangle, right?

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: fill colors in rounded rectangle

    I meant that this form of visualization is what BorderImage was designed for.

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 23rd March 2015, 08:54
  2. Replies: 2
    Last Post: 25th December 2014, 15:15
  3. Drawing of Rectangle which is rounded from only two side
    By vinayptl in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2013, 07:03
  4. Replies: 2
    Last Post: 5th July 2008, 19:35
  5. Draw a rectangle alternating two colors with qPainter
    By SkripT in forum Qt Programming
    Replies: 12
    Last Post: 24th January 2006, 23:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.