Windows 禁用日语QLineEdit密码字段中的预测文本

Windows 禁用日语QLineEdit密码字段中的预测文本,windows,qt,Windows,Qt,我有一个小的Qt代码,我们从用户那里获得密码 现在,当我在密码框中键入文本时,它开始预测文本。这只发生在日语操作系统中,而不是英语操作系统中 如何禁用文本预测? 它还显示密码字段中的文本 代码 #include <QCoreApplication> #include <QApplication> #include <QMainWindow> #include <QLineEdit> #include <QHBoxLayout> in

我有一个小的Qt代码,我们从用户那里获得密码

现在,当我在密码框中键入文本时,它开始预测文本。这只发生在日语操作系统中,而不是英语操作系统中

如何禁用文本预测? 它还显示密码字段中的文本

代码

#include <QCoreApplication>
#include <QApplication>
#include <QMainWindow>
#include <QLineEdit>
#include <QHBoxLayout>

int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    QMainWindow *window = new QMainWindow();

        window->setWindowTitle(QString::fromUtf8("QLineEdit Password Style"));
        window->resize(336, 227);

        QWidget *centralWidget = new QWidget(window);
    QHBoxLayout *layout = new QHBoxLayout();

    centralWidget->setLayout(layout);
    QLineEdit *lineEdit = new QLineEdit(centralWidget);

    //Set QLineEdit Echo Mode Here so that
    //asterisks will be shown when values are entered
    lineEdit->setEchoMode(QLineEdit::Password);
    lineEdit->setInputMethodHints(Qt::ImhHiddenText| Qt::ImhNoPredictiveText|Qt::ImhNoAutoUppercase);
    //lineEdit->setAttribute( Qt::WA_InputMethodTransparent, true );


    //Add to horizontal layout to center qLineEdit
    layout->addWidget(lineEdit);
    lineEdit->setFixedSize(300, 20);

    window->setCentralWidget(centralWidget);

    window->show();
    return app.exec();
}
#包括
#包括
#包括
#包括
#包括
int main(int argc,字符**argv)
{
QApplication应用程序(argc、argv);
QMainWindow*window=新的QMainWindow();
窗口->设置窗口标题(QString::fromUtf8(“QLineEdit密码样式”);
窗口->调整大小(336227);
QWidget*centralWidget=新的QWidget(窗口);
QHBoxLayout*布局=新的QHBoxLayout();
centralWidget->setLayout(布局);
QLineEdit*lineEdit=新的QLineEdit(centralWidget);
//在此处设置QLineEdit回显模式,以便
//输入值时将显示星号
lineEdit->setEchoMode(QLineEdit::Password);
lineEdit->setInputMethodHits(Qt::ImhHiddenText | Qt::ImhNoPredictiveText | Qt::ImhNoAutoUppercase);
//lineEdit->setAttribute(Qt::WA_InputMethodTransparent,true);
//添加到水平布局到中心qLineEdit
布局->添加小部件(lineEdit);
lineEdit->setFixedSize(300,20);
窗口->设置中心Widget(中心Widget);
窗口->显示();
返回app.exec();
}

编码格式是什么?我建议您使用utf-8样式保存文件。我没有应用任何显式编码。问题在于textbox,它为我输入的任何文本提供建议。编码格式是什么?我建议您使用utf-8样式保存文件。我没有应用任何显式编码。问题在于textbox,它为我输入的任何文本提供建议。