[Interest] QGraphicsView: selection area drawing
Christian Gagneraud
chgans at gna.org
Wed Mar 26 23:44:12 CET 2014
Hi there,
I've implementing a "zoom area" tool on a QGraphicsView, while dragging
the mouse it draws the zoom area in a (visually) similar way as the
RubberBandDrag selection area. I've looked into the source code of
QGraphicsView but couldn't find which color is used to draw it.
I've pinned down the QStyleOptionRubberBand and QStyleOption::OptionType
but I don't get how I should use it.
My naive implementation draws the area using a QGraphicsRectItem, but
I've discovered that QGraphicsView draws the selection area using a
painter in paintEvent() (after calling drawForeground()).
What is the best way to draw the zoom area, should I handle this in
drawForeground()? The code in QGraphicsView looks over-complicated to me
compared with using a QGraphicsRectItem.
Any thought or advice?
Chris
More information about the Interest
mailing list