示例#1
0
 bool eventFilter(QObject *obj, QEvent *event) {
     QInputContext *ic = qApp->inputContext();
     if (ic) {
         if (ic->focusWidget() == 0 && prevFocusWidget) {
             QEvent closeSIPEvent(QEvent::CloseSoftwareInputPanel);
             ic->filterEvent(&closeSIPEvent);
         } else if (prevFocusWidget == 0 && ic->focusWidget()) {
             QEvent openSIPEvent(QEvent::RequestSoftwareInputPanel);
             ic->filterEvent(&openSIPEvent);
         }
         prevFocusWidget = ic->focusWidget();
     }
     return QObject::eventFilter(obj,event);
 }
void HbInputAbstractMethod::focusReceived()
{
    bool isVannilaApp = false;
    QInputContext* context = qApp->inputContext();
    if (context && context->focusWidget()) {
        QWidget *focusedWidget = context->focusWidget();
        if (!focusedWidget->inherits("HbMainWindow")) {
            isVannilaApp = true;
        }
    }
    
    if(isVannilaApp && focusObject() ) {
        QList<HbAction*> customActions= focusObject()->editorInterface().actions();
        if(!customActions.contains(mVanillQwertySwitch)) {
            disconnect(mVanillQwertySwitch, SIGNAL(triggered(bool)));
            connect(mVanillQwertySwitch, SIGNAL(triggered(bool)), this, SLOT(switchKeypad(bool)));
            focusObject()->editorInterface().addAction(mVanillQwertySwitch);
        }
示例#3
0
void QMultiInputContext::changeSlave(QAction *a)
{
    for (int i = 0; i < slaves.size(); ++i) {
        if (keys.at(i) == a->data().toString()) {
            if (slaves.at(i) == 0)
                slaves.replace(i, QInputContextFactory::create(keys.at(i), this));
            QInputContext *qic = slaves.at(current);
            QWidget *oldWidget = qic->focusWidget();
            qic->reset();
            qic->setFocusWidget(0);
            current = i;
            qic = slaves.at(current);
            qic->setFocusWidget(oldWidget);
            return;
        }
    }
}