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] |