1 #ifndef _BIBLIOTEQ_GRAPHICSITEMPIXMAP_H_ 2 #define _BIBLIOTEQ_GRAPHICSITEMPIXMAP_H_ 4 static void qt_graphicsItem_highlightSelected
7 const QStyleOptionGraphicsItem *option)
9 if(!item || !option || !painter)
12 const QRectF murect = painter->transform().mapRect(QRectF(0, 0, 1, 1));
14 if(qFuzzyIsNull(qMax(murect.width(), murect.height())))
17 const QRectF mbrect = painter->transform().mapRect(item->boundingRect());
19 if(qMin(mbrect.width(), mbrect.height()) < qreal(1.0))
22 const QColor bgcolor(70, 130, 180);
23 const qreal pad = 0.0;
24 const qreal penWidth = 2.5;
26 painter->setBrush(Qt::NoBrush);
27 painter->setPen(QPen(bgcolor, penWidth, Qt::SolidLine));
28 painter->drawRect(item->boundingRect().adjusted(pad, pad, -pad, -pad));
35 QGraphicsPixmapItem(pixmap, parent)
43 void paint(QPainter *painter,
44 const QStyleOptionGraphicsItem *option,
49 if(!option || !painter)
52 painter->setRenderHint(QPainter::SmoothPixmapTransform,
true);
54 QRectF exposed_rect(option->exposedRect.adjusted(-1, -1, 1, 1));
56 exposed_rect &= QRectF(offset().x(),
61 (exposed_rect, pixmap(), exposed_rect.translated(-offset()));
63 if(option->state & (QStyle::State_Selected | QStyle::State_HasFocus))
64 qt_graphicsItem_highlightSelected(
this, painter, option);
Definition: biblioteq_graphicsitempixmap.h:31