Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLineEdit completion box direction

QLineEdit completion box direction

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlineeditcompletion box
15 Posts 2 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kaluss
    wrote on last edited by
    #1

    Hi,
    does abybody know if is possible to chenge direction of completion box?

    By default the completion box is show bellow QLineEdit, but I need to diplay it above.

    Will be gratefull for any hints.

    BR
    Tomek

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kaluss
        wrote on last edited by
        #3

        I got self implemented virtual keyboard with QLineEdit on top and when Im typing the completions show up on my buttons...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          How did you integrate your keyboard in your application ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kaluss
            wrote on last edited by
            #5

            I override QLineEdit class and add special behavior for QLineEdit::mousePressEvent(QMouseEvent *event)

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Why not use Qt's input method framework for that ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • K Offline
                K Offline
                Kaluss
                wrote on last edited by
                #7

                Hmm, maybe because I didn't heard about that till now :)
                I will check it. Any hints where to start?

                Best regards,
                Tomek

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  Kaluss
                  wrote on last edited by Kaluss
                  #8

                  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

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    What do you man by out of process ? The first link provides an example implementation that doesn't need any external process.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      Kaluss
                      wrote on last edited by
                      #10

                      "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

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        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.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          Kaluss
                          wrote on last edited by
                          #12

                          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

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Just to be sure I'm understanding you correctly: you have a QLineEdit inside your virtual keyboard ? What for ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              Kaluss
                              wrote on last edited by
                              #14

                              To prepare text.

                              It's based on this example:
                              http://processors.wiki.ti.com/index.php/Qt_Keyboard_Template

                              This kind of approach is determinate by small sized touch screen.
                              Small keyboard has small buttons ....

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                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.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved