Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issue Regaurding QBrush

Issue Regaurding QBrush

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.5k Views
  • 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.
  • M Offline
    M Offline
    mahesh
    wrote on last edited by
    #1

    hi,can some one please tell me i just want my QGraphicsRectItems background blue color and top of that one i want the "BDiagPattern".I tried with this code but i am getting only pattern inside the rectitem i want color also ...plese tell me how to do it?

    @
    QBrush brush;
    brush.setStyle(Qt::BDiagPattern);
    QMatrix myMatrix(99,0,99,0,0,0);
    brush.setMatrix(myMatrix);
    foreach(QGraphicsItem *item ,Parentrect->childItems())
    {
    qgraphicsitem_cast <QGraphicsRectItem * >(item)->setBrush (Qt::blue));
    qgraphicsitem_cast <QGraphicsRectItem * >(item)->setBrush (brush);
    }
    @

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cincirin
      wrote on last edited by
      #2

      You can set only one brush on abstract shape item. So, you can set a solid blue brush, and reimplement paint method and fill a bounding rectangle rect with Qt::BDiagPattern brush

      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