Why do you want to put a QLineEdit inside a graphics scene?
Why do you want to put a QLineEdit inside a graphics scene?
I hope to input some texts to the image. And those texts can be editable.
The idea is like this:
I insert one QImage in QGraphicsScene.
I hope to add some text to this QGraphicsScene, for example, "It is taken in Norway". And those texts can be edited.
After saving, the texts and image will be merged.
Thanks!
You can edit text in QGraphicsTextItem.
Have a look at Diagram Scene example in Qt Demo-->GraphicsView section
But you don't need a QLineEdit for thatUse QGraphicsTextItem as suggested.
Thanks!
I started to use QGraphicsTextItemBut I still can not add one editable area to QGraphicsScene
i did like this. I am sure there are something missing, but I don't know what?
Qt Code:
textItem->setTextInteractionFlags(Qt::TextEditorInteraction); textItem->setZValue(1000.0); imageScene->addItem(textItem); textItem->setPos(200,300);To copy to clipboard, switch view to plain text mode
You are missing an asterisk in the declaration of the item. Also set the ItemIsFocusable flag on the item.
Bookmarks