Esempio n. 1
0
void VVimCmdLineEdit::setInputMethodEnabled(bool p_enabled)
{
    if (m_enableInputMethod != p_enabled) {
        m_enableInputMethod = p_enabled;

        QInputMethod *im = QGuiApplication::inputMethod();
        im->reset();
        // Ask input method to query current state, which will call inputMethodQuery().
        im->update(Qt::ImEnabled);
    }
}
Esempio n. 2
0
NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(bool *aIsRTL)
{
    *aIsRTL = false;

    QInputMethod* input = qApp->inputMethod();
    Qt::LayoutDirection layoutDir = input ? input->inputDirection() : Qt::LeftToRight;

    if (layoutDir == Qt::RightToLeft) {
        *aIsRTL = true;
    }

    return NS_OK;
}
Esempio n. 3
0
static PyObject *meth_QInputMethod_commit(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QInputMethod *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QInputMethod, &sipCpp))
        {
            sipCpp->commit();

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QInputMethod, sipName_commit, doc_QInputMethod_commit);

    return NULL;
}
Esempio n. 4
0
static PyObject *meth_QInputMethod_setInputItemRectangle(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const QRectF* a0;
        QInputMethod *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ9", &sipSelf, sipType_QInputMethod, &sipCpp, sipType_QRectF, &a0))
        {
            sipCpp->setInputItemRectangle(*a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QInputMethod, sipName_setInputItemRectangle, doc_QInputMethod_setInputItemRectangle);

    return NULL;
}
Esempio n. 5
0
static PyObject *meth_QInputMethod_invokeAction(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QInputMethod::Action a0;
        int a1;
        QInputMethod *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BEi", &sipSelf, sipType_QInputMethod, &sipCpp, sipType_QInputMethod_Action, &a0, &a1))
        {
            sipCpp->invokeAction(a0,a1);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QInputMethod, sipName_invokeAction, doc_QInputMethod_invokeAction);

    return NULL;
}
Esempio n. 6
0
static PyObject *meth_QInputMethod_update(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        Qt::InputMethodQueries* a0;
        int a0State = 0;
        QInputMethod *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QInputMethod, &sipCpp, sipType_Qt_InputMethodQueries, &a0, &a0State))
        {
            sipCpp->update(*a0);
            sipReleaseType(a0,sipType_Qt_InputMethodQueries,a0State);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QInputMethod, sipName_update, doc_QInputMethod_update);

    return NULL;
}
Esempio n. 7
0
void Wpp::realOnKeyboardVisibleChanged()
{
#if defined(Q_OS_IOS) || defined(Q_OS_ANDROID)
	qDebug() << __FUNCTION__;
	//#ifdef Q_OS_IOS
				QScreen *screen = QGuiApplication::primaryScreen();
				QWindow *window = QGuiApplication::focusWindow();
				QInputMethod *inputMethod = QGuiApplication::inputMethod();
				if ( inputMethod->isVisible() )
				{
					if ( m_softInputMode == ADJUST_RESIZE && window != 0 && screen != 0 )
					{
	#ifdef Q_OS_IOS
						QRectF kbRect = inputMethod->keyboardRectangle();
	#endif
	#ifdef Q_OS_ANDROID
						/*
						Rect r = new Rect();
						View rootview = this.getWindow().getDecorView(); // this = activity
						rootview.getWindowVisibleDisplayFrame(r);
						*/
						QAndroidJniObject visibleFrameRect("android/graphics/Rect","()V");
						qDebug() << __FUNCTION__ << "visibleFrameRect.isValid()=" << visibleFrameRect.isValid();

						QAndroidJniObject activity = QtAndroid::androidActivity();
						qDebug() << __FUNCTION__ << "activity.isValid()=" << activity.isValid();

						QAndroidJniObject androidWindow = activity.callObjectMethod(
									"getWindow","()Landroid/view/Window;");
						qDebug() << __FUNCTION__ << "androidWindow.isValid()=" << androidWindow.isValid();

						QAndroidJniObject rootview = androidWindow.callObjectMethod(
									"getDecorView","()Landroid/view/View;");
						qDebug() << __FUNCTION__ << "rootview.isValid()=" << rootview.isValid();

						//rootview.callMethod<void>("getWindowVisibleDisplayFrame","(Landroid/graphics/Rect;)V",visibleFrameRect.object<jobject>());
						rootview.callMethod<jboolean>("getLocalVisibleRect","(Landroid/graphics/Rect;)Z",visibleFrameRect.object<jobject>());
						qDebug() << __FUNCTION__ << "rootview.isValid()=" << rootview.isValid();
						qDebug() << __FUNCTION__ << "visibleFrameRect.isValid()=" << visibleFrameRect.isValid();

						jint visibleFrameTop = visibleFrameRect.getField<jint>("top");
						qDebug() << __FUNCTION__ << "visibleFrameRect.visibleFrameTop=" << visibleFrameTop;
						jint visibleFrameLeft = visibleFrameRect.getField<jint>("left");
						qDebug() << __FUNCTION__ << "visibleFrameRect.visibleFrameLeft=" << visibleFrameLeft;
						jint visibleFrameWidth = visibleFrameRect.callMethod<jint>("width","()I");
						qDebug() << __FUNCTION__ << "visibleFrameRect.width()=" << visibleFrameWidth;
						jint visibleFrameHeight = visibleFrameRect.callMethod<jint>("height","()I");
						qDebug() << __FUNCTION__ << "visibleFrameRect.height()=" << visibleFrameHeight;

						int keyboardHeight = 0;
						if ( screen != 0 )
						{
							qDebug() << __FUNCTION__ << "screen.height()=" << screen->size().height();
							keyboardHeight = screen->size().height() - visibleFrameHeight;
							qDebug() << __FUNCTION__ << "keyboardHeight=" << keyboardHeight;
						}
						QRectF kbRect(0, visibleFrameHeight, visibleFrameWidth, keyboardHeight);//assume keyboard from bottom side
	#endif
						qDebug() << __FUNCTION__ << "kbRect=" << kbRect;

						window->showNormal();
						if ( window->height() == screen->size().height() )
						{
							qDebug() << __FUNCTION__ << ":origSize=" << window->size();

							Q_ASSERT( kbRect.width() == (qreal)window->width() );//assume keyboard appears from bottom side of app window

							window->setHeight( window->height() - kbRect.height() );
							qDebug() << __FUNCTION__ << ":resize-ok-to:" << window->size();
						}

					}

				}
				else
				{
					if ( m_softInputMode == ADJUST_RESIZE && window != 0 && screen != 0 )
					{
						window->setHeight( screen->size().height() );
						qDebug() << __FUNCTION__ << ":resize-ok-to:" << screen->size();
					}
					window->showNormal();
				}
	//#endif
#endif
}