Re: virtual keyboard in QT Application
Instead of taking the address of a temporary QVariant, make it a local variable and take its address.
In the second error, you are required to pass a reference to a QString. You are trying to pass the return value of a function, which is also a temporary.
Again, make a local variable, initialiize it with the result of the function and then pass the variable to the validate method.
Cheers,
_
Re: virtual keyboard in QT Application
Thanks for the pointers. I was able to fix the error messages as per your suggestion.
For example
Quote:
emit dataSet(&QVariant(ui->edValue->text()));
became
Quote:
QVariant qv = QVariant(ui->edValue->text());
emit dataSet(&qv);
But now I'm stuck on how to actually use it. I have absolutely no clue on how to incorporate that into my own app. I did a make install but neither do I know how to activate it, nor how to ensure cross platform functionality.
So I moved over to give http://qt-apps.org/content/show.php/...content=107388 a try, which was mentioned in earlier in this thread.
Would be great if you could explain/give a sample app on how to actually use such an extra inputcontext, for the total noobs :)
Re: virtual keyboard in QT Application
There is a howto on the first page of this thread
1 Attachment(s)
Re: virtual keyboard in QT Application
Quote:
Originally Posted by
srm
Hi, thanks for the update.
I'm pretty new to Qt (and to C++) and I'm having trouble using your project. Running Qt-Creator 3.3.0 and Qt5.4.
I can open your project, but compiling it yields errors.
This was running qmake && make in the project dir.
What am I doing wrong? Do you need any more information?
EDIT: running on OSX 10.10.2
Looks like signatures changed here and there in Qt 5.4,
your problem can get around easily as
QString editedText = ui->edValue->text();
if (validator->validate(editedText, pos) == QValidator::Acceptable)
I also changes dataSet(QVariant*) to plain value call dataSet(QVariant)
but my problem is that I never got the virtual keyboard working on Linux/X11/Qt 5.4.1
I compiled the library, did sudo make install so it got copied into the right plugin directory
I set the proper spellword "keyboard" property, hell, I even removed all property checks in the plugin to be sure this is not the problem.
But on my test application the virtual keyboard never appeared.
Actually I wonder how "magically" it could appear - currently I am missing some plugin activation on QLineEdit.
I attach my test project if anyone could see what is the reason of virtual keyboard not showing up...
Many thanks in advance
Jan Struhar
Re: virtual keyboard in QT Application
Hi @ all.
I've tried to use the keyboard in Qt 4. I included the InputDevice.h in my main file and created an intance of the InputDevice like you've posted it.
But every time I want to build by project it says "undefined reference to 'InputDevice::InputDevice()'".
Have I need to link something else or include on another place?
Thanks in advance.
Re: virtual keyboard in QT Application
Hi all
I hava the same problem
I cant compile my test app, it is fail in <include "inputdevice.h">
Does anyone actually succeeded to run it ??
Re: virtual keyboard in QT Application
I am using this in on an embedded arm and the compiler is telling me they cannot find <QtDesigner/QDesignerExportWidget>.
Any way either not to use this or where I can find this file?
Thanks
Re: virtual keyboard in QT Application
kovis did you try to add the plugin to your application build directory?
what to do:
* create a folder named platforminputcontexts in next to your executable
* place the plugin in this directory
* start the application
Also important is that the plugin is build in the sameway as your application (debug/release)
Re: virtual keyboard in QT Application
hi,thanks for the virtual keyboard
Re: virtual keyboard in QT Application
This looks very useful. I've been trying out the latest VIInputContext class. Any chance you can add some clarification on usage with a mainwindow widget?
I put this in my mainwindow.h
VIInputContext inputdevice;
and in the constructor I do this
ui->lineEdit->setProperty("keyboard",true);
But, I must be missing something as when I click in the lineEdit box nothing happens.
Re: virtual keyboard in QT Application
Quote:
Originally Posted by
sonulohani
OK create one keyboard and create an instance of it in your class and use it. Or simple is that create one lineedit with keyboard having pushbuttons. and connect all the push button to your lineEdit. If you want to use your keyboard in differents gui then you have to create a different class for keyboard. if you want some help in keyboard tutorial then you're welcome to query.
I have a doubt in "If you want to use your keyboard in differents gui then you have to create a different class for keyboard": for each GUI I need create another "InputDevice" or create another "keyboard"? In this case, do I need to create another "installEventFilter". I create a tested app that in mainwindow I have some qlineedit that is working fine and a button to open a new QDialog. In this dialog, I have also some qlineedit. When I select this object, the keyboard is showed but no key pressed is accepted (I believe that slot-signal is defined to mainwindow). Could you help me ?
Re: virtual keyboard in QT Application
Hello, StrikeByte.
Great thanks for you project. I used many time your keyboard for my Qt4 application. It worked nice.
But now I want to migrate my app to Qt5 and, of course, I planned to use your virtual keyboard adopted to Qt5.
But, sorry, I had epic fail((
My environment: embedded device, Qt5.4.2, X11.
I don't understand how to load plugin to app.
I used QT_DEBUG_PLUGINS=1 and I saw that plugin was found, but it's not loaded.
QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt/qt542-ti-qml/plugins/platforminputcontexts/libVirtualInput.so"
Found metadata in lib /usr/local/qt/qt542-ti-qml/plugins/platforminputcontexts/libVirtualInput.so, metadata=
{
"IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface",
"MetaData": {
"Keys": [
"virtualinput"
]
},
"className": "VIPlatformInputContextPlugin",
"debug": false,
"version": 328706
}
Got keys from plugin meta data ("virtualinput")
I tried to add DEFINES += VIRTUALINPUT_LIBRARY to .pro file.
I tried to add VIPlatformInputContextPlugin virtualKeyboard; or VIInputContext virtualKeyboard; to my main.cpp.
I saw that similar questions were above. Please give us simple project for Qt5 with your keyboard.
Thanks.
Re: virtual keyboard in QT Application
Ok. I answer to my question myself.
First: I don't know how to change input context plugins order. So I delete all other pluging from my plugins/platforminputcontexts folder. Virtual keybord plugin starts to load.
Second: I should to work under X11, not with EGLFS or LinuxFB, unfortunately( And when I pressed on QLineEdit I see nothing. But from debug output I saw that show() method is called, hide() is too. So I add | Qt::X11BypassWindowManagerHint to numpad and keyboard constructors. Also I add call raise() method after show() in both files.
Now virtual keyboard is working.
Hope it will useful.
Re: virtual keyboard in QT Application
Hi StrikeByte,
I really appreciate the work you've done with the virtual keyboard, but I notice you haven't added a license to the code. I hope this can be placed in the public doman (so anyone can use it for anything, even relicensing) or LGPL, so it can be used in projects using a LGPL licensed Qt.
Thanks,
Henrik
Re: virtual keyboard in QT Application
Hey HenrikSkott,
You can do with it whatever you want.
I havn't used this keyboard for a while, but it seems Qt has changed something in the platforminputcontext loader
if you want to use it you need to add this to your main
qputenv("QT_IM_MODULE", QByteArray("virtualinput"));
Re: virtual keyboard in QT Application
I just created a project on github based on StrikeByte's code. https://github.com/mazj/VirtualInput