Results 1 to 2 of 2

Thread: Fill QRectangle using QBrush with different fill color and pattern color

  1. #1
    Join Date
    Feb 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Fill QRectangle using QBrush with different fill color and pattern color

    Hi,

    I want to fill a rectangle with gray color but i want Qt::BDiagPattern on it using black color.

    I tried,

    painter.setPen(QPen(Qt::black));
    painter.setBrush(QBrush(Qt::gray, Qt::BDiagPattern));

    but this creates a empty filled rectangle with gray diagonal lines.

    Any help appreciated.

    Regards,
    Adeel.

  2. #2
    Join Date
    May 2011
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Fill QRectangle using QBrush with different fill color and pattern color

    Maybe something like this?

    painter.setBackgroundMode( Qt::OpaqueMode );
    painter.setBackground( QColor( Qt::gray ) );
    painter.setPen( QPen( Qt::black ) );
    painter.setBrush( QBrush( Qt::black, Qt::BDiagPattern ) );

Similar Threads

  1. Replies: 5
    Last Post: 17th December 2014, 12:07
  2. Trouble: Updating color QColor and QBrush
    By SwedishPete in forum Newbie
    Replies: 3
    Last Post: 1st December 2009, 15:34
  3. How to fill QLabel Circle with color
    By arunvv in forum Qt Programming
    Replies: 6
    Last Post: 8th January 2009, 08:46
  4. Replies: 9
    Last Post: 21st June 2007, 10:27
  5. How to fill the grid with the color?
    By merry in forum Qt Programming
    Replies: 3
    Last Post: 18th June 2007, 11:10

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.