QLineEdit completion box direction
-
Hi,
Not easily, QCompleter's complete method offers a rect parameter that can be used to move the position of the popup but you can't access it directly from QLineEdit.
Out of curiosity, why do you need that ?
-
How did you integrate your keyboard in your application ?
-
Why not use Qt's input method framework for that ?
-
I found two interesting articles:
http://tolszak-dev.blogspot.com/2013/04/qplatforminputcontext-and-virtual.html
http://www.kdab.com/qt-input-method-virtual-keyboard/But in both of them is described out-of-process way of implementation.
Could You give me some hints how to integrate it with particular application?
Best regards,
Tomek -
What do you man by out of process ? The first link provides an example implementation that doesn't need any external process.
-
"For the in-process approach, the virtual keyboard becomes just another QWidget or QtQuick Item that shows the keyboard buttons, reacts to user interaction and delivers the synthesized QKeyEvents to the application’s event loop. The advantage of this approach is that it is very easy to implement, since no inter-process communication between the keyboard and the application is needed. The disadvantage, however, is that every application has to store its own instance of the virtual keyboard and the state of all these instances (visibility, activity etc.) might somehow need to be synchronized between applications.
The out-of-process approach, on the other hand, allows for a single instance of the virtual keyboard to be shared between all other applications, so no synchronization between multiple virtual keyboard instances is necessary. This requires you to come up with an inter-process communication mechanism between the global virtual keyboard instance and all the applications that want to use it."
Is any simple method to implement behaviour such on onPressEvent on input enabled widget my custom keyboard widget is deployed?
I don't want to display keyboard on onFocus event because it could be annoying for the user.
Best regards,
Tomek -
Why the onPressEvent ? It means that you should already have a keyboard active so why add a virtual keyboard ?
People are used to key a keyboard when they put focus on a widget like a line edit.
-
Because I work on a small touch screen and when keyboard is activated it is shown on almost whole screen.
Keyboard widget has own QLineEdit which configuration is based on configuration of chosen app QLineEdit(completer, validator, echo mode and etc.).If keyboard widget will be displayed right a way of gain focus sometimes it could be confusing for the user...
Is there any other way to implement such behaviour? It's not nice because currently this solution requires to use override QLineEdit objects and in future maybe others like QComboBox with enabled editing mode...
I'm open to any suggestions how to improve my approach.
Best regards,
Tomek -
Just to be sure I'm understanding you correctly: you have a QLineEdit inside your virtual keyboard ? What for ?
-
To prepare text.
It's based on this example:
http://processors.wiki.ti.com/index.php/Qt_Keyboard_TemplateThis kind of approach is determinate by small sized touch screen.
Small keyboard has small buttons .... -
How small are we talking about ?
Note that if you mix that keyboard with Qt's input framework, you're probably going to have another problem when the keyboard's line edit gets the focus.