Why isn’t my QGraphicsTextItem movable? (draggable with mouse)
My QGraphicsTextItems (subclass) do show a selection ornamentation. But the user can't move them by dragging with the mouse. What am I missing? (This is with Qt 4.8.5 on Windows 7, 64 bit). Below are the relevant QGraphicsTextItem calls made from by subclass constructor. (I've also tried doing these things after the item is inserted into the scene).
Code:
OcanTextGfxItem::OcanTextGfxItem (TextData* textData,
OutputCanvasScene* gfxScene)
_textData (textData), // TextData*, not ownership
_scene (gfxScene) // OutputCanvasScene*
{
setPlainText (tr ("Test Text"));
setEnabled (true);
setVisible (true);
}
1 Attachment(s)
SOLVED: Why isn’t my QGraphicsTextItem movable? (draggable with mouse): "Z" Value.
SOLVED -- "Z" Value. The problem was that a large mostly-transparent QGraphicsPixmapItem (image) -- used as a background image -- was getting in the way of my QGraphicsTextItems. I had forgotten to set the "Z" value of those text items [with QGraphicsItem::setZValue (qreal z)]. This prevented the mouse from being able to drag (move) the text item.
See the accompanying image ... notice the text item in the bottom left ... and the mostly transparent image (chutes and ladders) ... http://cadswes2.colorado.edu/~philw/...tem-Zvalue.png
Attachment 10804
Re: SOLVED: Why isn’t my QGraphicsTextItem movable? (draggable with mouse): "Z" Value
LOL, Chutes and Ladders as a substitute for a topo map.