I have qml button file that I want to be visible above the keyboard when the keyboard is visible.
I just want to know what I should do with my QmlApplicationViewer so that my small qml block is always visible on top of all other applications but you should still have access to the application below.
I have already implemented a way for the file to become visible when the keyboard is visible and I can easily get it right above the keyboard later but now I am struggling to prevent it from stealing focus and closing the keyboard, because the moment a keyboard is opened my button appears and the keyboard closes. The moment I close my app the button disappears and the keyboard reopens in the app where I originally opened it. I want this to be a background task which supplements the keyboard functionality, the button will allow for speech input.
main.qml:
import QtQuick 1.1
import com.nokia.symbian 1.1
Button{
signal keyActive()
x: 0
y: 0
text: "Voice"
property bool bob: inputContext.visible
onBobChanged: console.log("keyboard" + bob), bob ? keyActive() : null
}
import QtQuick 1.1
import com.nokia.symbian 1.1
Button{
signal keyActive()
x: 0
y: 0
text: "Voice"
property bool bob: inputContext.visible
onBobChanged: console.log("keyboard" + bob), bob ? keyActive() : null
}
To copy to clipboard, switch view to plain text mode
main.cpp:
#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include <QObject>
#include <QGraphicsObject>
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QmlApplicationViewer viewer;
viewer.setWindowFlags(Qt::WindowStaysOnTopHint);
viewer.setAttribute(Qt::WA_ShowWithoutActivating);
viewer.move(10, 20);
viewer.releaseKeyboard();
viewer.show();
QObject *rootObject
= viewer.
rootObject();
QObject::connect(rootObject,
SIGNAL(keyActive
()),
&viewer,
SLOT(raise()));
return app.exec();
}
#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include <QObject>
#include <QGraphicsObject>
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QmlApplicationViewer viewer;
viewer.setMainQmlFile(QLatin1String("qml/topwidget/main.qml"));
viewer.setWindowFlags(Qt::WindowStaysOnTopHint);
viewer.setAttribute(Qt::WA_ShowWithoutActivating);
viewer.move(10, 20);
viewer.releaseKeyboard();
viewer.show();
QObject *rootObject = viewer.rootObject();
QObject::connect(rootObject, SIGNAL(keyActive()), &viewer, SLOT(raise()));
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks