Results 1 to 4 of 4

Thread: QtQuick Rectangle control what borders show?

  1. #1
    Join Date
    Jan 2013
    Posts
    17
    Thanks
    9

    Default QtQuick Rectangle control what borders show?

    How to draw a Rectangle and control if it is to show left or right borders or both using QtQuick 2?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtQuick Rectangle control what borders show?

    A Rectangle does not allow to control each border separately. In certain cases you can obtain the effect you want by composing the rectangle from two or more rectangles (some with borders enabled and some with disabled) with clipping enabled through a shader effect. Of course that's not very performance effective. Alternatively you can apply a custom shader effect on the rectangle directly that will handle proper border drawing.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    ricardodovalle (27th May 2014)

  4. #3
    Join Date
    Jan 2013
    Posts
    17
    Thanks
    9

    Default Re: QtQuick Rectangle control what borders show?

    Like @wysota said:

    Qt Code:
    1. Rectangle {
    2. width: 100
    3. height: 200
    4. color: "blue"
    5.  
    6. Rectangle {
    7. id: borderLeft
    8. width: 1
    9. height: parent.height
    10. anchors.left: parent.left
    11. color: "red"
    12. }
    13.  
    14. Rectangle {
    15. id: borderRight
    16. width: 1
    17. height: parent.height
    18. anchors.right: parent.right
    19. color: "red"
    20. }
    21. }
    To copy to clipboard, switch view to plain text mode 

    Source: http://stackoverflow.com/questions/2...t-borders-show

    Thanks

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtQuick Rectangle control what borders show?

    That's not exactly what I meant. This makes you unable to use the "radius" property.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    ricardodovalle (27th May 2014)

Similar Threads

  1. Replies: 0
    Last Post: 24th June 2013, 11:48
  2. Replies: 1
    Last Post: 25th October 2012, 06:46
  3. How to control the color of the focus rectangle
    By Berryblue031 in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2012, 13:55
  4. Replies: 3
    Last Post: 9th December 2010, 21:10
  5. Replies: 1
    Last Post: 25th May 2010, 14:44

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.