我需要的是非常相似的 QtMessageBox.information 方法,但我需要它形成我的自定义窗口。
我需要一个带有少量标签的窗口,一个 QtTreeViewWidget,一个 QButtonGroup……这个窗口将从主窗口调用。如果我们将实现称为窗口的类称为 SelectionWindow,那么我需要的是:
class MainWindow(QtGui.QMainWindow):
...
def method2(self):
selWin = SelectionWindow()
tempSelectionValue = selWin.getSelection()
# Blocked until return from getSelection
self.method1(tempSelectionValue)
...
class SelectionWindow(QtGui.QMainWindow):
...
def getSelection(self):
...
return selectedRow
...
来自 SelectionWindow 的方法 getSelection 应该会弹出选择窗口,并在最后返回 QTreeViewWidget 中选择的行。我希望主窗口保持阻塞状态,直到用户在选择窗口中选择一行并通过按钮确认。我希望你能理解我的需要。
我将不胜感激任何帮助!
谢谢,蒂霍