Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Using QCompleter with a virtual keypad
Forum Updated to NodeBB v4.3 + New Features

Using QCompleter with a virtual keypad

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
7 Posts 3 Posters 1.2k Views 3 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.
  • N Offline
    N Offline
    NCDeveloper
    wrote on last edited by
    #1

    The behavior of QCompleter is preventing me from using it with the virtual keypad I have created. When the QCompleter's popup is showing, a press on the keypad closes the completer, and a second press is required to enter a character. Is there any way to change the behavior of the completer so that clicks outside of the popup window are ignored?

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

      Hi and welcome to devnet,

      How are you using it exactly ?

      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
      • N Offline
        N Offline
        NCDeveloper
        wrote on last edited by
        #3

        I'm using it with a QLineEdit in PopupCompletion mode. Next to the QLineEdit I have a button that forces the popup to show with all possible completions. The button part of it was the functionality I was really after. The fact that it pops up while the user is typing would be a nice touch if it worked correctly, but it's not a requirement I have.

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

          How are you implementing your virtual keypad ?

          This article might be interest for a more integrated solution.

          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
          2
          • N Offline
            N Offline
            NCDeveloper
            wrote on last edited by
            #5

            I'm not sure how a re-implementation of my keypad will solve the issue with the completer popup.

            mrjjM 1 Reply Last reply
            0
            • N NCDeveloper

              I'm not sure how a re-implementation of my keypad will solve the issue with the completer popup.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @NCDeveloper

              if your goal is to just make it stay open, you can do the following

              class openCompleter : public QCompleter {
                Q_OBJECT
               public:
                openCompleter(QObject* parent) : QCompleter(parent) {}
                virtual ~openCompleter() override {}
               protected:
                bool eventFilter(QObject* o, QEvent* e) override {   
                  if ( e->type() == QEvent::Type::MouseButtonPress) {
                      qDebug() << " event is hide: " << o->metaObject()->className();
                      return false;
                  }
                  return QCompleter::eventFilter(o, e);
                }
              };
              
              

              and just use openCompleter and not QCompleter.
              However, you will need some way for user to cancel the popup then.

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

                I don't know how you implemented your virtual keypad, the article I linked to proposes an implementation that integrates directly with Qt's input system.

                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
                1

                • Login

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