如何獲取從小部件的mousePressEvent返回的值并將其應用于另一個小部件?這是帶有 mousePressEvent 的小部件:class Text(QTextEdit): ... def mousePressEvent(self, event): if event.button()==Qt.LeftButton: return "test"現在我想使用從事件返回的字符串并將其應用于另一個小部件:class OtherWidget(QWidget): ... self.label=QLabel() self.label.setText(???) # <=== How to put the string here? ...我怎樣才能做到這一點?我已經嘗試了以下但它不起作用。 self.label.setText(Text().mousePressEvent())
添加回答
舉報
0/150
提交
取消