PDA

View Full Version : setPlainText calling focusOutEvent in QGraphicsSimpleTextItem



wagmare
16th April 2014, 08:49
Hi friends,

Im overridding the focusOutEvent in QGraphicsTextItem


void EditTextItem::focusOutEvent(QFocusEvent *event)
{
setTextInteractionFlags(Qt::NoTextInteraction);
emit lostFocus(this);
QGraphicsTextItem::focusOutEvent(event);
}

when the user edit the text item im saving the edited text to a file. before user edits the text im calling to show the previous text setPlainText("Old Data") which in turn calling focusOutEvent() of GraphicsTextItem and lostFocus() signal has been emitted and im saving the old data only to the file.

i want to know how to avoid setPlainText to call focusOutEvent .

please help me and thanks in advance ..