QGraphicsItem Border
-
Hi, I have a QImage as a QGraphicsItem inside a QGraphicsView. I want to apply a 2 px border to this image(graphics item.). Is there a way to apply a stylesheet to this QGraphicsItem?
-
@sunil.nair said in QGraphicsItem Border:
Is there a way to apply a stylesheet to this QGraphicsItem?
no. QSS is only available to QtWidgets
You have to draw the border yourself (maybe place the pixmap item inside a custom QGraphicsRectItem - which draws the border). -
Hi,
you should be able to do so by overriding theQRectF boundingRect() const
function. Just call the base function to get the current rect., andreturn rect.adjusted(2,2,2,2)
.
-Michael.