0
私は、QGraphicsItemを使用して開発したい入力ボックスの最小の実例を作成しました。ここでは、コード(私は.Hは必要ありません把握と思います)です:Android用Qtを使用しているときにアンドロイドキーボードを表示するにはどうすればよいですか?
TestEditor::TestEditor()
{
text = "";
boundingBox = QRectF(0,0,200,100);
}
QRectF TestEditor::boundingRect() const{
return boundingBox;
}
void TestEditor::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){
painter->setBrush(QBrush(Qt::gray));
painter->drawRect(boundingBox);
painter->setBrush(QBrush(Qt::black));
painter->drawText(boundingBox,text);
}
void TestEditor::keyReleaseEvent(QKeyEvent *event){
qDebug() << "Aca toy";
text = text + event->text();
update();
}
私のテスターのアプリケーションでは、単にそれをテストするためにビューのグラフィックスに追加されます。
TestEditor *editor = new TestEditor();
editor->setText("Algo de texto como para empezar");
editor->setFlag(QGraphicsItem::ItemAcceptsInputMethod,true);
editor->setFlag(QGraphicsItem::ItemIsFocusable,true);
editor->setFlag(QGraphicsItem::ItemIsSelectable,true);
ui->gvScreen->scene()->addItem(editor);
私はこれをテストする場合私のPC上では正常に動作します。アンドロイド用にコンパイルすると、キーボードが表示されないので、試してみることはできません。キーボードを強制的に表示するにはどうしたらいいですか?