[Qt-interest] QBrush with custom CrossPattern
Iurii Gordiienko
hordi at ukr.net
Thu Jun 11 14:08:57 CEST 2009
Hi
I use the QGraphicsScene (and QGraphicsItem) for drawing chart-like widget for showing some graph information. But in result I have lines from Qt::CrossPattern style above of the my own image (see attached screenshot)... I need black background with green lines under my image... This is part from my code for reproduce the current behavior: class GraphicsView : public QGraphicsView GraphicsView::GraphicsView() { scene()->setBackgroundBrush(QBrush(QColor(0,0,0)));
scene()->setForegroundBrush(QBrush(QColor(0,124,0), Qt::CrossPattern));
} class GraphicsItem : public QGraphicsItem... void GraphicsItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,QWidget*)
{
static QPen pen(QBrush(QColor(0,252,0),Qt::SolidPattern),2); painter->setPen(pen); painter->draw(...); }
Qt-4.5.1 Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090611/8d049e47/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 6318 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090611/8d049e47/attachment.png
More information about the Qt-interest-old
mailing list