Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Custom Input Method

    General and Desktop
    2
    10
    2337
    Loading More Posts
    • 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
      deu439 last edited by

      Hello,
      I would like to create a custom input method for applications that use the Qt for gui.
      What I have learned so far is that I have to subclass the QInputContext (in QT4) and I found this example http://qt-project.org/doc/qt-4.8/tools-inputpanel.html which kind of helps. But is it possible to make other applications use this custom input context without altering the source code?
      Thanks for any replies.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        AFAIK yes, this will require you to create a QInputContextPlugin and then store that plugin in the proper places so Qt can load it.

        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 Reply Quote 0
        • D
          deu439 last edited by

          Thank you, but how do I make all the desktop applications build on Qt use this plugin and the input context it represents?

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Can you describe your use case with OS and Qt version ?

            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 Reply Quote 0
            • D
              deu439 last edited by

              Well I would like to create input method that would automatically substitute abbreviated words with full lenght words. It should work as implementation of "zavpis" which is a system of abbreviations developed for quicker keyboard input in the czech language.
              OS: Slackware 14.0
              Qt 4.8.2

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                Then you can install the plugin in your distribution Qt's and all application will use it

                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 Reply Quote 0
                • D
                  deu439 last edited by

                  So I have built a simple input context plugin and put it into QT4DIR/plugins/inputmethods
                  How do I find out if qt has loaded the plugin? I cant get any application use this plugin. Cant find any qt setting which would make it use this plugin.

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    start your application with the environment variable: QT_DEBUG_PLUGINS=1 to see what is happening with the plugins

                    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 Reply Quote 0
                    • D
                      deu439 last edited by

                      Oh thank you for your patience, QT_DEBUG_PLUGINS=1 revealed that the applications look for implementation of reset() method in the QInputContext subclass which they didnt find. So I just put there simple void reset(){} and it works fine now.
                      Anyway I think there is a little gap in the documentation as I never read anywhere that the input method plugins would get loaded in any application that has an input widget. I was near thinking that only implementation of XIM protocol would meet my requirements.

                      1 Reply Last reply Reply Quote 0
                      • SGaist
                        SGaist Lifetime Qt Champion last edited by

                        Something strange here, reset is a pure virtual function, so to build your QInputContext inherited class you should have implemented this method.

                        Did you read the "Plugin Classes" page in the documentation ? Might contain more information.

                        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 Reply Quote 0
                        • First post
                          Last post