various cleanups

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-11-11 03:39:25 +00:00
parent deff95c0f9
commit 4a1b89df05
9 changed files with 9 additions and 91 deletions

View file

@ -1018,7 +1018,6 @@ public:
LastCursor = DragLinkCursor, LastCursor = DragLinkCursor,
BitmapCursor = 24, BitmapCursor = 24,
CustomCursor = 25 CustomCursor = 25
}; };
enum TextFormat { enum TextFormat {

View file

@ -245,9 +245,7 @@ void QInputDialogPrivate::ensureLineEdit()
Q_Q(QInputDialog); Q_Q(QInputDialog);
if (!lineEdit) { if (!lineEdit) {
lineEdit = new QLineEdit(q); lineEdit = new QLineEdit(q);
#ifndef QT_NO_IM
qt_widget_private(lineEdit)->inheritsInputMethodHints = 1;
#endif
lineEdit->hide(); lineEdit->hide();
QObject::connect(lineEdit, SIGNAL(textChanged(QString)), QObject::connect(lineEdit, SIGNAL(textChanged(QString)),
q, SLOT(_q_textChanged(QString))); q, SLOT(_q_textChanged(QString)));
@ -259,9 +257,6 @@ void QInputDialogPrivate::ensureComboBox()
Q_Q(QInputDialog); Q_Q(QInputDialog);
if (!comboBox) { if (!comboBox) {
comboBox = new QComboBox(q); comboBox = new QComboBox(q);
#ifndef QT_NO_IM
qt_widget_private(comboBox)->inheritsInputMethodHints = 1;
#endif
comboBox->hide(); comboBox->hide();
QObject::connect(comboBox, SIGNAL(editTextChanged(QString)), QObject::connect(comboBox, SIGNAL(editTextChanged(QString)),
q, SLOT(_q_textChanged(QString))); q, SLOT(_q_textChanged(QString)));

View file

@ -372,48 +372,6 @@ protected:
}; };
#endif // QT_NO_CONTEXTMENU #endif // QT_NO_CONTEXTMENU
#ifndef QT_NO_INPUTMETHOD
class Q_GUI_EXPORT QInputMethodEvent : public QEvent
{
public:
enum AttributeType {
TextFormat,
Cursor,
Language,
Ruby,
Selection
};
class Attribute {
public:
Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {}
AttributeType type;
int start;
int length;
QVariant value;
};
QInputMethodEvent();
QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
inline const QList<Attribute> &attributes() const { return attrs; }
inline const QString &preeditString() const { return preedit; }
inline const QString &commitString() const { return commit; }
inline int replacementStart() const { return replace_from; }
inline int replacementLength() const { return replace_length; }
QInputMethodEvent(const QInputMethodEvent &other);
private:
QString preedit;
QList<Attribute> attrs;
QString commit;
int replace_from;
int replace_length;
};
#endif // QT_NO_INPUTMETHOD
#ifndef QT_NO_DRAGANDDROP #ifndef QT_NO_DRAGANDDROP
class QMimeData; class QMimeData;

View file

@ -58,7 +58,6 @@
#include <qlist.h> #include <qlist.h>
#include <qlocale.h> #include <qlocale.h>
#include <qevent.h> #include <qevent.h>
#include <qhash.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -72,7 +71,7 @@ public:
static QKeyMapper *instance(); static QKeyMapper *instance();
static void changeKeyboard(); static void changeKeyboard();
static bool sendKeyEvent(QWidget *widget, bool grab, static bool sendKeyEvent(QWidget *widget,
QEvent::Type type, int code, Qt::KeyboardModifiers modifiers, QEvent::Type type, int code, Qt::KeyboardModifiers modifiers,
const QString &text, bool autorepeat, int count, const QString &text, bool autorepeat, int count,
quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers); quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers);

View file

@ -1228,7 +1228,7 @@ static Bool qt_keyrelease_scanner(Display *, XEvent *event, XPointer arg)
} }
#endif #endif
bool QKeyMapperPrivate::translateKeyEvent(QWidget *keyWidget, const XEvent *event, bool grab) bool QKeyMapperPrivate::translateKeyEvent(QWidget *keyWidget, const XEvent *event)
{ {
int code = -1; int code = -1;
int count = 0; int count = 0;
@ -1337,14 +1337,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *keyWidget, const XEvent *even
} }
} }
// autorepeat compression makes sense for all widgets (Windows // autorepeat compression makes sense for all widgets
// does it automatically ....) if (event->type == XKeyPress && text.length() <= 1) {
if (event->type == XKeyPress && text.length() <= 1
#ifndef QT_NO_IM
// input methods need discrete key events
&& !qic
#endif// QT_NO_IM
) {
XEvent dummy; XEvent dummy;
for (;;) { for (;;) {
@ -1363,12 +1357,12 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *keyWidget, const XEvent *even
} }
} }
return QKeyMapper::sendKeyEvent(keyWidget, grab, type, code, modifiers, text, autor, return QKeyMapper::sendKeyEvent(keyWidget, type, code, modifiers, text, autor,
qMax(qMax(count,1), int(text.length())), qMax(qMax(count,1), int(text.length())),
event->xkey.keycode, keysym, event->xkey.state); event->xkey.keycode, keysym, event->xkey.state);
} }
bool QKeyMapper::sendKeyEvent(QWidget *keyWidget, bool grab, bool QKeyMapper::sendKeyEvent(QWidget *keyWidget,
QEvent::Type type, int code, Qt::KeyboardModifiers modifiers, QEvent::Type type, int code, Qt::KeyboardModifiers modifiers,
const QString &text, bool autorepeat, int count, const QString &text, bool autorepeat, int count,
quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers) quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers)
@ -1391,7 +1385,6 @@ bool QKeyMapper::sendKeyEvent(QWidget *keyWidget, bool grab,
return true; return true;
} }
Q_UNUSED(grab);
QKeyEvent e(type, code, modifiers, QKeyEvent e(type, code, modifiers,
nativeScanCode, nativeVirtualKey, nativeModifiers, nativeScanCode, nativeVirtualKey, nativeModifiers,
text, autorepeat, qMax(qMax(count,1), int(text.length()))); text, autorepeat, qMax(qMax(count,1), int(text.length())));

