examples/graphicsview/diagramscene/diagramscene.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   161         case InsertText:
   161         case InsertText:
   162             textItem = new DiagramTextItem();
   162             textItem = new DiagramTextItem();
   163             textItem->setFont(myFont);
   163             textItem->setFont(myFont);
   164             textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
   164             textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
   165             textItem->setZValue(1000.0);
   165             textItem->setZValue(1000.0);
   166             connect(textItem, SIGNAL(lostFocus(DiagramTextItem *)),
   166             connect(textItem, SIGNAL(lostFocus(DiagramTextItem*)),
   167                     this, SLOT(editorLostFocus(DiagramTextItem *)));
   167                     this, SLOT(editorLostFocus(DiagramTextItem*)));
   168             connect(textItem, SIGNAL(selectedChange(QGraphicsItem *)),
   168             connect(textItem, SIGNAL(selectedChange(QGraphicsItem*)),
   169                     this, SIGNAL(itemSelected(QGraphicsItem *)));
   169                     this, SIGNAL(itemSelected(QGraphicsItem*)));
   170             addItem(textItem);
   170             addItem(textItem);
   171             textItem->setDefaultTextColor(myTextColor);
   171             textItem->setDefaultTextColor(myTextColor);
   172             textItem->setPos(mouseEvent->scenePos());
   172             textItem->setPos(mouseEvent->scenePos());
   173             emit textInserted(textItem);
   173             emit textInserted(textItem);
   174 //! [8] //! [9]
   174 //! [8] //! [9]