From 44d2a844c42cbd93d54ada233f9cfd622c457db6 Mon Sep 17 00:00:00 2001 From: Sharm Date: Mon, 10 Apr 2017 00:45:29 +0300 Subject: [PATCH 1/2] Correct width with native paddings and hint text. Wrap editorAction for QML use. --- QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp | 5 +++++ QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp b/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp index 456ad99..15debda 100644 --- a/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp +++ b/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp @@ -42,6 +42,11 @@ QQuickAndroidOffscreenEditText::QQuickAndroidOffscreenEditText() connect(androidEditText(), SIGNAL(onTextChanged(QString,int,int,int)), this, SLOT(etTextChanged(QString,int,int,int))); connect(androidEditText(), SIGNAL(onKeyBack(bool)), this, SLOT(etKeyBack(bool))); connect(androidEditText(), SIGNAL(onEnterOrPositiveAction()), this, SLOT(etEnter())); + connect(androidEditText(), SIGNAL(onEditorAction(int)), this, SIGNAL(editorAction(int))); + + connect(this, &QQuickItem::widthChanged, [this](){ + androidEditText()->setWidth(width()); + }); } void QQuickAndroidOffscreenEditText::etTextChanged(QString text, int start, int before, int count) diff --git a/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.h b/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.h index 096a165..a2a6dfd 100644 --- a/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.h +++ b/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.h @@ -207,8 +207,8 @@ public slots: //! Wraps QAndroidOffscreenEditText::onEnterOrPositiveAction(). void returnPressed(); - void backPressed(); + void editorAction(int action); protected slots: virtual void etTextChanged(QString text, int start, int before, int count); From 88a282b8c68d36abc61c2116028c17a657a8c1a4 Mon Sep 17 00:00:00 2001 From: Sharm Date: Wed, 12 Apr 2017 01:53:56 +0300 Subject: [PATCH 2/2] Same for height --- QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp b/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp index 15debda..a4bec5f 100644 --- a/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp +++ b/QtOffscreenViews/QQuickViews/QQuickOffscreenEditText.cpp @@ -47,6 +47,10 @@ QQuickAndroidOffscreenEditText::QQuickAndroidOffscreenEditText() connect(this, &QQuickItem::widthChanged, [this](){ androidEditText()->setWidth(width()); }); + + connect(this, &QQuickItem::heightChanged, [this](){ + androidEditText()->setHeight(height()); + }); } void QQuickAndroidOffscreenEditText::etTextChanged(QString text, int start, int before, int count)