View file

@ -636,9 +636,6 @@ public:
uint isMoved : 1; uint isMoved : 1;
uint isGLWidget : 1; uint isGLWidget : 1;
uint usesDoubleBufferedGLContext : 1; uint usesDoubleBufferedGLContext : 1;
#ifndef QT_NO_IM
uint inheritsInputMethodHints : 1;
#endif
uint inSetParent : 1; uint inSetParent : 1;
// *************************** Platform specific ************************************ // *************************** Platform specific ************************************

View file

@ -1662,13 +1662,6 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
if (cursor.position() != oldCursorPos) if (cursor.position() != oldCursorPos)
emit q->cursorPositionChanged(); emit q->cursorPositionChanged();
_q_updateCurrentCharFormatAndSelection(); _q_updateCurrentCharFormatAndSelection();
#ifndef QT_NO_IM
if (contextWidget) {
if (QInputContext *ic = inputContext()) {
ic->update();
}
}
#endif //QT_NO_IM
} else { } else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
if (cursor.position() != oldCursorPos) { if (cursor.position() != oldCursorPos) {
@ -2982,16 +2975,6 @@ void QTextControlPrivate::_q_copyLink()
#endif #endif
} }
#ifndef QT_NO_IM
QInputContext *QTextControlPrivate::inputContext()
{
QInputContext *ctx = contextWidget->inputContext();
if (!ctx && contextWidget->parentWidget())
ctx = contextWidget->parentWidget()->inputContext();
return ctx;
}
#endif
int QTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const int QTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const
{ {
Q_D(const QTextControl); Q_D(const QTextControl);

View file

@ -2572,7 +2572,7 @@ int QTextCursor::columnNumber() const
if (layout->lineCount() == 0) if (layout->lineCount() == 0)
return relativePos; return relativePos;
QTextLine line = layout->lineForTextPosition(relativePos); const QTextLine line = layout->lineForTextPosition(relativePos);
if (!line.isValid()) if (!line.isValid())
return 0; return 0;
return relativePos - line.textStart(); return relativePos - line.textStart();
@ -2586,7 +2586,7 @@ QTextDocument *QTextCursor::document() const
{ {
if (d->priv) if (d->priv)
return d->priv->document(); return d->priv->document();
return 0; // document went away return Q_NULLPTR; // document went away
} }
/*! /*!

View file

@ -267,12 +267,6 @@ public:
moveCursor(nextMaskBlank(0)); moveCursor(nextMaskBlank(0));
} }
// input methods
#ifndef QT_NO_IM
bool composeMode() const { return !m_textLayout.preeditAreaText().isEmpty(); }
void setPreeditArea(int cursor, const QString &text) { m_textLayout.setPreeditArea(cursor, text); }
#endif
QString preeditAreaText() const { return m_textLayout.preeditAreaText(); } QString preeditAreaText() const { return m_textLayout.preeditAreaText(); }
void updatePasswordEchoEditing(bool editing); void updatePasswordEchoEditing(bool editing);