Compile fix for QT_NO_IM in QtWidgets

Added some #ifdef guards around usages of composeMode().

Change-Id: If2f2d3cae21b270933b38ea67dcc885f5871785f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Steffen Imhof 2014-06-17 09:51:07 +02:00 committed by Oswald Buddenhagen
parent 3dc4b9ac86
commit 7f8f476244
3 changed files with 10 additions and 1 deletions

View File

@ -1528,13 +1528,16 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e)
#else
const bool select = (d->imHints & Qt::ImhNoPredictiveText);
#endif
#ifndef QT_NO_IM
if (d->control->composeMode() && select) {
int startPos = d->xToPos(d->mousePressPos.x());
int currentPos = d->xToPos(e->pos().x());
if (startPos != currentPos)
d->control->setSelection(startPos, currentPos - startPos);
} else {
} else
#endif
{
d->control->moveCursor(d->xToPos(e->pos().x()), select);
}
}
@ -1585,6 +1588,7 @@ void QLineEdit::mouseDoubleClickEvent(QMouseEvent* e)
int position = d->xToPos(e->pos().x());
// exit composition mode
#ifndef QT_NO_IM
if (d->control->composeMode()) {
int preeditPos = d->control->cursor();
int posInPreedit = position - d->control->cursor();
@ -1609,6 +1613,7 @@ void QLineEdit::mouseDoubleClickEvent(QMouseEvent* e)
position += (sizeChange - preeditLength);
}
}
#endif
if (position >= 0)
d->control->selectWordAtPos(position);

View File

@ -187,6 +187,7 @@ void QWidgetLineControl::paste(QClipboard::Mode clipboardMode)
*/
void QWidgetLineControl::commitPreedit()
{
#ifndef QT_NO_IM
if (!composeMode())
return;
@ -198,6 +199,7 @@ void QWidgetLineControl::commitPreedit()
setPreeditArea(-1, QString());
m_textLayout.clearAdditionalFormats();
updateDisplayText(/*force*/ true);
#endif
}

View File

@ -221,8 +221,10 @@ public:
}
void setText(const QString &txt)
{
#ifndef QT_NO_IM
if (composeMode())
qApp->inputMethod()->reset();
#endif
internalSetText(txt, -1, false);
}
void commitPreedit();