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. Disable custom QInputContext for single control
Forum Updated to NodeBB v4.3 + New Features

Disable custom QInputContext for single control

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 484 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.
  • D Offline
    D Offline
    DalePennington
    wrote on last edited by
    #1

    This is really a QT4 issue, but we are still using QT4 here. We have a custom input context that we assign at the application level to provide virtual keypads on the various text inputs. But for one particular input we do not want the keypad to appear.

    Looking at the API docs, there does appear to be a method to set a widget specific input context (setInputContext), but the question is what to set it to. I first thought maybe NULL, but when I look at a generic app (one which has not had a custom input context assigned), I discover it has an input context ( the "xim" context). This led me to suspect create a "xim" context using the CInputContextFactory and assigning it would be the answer, but what I not sure of is what parent do I use for the factory. Is it the widget I am assigning the context to, or something else.

    So basically, I am looking for the best method, either NULL or creating a context from the factory, and if the later, which QObject should I be using as the parent.

    Thanks,
    Dale Pennington

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

      Hi,

      Is it possible that you explain why that specific input should not have the keypad shown ?

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

      D 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Is it possible that you explain why that specific input should not have the keypad shown ?

        D Offline
        D Offline
        DalePennington
        wrote on last edited by
        #3

        @SGaist The app in general is running on a keyboardless system, so we need need virtual keyboards/keypads for most text input. However for this particular window and input, the design specified having a fixed keypad integrated into the window, and to use that for the one input widget and not display the virtual keypad.

        So at the app level, a custom input context is defined to generate the virtual keypad, and we need to suppress it when this particular widget (actually a spinbox), gets the input.

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

          Ok, I am currently not sure you can set a null input context but it's worth a try.

          I don't remember the inner working of QInputContext but I wonder if you could not have a multiple keyboard context and show the keypad at the right place in place of your normal virtual keyboard.

          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
          • D Offline
            D Offline
            DalePennington
            wrote on last edited by
            #5

            Lessons learned from this attempt

            1. Setting an inputContext to NULL has no effect. The inputContext remains on its previous value.
            2. While you can use the QInputContextFactory to create a basic inputContext and install it, since the default context does not process the RequestSoftwareInputPanel event, it eventually gets passed to the app level inputContext and gets processed by the custom inputContext anyways.

            The final fix was to modify the custom inputContext to not display the keypad is the widget in question had a custom property set to true (in this case, I used "NoKeyboard"). This did the job.

            Dale Pennington

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

              Glad you found a solution and thanks for sharing it !

              By the way, how do you "not show" the keyboard ?

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

              D 1 Reply Last reply
              0
              • SGaistS SGaist

                Glad you found a solution and thanks for sharing it !

                By the way, how do you "not show" the keyboard ?

                D Offline
                D Offline
                DalePennington
                wrote on last edited by
                #7

                @SGaist We have a custom input context, that catches the RequestSoftwareInputPanel event, and displays the appropriate virtual keyboard/keypad. All I did was add an extra check for the widget in question having the "NoKeyboard" property (a new DynamicProperty defined for this purpose in our application). In this case, it will just how show the panel.

                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