Results 1 to 13 of 13

Thread: Draw a rectangle alternating two colors with qPainter

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Draw a rectangle alternating two colors with qPainter

    Could you provide a picture of what you want to achieve?

  2. #2
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Draw a rectangle alternating two colors with qPainter

    Very easy, what I want is simply a rubber band. The problem drawing it with setPen( Qt:ashLine ) is that you can only choose one colour, I want to choose the two colors: black & white.
    Attached Images Attached Images

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draw a rectangle alternating two colors with qPainter

    Quote Originally Posted by SkripT
    The problem drawing it with setPen( Qt::DashLine ) is that you can only choose one colour, I want to choose the two colors: black & white.
    You can draw white rectangle with a solid line and then a black one using dashed line.

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

    Default Re: Draw a rectangle alternating two colors with qPainter

    Have you seen QRubberBand?

  5. #5
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Draw a rectangle alternating two colors with qPainter

    You can draw white rectangle with a solid line and then a black one using dashed line.
    One time more, thanks. I don't know what i was tinking of.... The solution is very easy

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.