Issue Regaurding QBrush



  • 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);
    }
    @



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.