Rename ImMicroFocus to ImCursorRectangle

Also set ImhMultiLine on QTextEdit

Change-Id: I04a5a1d69c2048ea94c24210e2b8374f334be1b6
Reviewed-on: http://codereview.qt-project.org/4414
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Lars Knoll 2011-09-08 10:57:54 +02:00
parent 1b18315001
commit 6f65a55fa9
10 changed files with 14 additions and 12 deletions

View File

@ -1235,7 +1235,8 @@ public:
enum InputMethodQuery {
ImEnabled = 0x1,
ImMicroFocus = 0x2,
ImCursorRectangle = 0x2,
ImMicroFocus = 0x2, // deprecated
ImFont = 0x4,
ImCursorPosition = 0x8,
ImSurroundingText = 0x10,

View File

@ -99,7 +99,7 @@ QRectF QInputPanel::cursorRectangle() const
if (!d->inputItem)
return QRectF();
QInputMethodQueryEvent query(Qt::ImMicroFocus);
QInputMethodQueryEvent query(Qt::ImCursorRectangle);
QGuiApplication::sendEvent(d->inputItem.data(), &query);
QRect r = query.value().toRect();
if (!r.isValid())
@ -163,7 +163,7 @@ void QInputPanel::update(Qt::InputMethodQueries queries)
if (ic)
ic->update(queries);
if (queries & Qt::ImMicroFocus)
if (queries & Qt::ImCursorRectangle)
emit cursorRectangleChanged();
}

View File

@ -1907,7 +1907,7 @@ QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const
Q_D(const QTextControl);
QTextBlock block = d->cursor.block();
switch(property) {
case Qt::ImMicroFocus:
case Qt::ImCursorRectangle:
return cursorRect();
case Qt::ImFont:
return QVariant(d->cursor.charFormat().font());

View File

@ -212,7 +212,7 @@ void QWindowsInputContext::update()
return;
// Move candidate list window to the microfocus position.
QRect globalMicroFocusRect;
if (!inputMethodQuery(fo, Qt::ImMicroFocus, &globalMicroFocusRect) || !globalMicroFocusRect.isValid())
if (!inputMethodQuery(fo, Qt::ImCursorRectangle, &globalMicroFocusRect) || !globalMicroFocusRect.isValid())
return;
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__ << himc << globalMicroFocusRect;

View File

@ -863,7 +863,7 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegate() const
QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const
{
const QModelIndex current = currentIndex();
if (!current.isValid() || query != Qt::ImMicroFocus)
if (!current.isValid() || query != Qt::ImCursorRectangle)
return QAbstractScrollArea::inputMethodQuery(query);
return visualRect(current);
}

View File

@ -8338,7 +8338,7 @@ bool QWidget::event(QEvent *event)
if (!k->isAccepted()
&& k->modifiers() & Qt::ShiftModifier && k->key() == Qt::Key_F1
&& d->whatsThis.size()) {
QWhatsThis::showText(mapToGlobal(inputMethodQuery(Qt::ImMicroFocus).toRect().center()), d->whatsThis, this);
QWhatsThis::showText(mapToGlobal(inputMethodQuery(Qt::ImCursorRectangle).toRect().center()), d->whatsThis, this);
k->accept();
}
#endif
@ -9280,7 +9280,7 @@ void QWidget::inputMethodEvent(QInputMethodEvent *event)
QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const
{
switch(query) {
case Qt::ImMicroFocus:
case Qt::ImCursorRectangle:
return QRect(width()/2, 0, 1, height());
case Qt::ImFont:
return font();

View File

@ -1757,7 +1757,7 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const
{
Q_D(const QLineEdit);
switch(property) {
case Qt::ImMicroFocus:
case Qt::ImCursorRectangle:
return d->cursorRect();
case Qt::ImFont:
return font();

View File

@ -465,9 +465,9 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma
if (!d->widget->isAncestorOf(childWidget))
return;
const QRect microFocus = childWidget->inputMethodQuery(Qt::ImMicroFocus).toRect();
const QRect microFocus = childWidget->inputMethodQuery(Qt::ImCursorRectangle).toRect();
const QRect defaultMicroFocus =
childWidget->QWidget::inputMethodQuery(Qt::ImMicroFocus).toRect();
childWidget->QWidget::inputMethodQuery(Qt::ImCursorRectangle).toRect();
QRect focusRect = (microFocus != defaultMicroFocus)
? QRect(childWidget->mapTo(d->widget, microFocus.topLeft()), microFocus.size())
: QRect(childWidget->mapTo(d->widget, QPoint(0,0)), childWidget->size());

View File

@ -181,6 +181,7 @@ void QTextEditPrivate::init(const QString &html)
q->setFocusPolicy(Qt::WheelFocus);
q->setAttribute(Qt::WA_KeyCompression);
q->setAttribute(Qt::WA_InputMethodEnabled);
q->setInputMethodHints(Qt::ImhMultiLine);
#ifndef QT_NO_CURSOR
viewport->setCursor(Qt::IBeamCursor);

View File

@ -1983,7 +1983,7 @@ QVariant QWidgetTextControl::inputMethodQuery(Qt::InputMethodQuery property) con
Q_D(const QWidgetTextControl);
QTextBlock block = d->cursor.block();
switch(property) {
case Qt::ImMicroFocus:
case Qt::ImCursorRectangle:
return cursorRect();
case Qt::ImFont:
return QVariant(d->cursor.charFormat().font());