PDA

View Full Version : Edit QGraphicsTextItem when click on it



flavien317
14th June 2014, 14:50
Hello,

I can't edit a QGraphicsTextItem. Only the tab key work, other keys don't work.

So, i create my scene here:


uml::uml(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
m_pScene = new QGraphicsScene;
ui.graphicsView->setScene(m_pScene);
}

And my QGraphicsTextItem:


QTextEdit* text= widget->findChild<QTextEdit*>("text");
QString strText = methodes->toPlainText();
QGraphicsTextItem* classeText = new QGraphicsTextItem(strText );
classeText ->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsMovable);
classeText ->setTextInteractionFlags(Qt::TextEditorInteraction) ;

With this thing, don't work. How to do for change texte of one of this ?