I have the following minimal example with a button that triggers a dialog with a text area. The virtualkeyboard is showing up correctly on the screen but the buttons are not clickable
import os
import os
from PySide6.QtWidgets import QApplication, QMainWindow, QTextEdit
from PySide6.QtWidgets import QVBoxLayout, QDialog, QPushButton
def trigger():
dlg = QDialog()
text_edit = QTextEdit()
layout = QVBoxLayout()
layout.addWidget(text_edit)
dlg.setLayout(layout)
dlg.exec()
os.environ["QT_IM_MODULE"] = "qtvirtualkeyboard"
app = QApplication([])
btn = QPushButton('Trigger')
btn.clicked.connect(lambda: trigger())
window = QMainWindow()
window.setCentralWidget(btn)
window.show()
app.exec()
If I remove the dialog and set the QTextArea
directly to the QMainWindow
it works just fine. Anyone knows how to get it to work?
Opening the dialog with exec
will block, so you should use open
instead. This may mean you need to keep a reference to the dialog, since open
returns immediately.