• 3736阅读
  • 2回复

[提问]QTE输入法在模式对话框中如何使用? [复制链接]

上一主题 下一主题
离线boymaster
 

只看楼主 倒序阅读 楼主  发表于: 2012-03-22
在QTE上写了一个软键盘输入法,应用程序中QDialog窗体以exec方式打开后,焦点无法切换到输入法
输入法 windowFlags fl = Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool

const QApplication::Type type = a.type();
if (QApplication::GuiServer == type) {
    IMFrame::installInputMethod();
}
Base base;
base.show();    // 以非模态方式打开窗口,输入法可以正常使用
//base.exec();   // 以模态方式打开窗口,输入法无法使用,控件无法得到焦点
//
int ret = a.exec();
if (QApplication::GuiServer == type) {
   IMFrame::releaseInputMethod();
}
return ret;
离线boymaster

只看该作者 1楼 发表于: 2012-03-22
现在只能使用非模态方式打开界面
还特地重写了一个函数:
void QMyDialog::openModal()
{
    this->open();

    QEventLoop eventLoop;
    connect(this, SIGNAL(finished(int)),&eventLoop, SLOT(quit()));
    eventLoop.exec();

    return this->result();
}
离线boymaster

只看该作者 2楼 发表于: 2012-03-22
自己顶一下
快速回复
限100 字节
 
上一个 下一个