[Qt-interest] I give up with qgraphicsscene and qgraphicsview, with stationary items

Gordon Schumacher whiplash at pobox.com
Tue Mar 23 16:13:44 CET 2010


On 3/23/2010 5:00 AM, Kari Laine <klaine8 at gmail.com> wrote:
> What I have been trying is to have fixed texts, lines and polylines in
> relation to view. So that user scrolls scene those items stay put in
> relation to view.
> I was able to get stationary lines with drawForeground. But those are
> QPainterPaths which are not moveable and you can not select them.
> Is it so?
>
> So basic thing is that one cannot have QGraphicsItems which would stay
> put when scene is scrolled. Could that be added to the QT?
>   

Indeed, partially reiterating others' ideas... I can think of three options:

1) A transparent QGraphicsView that floats above the main QGraphicsView
2) Add scrollbars outside the QGraphicsView, make the items that are
meant to scroll children of a "container" item, and use the scrollbar
positions to change the translation of the container (look at the
example pictured in the Graphics View section, the one with the rotating
coordinate diagrams - alas, I don't remember its name)
3) Add a QScrollArea via a QGraphicsProxyWidget to the QGraphicsView for
the scrollable items

I haven't the faintest idea which of these would yield the best
performance, though; perhaps a Troll who's versed in GraphicsView could
chime in here?  (Or ask on the #qt or #qt-labs IRC channels.)



More information about the Qt-interest-old mailing list