From 8c2284e811d6a1e5d1d5f0703f127e66800baf78 Mon Sep 17 00:00:00 2001 From: Jing Bai Date: Tue, 15 Jan 2013 19:04:10 +0100 Subject: To support QT_NO_IM on Linux/Windows/Mac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compilation issue when QT_NO_IM is defined. Also fixed references in tests. But fixing plugins/examples seem not necessary at this point. Task-number: QTBUG-26109 Change-Id: I2067051951616012117efa6716640cbf198fdb2a Reviewed-by: Jędrzej Nowacki --- src/corelib/global/qfeatures.h | 8 ++++++++ src/gui/inputmethod/qinputcontext.h | 1 + src/gui/inputmethod/qmacinputcontext_mac.cpp | 5 ++++- src/gui/inputmethod/qmacinputcontext_p.h | 5 +++-- src/gui/inputmethod/qwininputcontext_p.h | 4 +++- src/gui/inputmethod/qwininputcontext_win.cpp | 4 +++- src/gui/inputmethod/qximinputcontext_p.h | 4 ++-- src/gui/kernel/qapplication.h | 2 ++ src/gui/kernel/qapplication_mac.mm | 5 ++++- src/gui/kernel/qapplication_win.cpp | 19 ++++++++++++++++++- src/gui/kernel/qapplication_x11.cpp | 5 +++-- src/gui/kernel/qcocoaview_mac.mm | 6 +++++- src/gui/kernel/qkeymapper_mac.cpp | 4 ++-- src/gui/kernel/qwidget.cpp | 12 +++--------- src/gui/kernel/qwidget.h | 7 +++++-- src/gui/kernel/qwidget_p.h | 2 ++ src/gui/kernel/qwidget_win.cpp | 2 ++ src/gui/kernel/qwidget_x11.cpp | 7 ++++--- src/gui/text/qtextcontrol.cpp | 3 +++ src/scripttools/debugging/qscriptdebugger.cpp | 2 ++ .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 16 ++++++++++++---- .../tst_qdeclarativetextinput.cpp | 14 +++++++++++++- tests/auto/qwidget/tst_qwidget.cpp | 14 +++++++++++++- 23 files changed, 117 insertions(+), 34 deletions(-) diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 7424535..1642947 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -888,3 +888,11 @@ #define QT_NO_PRINTPREVIEWDIALOG #endif +//Input Method +#if defined(QT_NO_IM) +#define QT_NO_XIM +#endif + +#if defined(QT_NO_IM) +#define QT_NO_QWS_INPUTMETHODS +#endif diff --git a/src/gui/inputmethod/qinputcontext.h b/src/gui/inputmethod/qinputcontext.h index 47d7200..147b8ba 100644 --- a/src/gui/inputmethod/qinputcontext.h +++ b/src/gui/inputmethod/qinputcontext.h @@ -58,6 +58,7 @@ #include #include +#include #include #include #include diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/gui/inputmethod/qmacinputcontext_mac.cpp index 270258f..7cd1be1 100644 --- a/src/gui/inputmethod/qmacinputcontext_mac.cpp +++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp @@ -38,7 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +#include +#include +#ifndef QT_NO_IM #include #include #include @@ -378,3 +380,4 @@ QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void } QT_END_NAMESPACE +#endif // QT_NO_IM diff --git a/src/gui/inputmethod/qmacinputcontext_p.h b/src/gui/inputmethod/qmacinputcontext_p.h index 00e5a49..e818652 100644 --- a/src/gui/inputmethod/qmacinputcontext_p.h +++ b/src/gui/inputmethod/qmacinputcontext_p.h @@ -41,7 +41,8 @@ #ifndef QMACINPUTCONTEXT_P_H #define QMACINPUTCONTEXT_P_H - +#include +#ifndef QT_NO_IM // // W A R N I N G // ------------- @@ -94,5 +95,5 @@ private: }; QT_END_NAMESPACE - +#endif // QT_NO_IM #endif // QMACINPUTCONTEXT_P_H diff --git a/src/gui/inputmethod/qwininputcontext_p.h b/src/gui/inputmethod/qwininputcontext_p.h index ed9b110..ffb2862 100644 --- a/src/gui/inputmethod/qwininputcontext_p.h +++ b/src/gui/inputmethod/qwininputcontext_p.h @@ -52,6 +52,8 @@ // // We mean it. // +#include +#ifndef QT_NO_IM #include "QtGui/qinputcontext.h" #include "QtCore/qt_windows.h" @@ -107,5 +109,5 @@ private: }; QT_END_NAMESPACE - +#endif // QT_NO_IM #endif // QWININPUTCONTEXT_P_H diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp index 8338f02..21a159b 100644 --- a/src/gui/inputmethod/qwininputcontext_win.cpp +++ b/src/gui/inputmethod/qwininputcontext_win.cpp @@ -41,6 +41,7 @@ #include "qwininputcontext_p.h" #include "qinputcontext_p.h" +#ifndef QT_NO_IM #include "qfont.h" #include "qwidget.h" @@ -181,7 +182,7 @@ static IActiveIMMApp *aimm = 0; static IActiveIMMMessagePumpOwner *aimmpump = 0; static QString *imeComposition = 0; static int imePosition = -1; -bool qt_use_rtl_extensions = false; +extern bool qt_use_rtl_extensions; static bool haveCaret = false; #ifndef LGRPID_INSTALLED @@ -845,3 +846,4 @@ int QWinInputContext::reconvertString(RECONVERTSTRING *reconv) } QT_END_NAMESPACE +#endif // QT_NO_IM diff --git a/src/gui/inputmethod/qximinputcontext_p.h b/src/gui/inputmethod/qximinputcontext_p.h index 8f36c3c..ba7d6bc 100644 --- a/src/gui/inputmethod/qximinputcontext_p.h +++ b/src/gui/inputmethod/qximinputcontext_p.h @@ -66,8 +66,8 @@ // // We mean it. // - -#if !defined(Q_NO_IM) +#include +#ifndef QT_NO_IM #include "QtCore/qglobal.h" #include "QtGui/qinputcontext.h" diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 3de72dd..1c8334b 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -74,7 +74,9 @@ class QDesktopWidget; class QStyle; class QEventLoop; class QIcon; +#ifndef QT_NO_IM class QInputContext; +#endif template class QList; class QLocale; #if defined(Q_WS_QWS) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 41eb038..5a256ff 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1207,9 +1207,10 @@ void qt_init(QApplicationPrivate *priv, int) #ifndef QT_NO_ACCESSIBILITY QAccessible::initialize(); #endif +#ifndef QT_NO_IM QMacInputContext::initialize(); QApplicationPrivate::inputContext = new QMacInputContext; - +#endif if (QApplication::desktopSettingsAware()) qt_mac_update_os_settings(); #ifndef QT_MAC_USE_COCOA @@ -1325,7 +1326,9 @@ void qt_cleanup() #ifndef QT_NO_ACCESSIBILITY QAccessible::cleanup(); #endif +#ifndef QT_NO_IM QMacInputContext::cleanup(); +#endif QCursorData::cleanup(); QFont::cleanup(); QColormap::cleanup(); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 3935000..bbb1fca 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -261,6 +261,9 @@ static PACKET localPacketBuf[QT_TABLET_NPACKETQSIZE]; // our own tablet packet HCTX qt_tablet_context; // the hardware context for the tablet (like a window handle) bool qt_tablet_tilt_support; +// flags for extensions for special Languages, currently only for RTL languages +bool qt_use_rtl_extensions = false; + #ifndef QT_NO_TABLETEVENT static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab); static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor); @@ -845,7 +848,10 @@ void qt_init(QApplicationPrivate *priv, int) #ifndef QT_NO_TABLETEVENT initWinTabFunctions(); #endif // QT_NO_TABLETEVENT + +#ifndef QT_NO_IM QApplicationPrivate::inputContext = new QWinInputContext(0); +#endif // Read the initial cleartype settings... qt_win_read_cleartype_settings(); @@ -917,8 +923,10 @@ void qt_cleanup() displayDC = 0; } +#ifndef QT_NO_IM delete QApplicationPrivate::inputContext; QApplicationPrivate::inputContext = 0; +#endif #ifndef Q_WS_WINCE // Deinitialize OLE/COM @@ -1476,8 +1484,11 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa long res = 0; if (!qApp) // unstable app state +#ifndef QT_NO_IM RETURN(QWinInputContext::DefWindowProc(hwnd,message,wParam,lParam)) - +#else + return res; +#endif // QT_NO_IM QScopedLoopLevelCounter loopLevelCounter(QThreadData::get2(qApp->thread())); #if 0 @@ -2308,6 +2319,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa #endif #endif +#ifndef QT_NO_IM case WM_IME_STARTCOMPOSITION: case WM_IME_ENDCOMPOSITION: case WM_IME_COMPOSITION: { @@ -2343,6 +2355,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa } break; } +#endif // QT_NO_IM #ifndef Q_WS_WINCE case WM_CHANGECBCHAIN: case WM_DRAWCLIPBOARD: @@ -2677,7 +2690,11 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa RETURN(false); do_default: +#ifndef QT_NO_IM RETURN(QWinInputContext::DefWindowProc(hwnd,message,wParam,lParam)) +#else + RETURN(TRUE); +#endif } diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 32cc342..377c2d6 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -1047,6 +1047,7 @@ bool QApplicationPrivate::x11_apply_settings() qt_use_rtl_extensions = settings.value(QLatin1String("useRtlExtensions"), false).toBool(); +#ifndef QT_NO_IM #ifndef QT_NO_XIM if (qt_xim_preferred_style == 0) { QString ximInputStyle = settings.value(QLatin1String("XIMInputStyle"), @@ -1060,7 +1061,7 @@ bool QApplicationPrivate::x11_apply_settings() else if (ximInputStyle == QLatin1String("root")) qt_xim_preferred_style = XIMPreeditNothing | XIMStatusNothing; } -#endif +#endif // QT_NO_XIM QStringList inputMethods = QInputContextFactory::keys(); if (inputMethods.size() > 2 && inputMethods.contains(QLatin1String("imsw-multi"))) { X11->default_im = QLatin1String("imsw-multi"); @@ -1068,7 +1069,7 @@ bool QApplicationPrivate::x11_apply_settings() X11->default_im = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString(); } - +#endif //QT_NO_IM settings.endGroup(); // Qt return true; diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 6532f9a..e3f0f98 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +#include #import #ifdef QT_MAC_USE_COCOA @@ -1027,8 +1027,10 @@ static int qCocoaViewCount = 0; QWidget *widgetToGetKey = 0; if (!composing || qApp->focusWidget()) widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget); +#ifndef QT_NO_IM else if (QMacInputContext *mic = qobject_cast(qApp->inputContext())) widgetToGetKey = mic->lastFocusWidget(); +#endif if (widgetToGetKey) qt_sendSpontaneousEvent(widgetToGetKey, &e); composing = false; @@ -1221,6 +1223,7 @@ static int qCocoaViewCount = 0; @end QT_BEGIN_NAMESPACE +#ifndef QT_NO_IM void QMacInputContext::reset() { QWidget *w = QInputContext::focusWidget(); @@ -1249,6 +1252,7 @@ bool QMacInputContext::isComposing() const } return false; } +#endif // QT_NO_IM extern bool qt_mac_in_drag; void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm); diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index ed57d75..d09aded 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -739,7 +739,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e qt_mac_send_modifiers_changed(modifiers, widget); return true; } - +#ifndef QT_NO_IM QInputContext *currentContext = qApp->inputContext(); if (currentContext && currentContext->isComposing()) { if (ekind == kEventRawKeyDown) { @@ -756,7 +756,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e if (context) context->setLastKeydownEvent(0); } - +#endif //get modifiers Qt::KeyboardModifiers modifiers; int qtKey; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 0ef1f76..b770758 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -424,28 +424,23 @@ void QWidgetPrivate::scrollChildren(int dx, int dy) } } +#ifndef QT_NO_IM QInputContext *QWidgetPrivate::assignedInputContext() const { -#ifndef QT_NO_IM const QWidget *widget = q_func(); while (widget) { if (QInputContext *qic = widget->d_func()->ic) return qic; widget = widget->parentWidget(); } -#endif return 0; } QInputContext *QWidgetPrivate::inputContext() const { -#ifndef QT_NO_IM if (QInputContext *qic = assignedInputContext()) return qic; return qApp->inputContext(); -#else - return 0; -#endif } /*! @@ -480,7 +475,7 @@ void QWidget::setInputContext(QInputContext *context) Q_D(QWidget); if (!testAttribute(Qt::WA_InputMethodEnabled)) return; -#ifndef QT_NO_IM + if (context == d->ic) return; if (d->ic) @@ -488,9 +483,8 @@ void QWidget::setInputContext(QInputContext *context) d->ic = context; if (d->ic) d->ic->setParent(this); -#endif } - +#endif // QT_NO_IM /*! \obsolete diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 037a1b5..f56d83b 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -42,6 +42,7 @@ #ifndef QWIDGET_H #define QWIDGET_H +#include #include #include #include @@ -95,7 +96,9 @@ class QDragLeaveEvent; class QDropEvent; class QShowEvent; class QHideEvent; +#ifndef QT_NO_IM class QInputContext; +#endif class QIcon; class QWindowSurface; class QPlatformWindow; @@ -617,10 +620,10 @@ public: QPaintEngine *paintEngine() const; void ensurePolished() const; - +#ifndef QT_NO_IM QInputContext *inputContext(); void setInputContext(QInputContext *); - +#endif bool isAncestorOf(const QWidget *child) const; #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 732443d..4c97859 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -577,8 +577,10 @@ public: // sub-classes that their internals are about to be released. virtual void aboutToDestroy() {} +#ifndef QT_NO_IM QInputContext *assignedInputContext() const; QInputContext *inputContext() const; +#endif inline QWidget *effectiveFocusWidget() { QWidget *w = q_func(); while (w->focusProxy()) diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 9223a5d..1e8b030 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -513,8 +513,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO QT_NC_WIDGET_CREATE #endif +#ifndef QT_NO_IM if (q->hasFocus() && q->testAttribute(Qt::WA_InputMethodEnabled)) q->inputContext()->setFocusWidget(q); +#endif if (destroyw) { DestroyWindow(destroyw); diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 915dd28..aeec89d 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -910,13 +910,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (extra && !extra->mask.isEmpty() && q->internalWinId()) XShapeCombineRegion(X11->display, q->internalWinId(), ShapeBounding, 0, 0, extra->mask.handle(), ShapeSet); - +#ifndef QT_NO_IM if (q->hasFocus() && q->testAttribute(Qt::WA_InputMethodEnabled)) { QInputContext *inputContext = q->inputContext(); if (inputContext) inputContext->setFocusWidget(q); } - +#endif if (destroyw) { qt_XDestroyWindow(q, dpy, destroyw); if (QTLWExtra *topData = maybeTopData()) { @@ -1106,7 +1106,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) extern void qPRCleanup(QWidget *widget); // from qapplication_x11.cpp if (testAttribute(Qt::WA_WState_Reparented)) qPRCleanup(this); - +#ifndef QT_NO_IM if(d->ic) { delete d->ic; } else { @@ -1116,6 +1116,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (qic) qic->widgetDestroyed(this); } +#endif } } diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 94f7e10..2fee68a 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -3049,6 +3050,7 @@ void QTextControlPrivate::_q_copyLink() #endif } +#ifndef QT_NO_IM QInputContext *QTextControlPrivate::inputContext() { QInputContext *ctx = contextWidget->inputContext(); @@ -3056,6 +3058,7 @@ QInputContext *QTextControlPrivate::inputContext() ctx = contextWidget->parentWidget()->inputContext(); return ctx; } +#endif int QTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const { diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp index c1a84a9..995900f 100644 --- a/src/scripttools/debugging/qscriptdebugger.cpp +++ b/src/scripttools/debugging/qscriptdebugger.cpp @@ -881,6 +881,7 @@ void QScriptDebuggerPrivate::_q_goToLine() QScriptDebuggerCodeViewInterface *view = codeWidget->currentView(); if (!view) return; +#ifndef QT_NO_INPUTDIALOG bool ok = false; int lineNumber = QInputDialog::getInteger(0, QScriptDebugger::tr("Go to Line"), QScriptDebugger::tr("Line:"), @@ -888,6 +889,7 @@ void QScriptDebuggerPrivate::_q_goToLine() 1, INT_MAX, 1, &ok); if (ok) view->gotoLine(lineNumber); +#endif } class QScriptDebuggerShowLineJob : public QScriptDebuggerCommandSchedulerJob diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 8c08ce6..76c7148 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -127,8 +127,9 @@ private slots: void mouseSelectionMode_data(); void mouseSelectionMode(); void dragMouseSelection(); +#ifndef QT_NO_IM void inputMethodHints(); - +#endif void positionAt(); void cursorDelegate(); @@ -141,8 +142,10 @@ private slots: void canPaste(); void canPasteEmpty(); void textInput(); +#ifndef QT_NO_IM void openInputPanelOnClick(); void openInputPanelOnFocus(); +#endif void geometrySignals(); void pastingRichText_QTBUG_14003(); void implicitSize_data(); @@ -151,10 +154,11 @@ private slots: void implicitSizePreedit(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); - +#ifndef QT_NO_IM void preeditMicroFocus(); void inputContextMouseHandler(); void inputMethodComposing(); +#endif void cursorRectangleSize(); void deselect(); @@ -1604,6 +1608,7 @@ void tst_qdeclarativetextedit::mouseSelectionMode() delete canvas; } +#ifndef QT_NO_IM void tst_qdeclarativetextedit::inputMethodHints() { QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); @@ -1619,6 +1624,7 @@ void tst_qdeclarativetextedit::inputMethodHints() delete canvas; } +#endif void tst_qdeclarativetextedit::positionAt() { @@ -2064,7 +2070,7 @@ QDeclarativeView *tst_qdeclarativetextedit::createView(const QString &filename) canvas->setSource(QUrl::fromLocalFile(filename)); return canvas; } - +#ifndef QT_NO_IM class MyInputContext : public QInputContext { public: @@ -2327,7 +2333,7 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus() QVERIFY(view.inputContext() == 0); QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); } - +#endif //QT_NO_IM void tst_qdeclarativetextedit::geometrySignals() { QDeclarativeComponent component(&engine, SRCDIR "/data/geometrySignals.qml"); @@ -2484,6 +2490,7 @@ void tst_qdeclarativetextedit::testQtQuick11Attributes_data() << ":1 \"TextEdit.onLinkActivated\" is not available in QtQuick 1.0.\n"; } +#ifndef QT_NO_IM void tst_qdeclarativetextedit::preeditMicroFocus() { QString preeditText = "super"; @@ -2710,6 +2717,7 @@ void tst_qdeclarativetextedit::inputMethodComposing() QCOMPARE(edit.isInputMethodComposing(), false); QCOMPARE(spy.count(), 2); } +#endif // QT_NO_IM void tst_qdeclarativetextedit::cursorRectangleSize() { diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index c0e96db..5305ed0 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -116,8 +116,9 @@ private slots: void maxLength(); void masks(); void validators(); +#ifndef QT_NO_IM void inputMethods(); - +#endif void passwordCharacter(); void cursorDelegate(); void cursorVisible(); @@ -129,8 +130,10 @@ private slots: void canPaste(); void readOnly(); +#ifndef QT_NO_IM void openInputPanelOnClick(); void openInputPanelOnFocus(); +#endif void setHAlignClearCache(); void focusOutClearSelection(); @@ -142,10 +145,12 @@ private slots: void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); +#ifndef QT_NO_IM void preeditAutoScroll(); void preeditMicroFocus(); void inputContextMouseHandler(); void inputMethodComposing(); +#endif void cursorRectangleSize(); void deselect(); @@ -1521,6 +1526,7 @@ void tst_qdeclarativetextinput::validators() delete canvas; } +#ifndef QT_NO_IM void tst_qdeclarativetextinput::inputMethods() { QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethods.qml"); @@ -1569,6 +1575,7 @@ void tst_qdeclarativetextinput::inputMethods() delete canvas; } +#endif // QT_NO_IM /* TextInput element should only handle left/right keys until the cursor reaches @@ -2155,6 +2162,8 @@ QDeclarativeView *tst_qdeclarativetextinput::createView(const QString &filename) return canvas; } + +#ifndef QT_NO_IM class MyInputContext : public QInputContext { public: @@ -2389,6 +2398,7 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus() QVERIFY(view.inputContext() == 0); QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); } +#endif // QT_NO_IM class MyTextInput : public QDeclarativeTextInput { @@ -2497,6 +2507,7 @@ void tst_qdeclarativetextinput::testQtQuick11Attributes_data() << ""; } +#ifndef QT_NO_IM void tst_qdeclarativetextinput::preeditAutoScroll() { QString committedText = "super"; @@ -2807,6 +2818,7 @@ void tst_qdeclarativetextinput::inputMethodComposing() QCOMPARE(input.isInputMethodComposing(), false); QCOMPARE(spy.count(), 2); } +#endif // QT_NO_IM void tst_qdeclarativetextinput::cursorRectangleSize() { diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 4858b25..9cd257f 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ - +#include #if defined(QT3_SUPPORT) #include #include @@ -402,7 +402,9 @@ private slots: #endif #endif +#ifndef QT_NO_IM void focusProxyAndInputMethods(); +#endif void scrollWithoutBackingStore(); void taskQTBUG_7532_tabOrderWithFocusProxy(); @@ -440,6 +442,7 @@ bool tst_QWidget::ensureScreenSize(int width, int height) return (available.width() >= width && available.height() >= height); } +#ifndef QT_NO_IM class MyInputContext : public QInputContext { public: @@ -449,6 +452,7 @@ public: void reset() {} bool isComposing() const { return false; } }; +#endif // QT_NO_IM // Testing get/set functions void tst_QWidget::getSetCheck() @@ -585,6 +589,7 @@ void tst_QWidget::getSetCheck() obj1.setAcceptDrops(true); QCOMPARE(true, obj1.acceptDrops()); +#ifndef QT_NO_IM // QInputContext * QWidget::inputContext() // void QWidget::setInputContext(QInputContext *) MyInputContext *var13 = new MyInputContext; @@ -606,6 +611,7 @@ void tst_QWidget::getSetCheck() } #endif QVERIFY(qApp->inputContext() != var13); +#endif // QT_NO_IM // bool QWidget::autoFillBackground() // void QWidget::setAutoFillBackground(bool) @@ -9959,6 +9965,7 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779() void tst_QWidget::inputFocus_task257832() { +#ifndef QT_NO_IM QLineEdit *widget = new QLineEdit; QInputContext *context = widget->inputContext(); if (!context) @@ -9970,6 +9977,9 @@ void tst_QWidget::inputFocus_task257832() widget->setReadOnly(true); QVERIFY(!context->focusWidget()); delete widget; +#else + QWARN("Cannot test without inputmethod support"); +#endif // QT_NO_IM } void tst_QWidget::setGraphicsEffect() @@ -10400,6 +10410,7 @@ void tst_QWidget::opacityChangeCausesBackingStoreRecreation() #endif // !Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE #endif // Q_OS_SYMBIAN +#ifndef QT_NO_IM class InputContextTester : public QInputContext { Q_OBJECT @@ -10456,6 +10467,7 @@ void tst_QWidget::focusProxyAndInputMethods() delete toplevel; } +#endif // QT_NO_IM #ifdef QT_BUILD_INTERNAL class scrollWidgetWBS : public QWidget -- cgit v0.12