Adam Sirrelle
Adam Sirrelle

Reputation: 397

Setting windowFlags to Popup disables windows IME language options

I have the following dialog widget, which is opened from another main widget.

class PopupDialog(QtWidgets.QDialog):
    def __init__(self, *args, **kwrgs):
        super(PopupDialog, self).__init__(*args, **kwargs)

        self.setWindowFlags(QtCore.Qt.Popup)
        
        self.line_edit = QtWidgets.QLineEdit(self)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.addWidget(self.line_edit)

It opens as a popup, and when you click outside the widget it closes itself.

My problem is, when the window flags are set to Popup I am no longer able to change languages through Window's IME options while using the Line Edit. It locks me in English.

I can copy/paste Japanese katakana/kanji into the Line Edit, but am unable to write it in directly.

Setting a variety of different window flags allows me to use IME, but then I always end up losing the functionality of a Popup, and am no longer able to click outside the widget to close it.

I have tried setting:

self.setAttribute(QtCore.Qt.WA_InputMethodEnabled, True)

But this doesn't fix the issue.

Upvotes: 0

Views: 144

Answers (0)

Related Questions