summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qtextedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qtextedit.cpp')
-rw-r--r--src/gui/widgets/qtextedit.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index ed16ecf..bedb3b6 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -67,6 +67,8 @@
#include <qtexttable.h>
#include <qvariant.h>
+#include <qstandardgestures.h>
+
#include <qinputcontext.h>
#endif
@@ -74,6 +76,10 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTEDIT
+static inline bool shouldEnableInputMethod(QTextEdit *textedit)
+{
+ return !textedit->isReadOnly();
+}
class QTextEditControl : public QTextControl
{
@@ -105,12 +111,16 @@ QTextEditPrivate::QTextEditPrivate()
: control(0),
autoFormatting(QTextEdit::AutoNone), tabChangesFocus(false),
lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0),
- wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), textFormat(Qt::AutoText)
+ wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), clickCausedFocus(0),
+ textFormat(Qt::AutoText)
{
ignoreAutomaticScrollbarAdjustment = false;
preferRichText = false;
showCursorOnInitialShow = true;
inDrag = false;
+#ifdef Q_WS_WIN
+ setSingleFingerPanEnabled(true);
+#endif
}
void QTextEditPrivate::createAutoBulletList()
@@ -328,8 +338,8 @@ void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect)
\brief The QTextEdit class provides a widget that is used to edit and display
both plain and rich text.
- \ingroup text
- \mainclass
+ \ingroup richtext-processing
+
\tableofcontents
@@ -1559,6 +1569,8 @@ void QTextEdit::mouseReleaseEvent(QMouseEvent *e)
d->autoScrollTimer.stop();
ensureCursorVisible();
}
+ d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
+ d->clickCausedFocus = 0;
}
/*! \reimp
@@ -1659,6 +1671,7 @@ void QTextEdit::inputMethodEvent(QInputMethodEvent *e)
}
#endif
d->sendControlEvent(e);
+ ensureCursorVisible();
}
/*!\reimp
@@ -1694,6 +1707,9 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
void QTextEdit::focusInEvent(QFocusEvent *e)
{
Q_D(QTextEdit);
+ if (e->reason() == Qt::MouseFocusReason) {
+ d->clickCausedFocus = 1;
+ }
QAbstractScrollArea::focusInEvent(e);
d->sendControlEvent(e);
}
@@ -2058,7 +2074,7 @@ void QTextEdit::setReadOnly(bool ro)
} else {
flags = Qt::TextEditorInteraction;
}
- setAttribute(Qt::WA_InputMethodEnabled, !ro);
+ setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
d->control->setTextInteractionFlags(flags);
}
@@ -2609,7 +2625,6 @@ void QTextEdit::ensureCursorVisible()
d->control->ensureCursorVisible();
}
-
/*!
\enum QTextEdit::KeyboardAction