Important: Please read the Qt Code of Conduct -

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;
    QMatrix myMatrix(99,0,99,0,0,0);
    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