Qt5 and QInputContext



  • Hello. In my Qt4 projects I'm used QInputContext class implementation to trap RequestSoftwareInputPanel event from widgets, and then send a signal to application for further action. With the release of Qt5 alpha I want to convert my Qt4 applications to Qt5, but I do not know how to convert this part of applications to Qt5 =(

    In Qt4:

    @class myInputContext : public QInputContext
    {
    Q_OBJECT
    public:
    myInputContext();
    ~myInputContext();

        bool filterEvent(const QEvent* event);
    
    signals:
        void calledSoftwareInputOpen();
        void calledSoftwareInputClose();
    

    };@

    @myInputContext::myInputContext()
    {
    }

    myInputContext::~myInputContext()
    {
    }

    bool myInputContext::filterEvent(const QEvent* event)
    {
    if (event->type() == QEvent::RequestSoftwareInputPanel) {
    emit calledSoftwareInputOpen();
    return true;
    } else if (event->type() == QEvent::CloseSoftwareInputPanel) {
    emit calledSoftwareInputClose();
    return true;
    }
    return false;
    }@

    and in main file:
    @QApplication a(argc, argv);
    myInputContext *aic = new myInputContext;
    a.setInputContext(aic);@

    How I can implement it in Qt5? Thanks.



  • Or how to use new classes QPlatformInputContext and QInputPanel. I need to add virtual keyboard support into my desktop application. In Qt4 I've used QInputContext to emit signal from widgets and then open my keyboard, but in Qt5 I don't know how to implement it =(



  • Did you ever find out anything more about this - Converting QInputContext to Qt5?



  • No =(



  • do we have any hints?



  • Hmm, we can use qt5 with maliit framework for use on-screen keyboard in our applications =) If we need custom keyboard, we can write custom plugin for maliit =)



  • I had a project using QInputContext. Now I want to port to QPlatformInputContext. How can we do with QPlatformINputContext?

    My project is pretty urgent :(



  • I don't know =((



  • Hi WeX - I'd like to try this approach 'Hmm, we can use qt5 with maliit framework for use on-screen keyboard in our applications =) If we need custom keyboard, we can write custom plugin for maliit =)'. Do you have examples for using on-screen keyboard and custom keyboard (plugin) with Maliit on Windows? Linux may be ok as well.



  • No, I haven't tried to use maliit on windows. I use linux for my projects =) You can find linux examples in maliit repository =)



  • Thanks WeX. I look over Maliit doc and find it seems Maliit keyboard need connect to Maliit server via network...Is it possible to only work with the input method in local?
    We need port input method framework onto a linux board running QT. We don't want to connect to any server.

    I used QPlatformInputContext but when I focus on a field, there is no platform event sent to our input method (in filterEvent function) to show up our keyboard. I had to call explicitly in the application code (in focusIn event of each field) to show up the keyboard, not use QPlatformInputContext. But this approach is not good because I have many fields in the application and cannot catch all events focusIn of all these fields :(. I wonder whether Maliit can do or not? It means when I focus on any field in any application in the board, I can receive an event automatically from platform/maliit to show up the keyboard?

    BTW I just look over master QT code and find there is a iBus and Maliit framework. iBus uses QPlatformInputContext and D-Bus.



  • To connect with maliit server You can use D-Bus =)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.