Androidでアプリを実行すると、編集フィールドがわずかに(QLineEdit
)、QDialogButtonBox
のQDialog
になります。ユーザーがQLineEdit
のテキストを入力し、アンドロイドの仮想キーボードから「OK」ボタンを押すと、ユーザーは現在選択されている編集にテキストをコミットすることを期待している間にダイアログを受け入れます(QDialogButtonBox
で「OK」をクリックしたように)フィールド、彼は次の1 ...Androidキーボードの「OK」ボタンがQDialogを受け入れないようにする方法
サンプル・プログラムに移動できるように:
box->button(QDialogButtonBox::Ok)->setAutoDefault(false);
box->button(QDialogButtonBox::Ok)->setDefault(false);
が、それは解決しない:
#include <QApplication>
#include <QDialog>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
#include <QLineEdit>
class MyDialog : public QDialog
{
public:
MyDialog()
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(new QLineEdit(this));
layout->addWidget(new QLineEdit(this));
QDialogButtonBox* box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
connect(box, SIGNAL(accepted()), this, SLOT(accept()));
connect(box, SIGNAL(rejected()), this, SLOT(reject()));
layout->addWidget(box);
}
};
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
MyDialog dlg;
dlg.show();
return app.exec();
}
私が使用してOKボタンのデフォルトの動作を変更しようとしました問題。私は本当にQtバグ(reported it)である可能性が高いこれに固執しています。
どのように回避策を講じることができますか?
私は多くのダイアログで問題があることを考えると、私はほとんどないであろういくつかの標準的なボタンでQDialogButtonBox
を交換し、(私はQDialog
かQDialogButtonBox
...に接続することができヘルパークラスのような)一般的な解決策が欲しいです受け入れ可能な解決策は...