mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 04:30:58 +02:00
Merge pull request #11610 from ElderOrb/case8217_RC57
8217 Search in tablet doesn't update (RC-57)
This commit is contained in:
commit
08cfa32858
1 changed files with 32 additions and 19 deletions
|
@ -1018,7 +1018,24 @@ void OffscreenQmlSurface::synthesizeKeyPress(QString key, QObject* targetOverrid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void forEachKeyboard(QQuickItem* item, std::function<void(QQuickItem*)> function) {
|
static void forEachKeyboard(QQuickItem* parent, std::function<void(QQuickItem*)> function) {
|
||||||
|
if (!function) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto keyboards = parent->findChildren<QObject*>("keyboard");
|
||||||
|
|
||||||
|
for (auto keyboardObject : keyboards) {
|
||||||
|
auto keyboard = qobject_cast<QQuickItem*>(keyboardObject);
|
||||||
|
if (keyboard) {
|
||||||
|
function(keyboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int TEXTINPUT_PASSWORD = 2;
|
||||||
|
|
||||||
|
static QQuickItem* getTopmostParent(QQuickItem* item) {
|
||||||
QObject* itemObject = item;
|
QObject* itemObject = item;
|
||||||
while (itemObject) {
|
while (itemObject) {
|
||||||
if (itemObject->parent()) {
|
if (itemObject->parent()) {
|
||||||
|
@ -1028,22 +1045,9 @@ static void forEachKeyboard(QQuickItem* item, std::function<void(QQuickItem*)> f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto keyboards = itemObject->findChildren<QObject*>("keyboard");
|
return qobject_cast<QQuickItem*> (itemObject);
|
||||||
|
|
||||||
for (auto keyboardObject : keyboards) {
|
|
||||||
auto keyboard = qobject_cast<QQuickItem*>(keyboardObject);
|
|
||||||
if (keyboard == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (function) {
|
|
||||||
function(keyboard);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int TEXTINPUT_PASSWORD = 2;
|
|
||||||
|
|
||||||
void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool numeric) {
|
void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool numeric) {
|
||||||
#if Q_OS_ANDROID
|
#if Q_OS_ANDROID
|
||||||
return;
|
return;
|
||||||
|
@ -1066,10 +1070,14 @@ void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool n
|
||||||
// we need to somehow pass 'isPasswordField' to visible keyboard so it will change its 'mirror text' to asterixes
|
// we need to somehow pass 'isPasswordField' to visible keyboard so it will change its 'mirror text' to asterixes
|
||||||
// the issue in some cases there might be more than one keyboard in object tree and it is hard to understand which one is being used at the moment
|
// the issue in some cases there might be more than one keyboard in object tree and it is hard to understand which one is being used at the moment
|
||||||
// unfortunately attempts to check for visibility failed becuase visibility is not updated yet. So... I don't see other way than just update properties for all the keyboards
|
// unfortunately attempts to check for visibility failed becuase visibility is not updated yet. So... I don't see other way than just update properties for all the keyboards
|
||||||
forEachKeyboard(item, [&](QQuickItem* keyboard) {
|
|
||||||
keyboard->setProperty("mirroredText", QVariant::fromValue(QString("")));
|
auto topmostParent = getTopmostParent(item);
|
||||||
keyboard->setProperty("password", isPasswordField);
|
if (topmostParent) {
|
||||||
});
|
forEachKeyboard(topmostParent, [&](QQuickItem* keyboard) {
|
||||||
|
keyboard->setProperty("mirroredText", QVariant::fromValue(QString("")));
|
||||||
|
keyboard->setProperty("password", isPasswordField);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// for future probably makes sense to consider one of the following:
|
// for future probably makes sense to consider one of the following:
|
||||||
// 1. make keyboard a singleton, which will be dynamically re-parented before showing
|
// 1. make keyboard a singleton, which will be dynamically re-parented before showing
|
||||||
|
@ -1081,6 +1089,11 @@ void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool n
|
||||||
numeric = numeric || QString(item->metaObject()->className()).left(7) == "SpinBox";
|
numeric = numeric || QString(item->metaObject()->className()).left(7) == "SpinBox";
|
||||||
|
|
||||||
if (item->property("keyboardRaised").isValid()) {
|
if (item->property("keyboardRaised").isValid()) {
|
||||||
|
forEachKeyboard(item, [&](QQuickItem* keyboard) {
|
||||||
|
keyboard->setProperty("mirroredText", QVariant::fromValue(QString("")));
|
||||||
|
keyboard->setProperty("password", isPasswordField);
|
||||||
|
});
|
||||||
|
|
||||||
// FIXME - HMD only: Possibly set value of "keyboardEnabled" per isHMDMode() for use in WebView.qml.
|
// FIXME - HMD only: Possibly set value of "keyboardEnabled" per isHMDMode() for use in WebView.qml.
|
||||||
if (item->property("punctuationMode").isValid()) {
|
if (item->property("punctuationMode").isValid()) {
|
||||||
item->setProperty("punctuationMode", QVariant(numeric));
|
item->setProperty("punctuationMode", QVariant(numeric));
|
||||||
|
|
Loading…
Reference in a new issue