How to implement an overlay window with a textfield?
I want to provide an interactive overlay that can be shown in any situation except for the lock screen. I tested successfully the solution approach of @coderus in the following projects:
Unfortunately, the virtual keyboard in not shown for a TextField
or TextArea
in an overlay. I think this is because of the notification layer, that's maybe above the layer of the keyboard. Here is the related code snipped of the viewhelper.cpp class:
overlayView->create();
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
native->setWindowProperty(overlayView->handle(), QLatin1String("CATEGORY"), "notification");
I also get this warning in the log file. I assume it is caused by the TextArea
qml type:
[W] unknown:136 - file:///usr/lib/qt5/qml/Sailfish/Silica/private/TextBase.qml:136: ReferenceError: __silica_applicationwindow_instance is not defined
I found a workaround for a demonstrator, unfortunately not for something, that I could release. Sailfish OS uses something similar for VPN settings. If the system assumes, that the user credentials become invalid, an overlay pop ups to re-enter correct ones. I couldn't find any qml file for this use case. I had a look at /usr/share/jolla-settings/pages/vpn
on my developer device. I can find four qml files, which doesn't include that overlay. Maybe it's part of the compiled code? I would welcome any suggestions or even solutions.
By the way, the hierarchy of my overlay is the following:
Item {
id: root
...
Rectangle {
id: panel
...
SilicaFlickable {
...
Column {
...
TextField {
...
}
}
}
}
I could also use a TextAres
, but the behaviour is the same.
The same problem was found in quickbar when implementing the search functionality(keyboard not displayed from notification layer); as a text box couldnt be used, the way it was solved was to present a spinner with the alphabet from which the user could pick letters. Im not sure it being "just" a matter of layers, tho, as notification layers do not expect to have (text) input (iirc somewhere in the open lipstick codebase it's mentioned) - but I might have understood it wrong :)
tortoisedoc ( 2019-06-22 20:23:41 +0200 )editDid you have a look at the files in /usr/share/lipstick-jolla-home-qt5/connectivity? I think the files for WLan and VPN settings popups are there, but I don't know, if that can help you.
KuroNeko ( 2019-06-22 22:05:03 +0200 )edit@KuroNeco Great idea. Here is, what I found. Jolla seems to be making some effort to display this dialog.
The VpnAgent.qml is a
SystemWindow
, that is defined for the system UI of Sailfish OS. The SystemWindow itself is aFocusScope
, a standard QtQuick type to support keyboard input:The VpnAgent.qml seems like quite a hack with a fake window:
Furthermore the VpnAgent.qml contains a lot of propretiary stuff:
At least, the element contains a
SystemDialogLayout
and aSilicaFlicable
}
I tried a different, easy aprroach to show a
Window
, that is pure QtQuick QML type. Surprisingly, I get the following error:Sailfish apps should be able to use basic QML types, shouldn't they?
jsommer ( 2019-06-23 15:41:03 +0200 )edit