嵌入目标上返回NULL的QtInputContextFactory

嵌入目标上返回NULL的QtInputContextFactory,qt,qt-creator,qml,embedded-linux,qtembedded,Qt,Qt Creator,Qml,Embedded Linux,Qtembedded,在我的嵌入式系统上,我没有X11、Mac、Win、S60等。我一直从QInputContextFactory类的create方法返回一个NULL(0)指针。我验证了QT_NO_库未定义 在我的桌面上,Qt Build可以正常工作 我还验证了我的自定义密钥和父级是否正在传递给该方法 什么会导致此失败?--> if(QInputContextFactoryInterface*工厂= qobject_cast(加载程序()->实例(键))){ 结果=工厂->创建(键); } 以下是整个方法: QIn

在我的嵌入式系统上,我没有X11、Mac、Win、S60等。我一直从QInputContextFactory类的create方法返回一个NULL(0)指针。我验证了QT_NO_库未定义

在我的桌面上,Qt Build可以正常工作

我还验证了我的自定义密钥和父级是否正在传递给该方法

什么会导致此失败?-->

if(QInputContextFactoryInterface*工厂=
qobject_cast(加载程序()->实例(键))){
结果=工厂->创建(键);
}
以下是整个方法:

QInputContext *QInputContextFactory::create( const QString& key, QObject *parent )
{
    QInputContext *result = 0;
#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
    if (key == QLatin1String("xim")) {
        result = new QXIMInputContext;
    }
#endif
#if defined(Q_WS_WIN)
    if (key == QLatin1String("win")) {
        result = new QWinInputContext;
    }
#endif
#if defined(Q_WS_MAC)
    if (key == QLatin1String("mac")) {
        result = new QMacInputContext;
    }
#endif
#if defined(Q_WS_S60)
    if (key == QLatin1String("coefep")) {
        result = new QCoeFepInputContext;
    }
#endif
#ifdef QT_NO_LIBRARY
    Q_UNUSED(key);
#else
    qDebug() << "Here we are";
    if (QInputContextFactoryInterface *factory =
        qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key))) {
        result = factory->create(key);
    }
#endif
    if (result)
        result->setParent(parent);
    return result;
}
QInputContext*QInputContextFactory::create(常量QString&key,QObject*parent)
{
QInputContext*结果=0;
#如果已定义(Q_WS_X11)和&!已定义(QT_NO_XIM)
if(key==QLatin1String(“xim”)){
结果=新的QXIInputContext;
}
#恩迪夫
#如果已定义(Q_WS_WIN)
if(key==QLatin1String(“win”)){
结果=新的QWinInputContext;
}
#恩迪夫
#如果已定义(Q_WS_MAC)
if(key==QLatin1String(“mac”)){
结果=新上下文;
}
#恩迪夫
#如果已定义(Q_WS_S60)
if(key==QLatin1String(“coefep”)){
结果=新的QCoeFepInputContext;
}
#恩迪夫
#ifdef QT_NO_库
Q_未使用(键);
#否则
qDebug()实例(键))){
结果=工厂->创建(键);
}
#恩迪夫
如果(结果)
结果->设置父对象(父对象);
返回结果;
}

在Qt中,
QInputContextFactory
类是加载输入上下文插件的前端。如果输入上下文插件不存在或未正确部署,它将无法加载该插件。输入上下文插件通常存储在
$QT\u PLUGIN\u PATH/inputmethods
下。因此,如果该目录中没有插件,则
QInputContextFactory
create
方法将返回NULL

值得注意的是,Qt确实提供了一些机制来定制插件的位置。有关这方面的详细信息,请参阅以下内容:


您是否有有效的输入上下文插件?当你运行你的应用程序时,这个插件需要在$QT\u PLUGIN\u PATH/inputmethods下可用。。。谢谢,这很有效。我已经在这上面呆了一段时间了。请回答下面的问题,我将投票支持你的答案。
QInputContext *QInputContextFactory::create( const QString& key, QObject *parent )
{
    QInputContext *result = 0;
#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
    if (key == QLatin1String("xim")) {
        result = new QXIMInputContext;
    }
#endif
#if defined(Q_WS_WIN)
    if (key == QLatin1String("win")) {
        result = new QWinInputContext;
    }
#endif
#if defined(Q_WS_MAC)
    if (key == QLatin1String("mac")) {
        result = new QMacInputContext;
    }
#endif
#if defined(Q_WS_S60)
    if (key == QLatin1String("coefep")) {
        result = new QCoeFepInputContext;
    }
#endif
#ifdef QT_NO_LIBRARY
    Q_UNUSED(key);
#else
    qDebug() << "Here we are";
    if (QInputContextFactoryInterface *factory =
        qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key))) {
        result = factory->create(key);
    }
#endif
    if (result)
        result->setParent(parent);
    return result;
}