문제

How do I assign an accelerator that would put focus on a QTextEdit? I'm a PySide newb and I tried what worked in wxPython, which is to make a label before the text edit and give it an accelerator, however I tried doing both '&Title:' and '_Title:' but none of them gave it an accelerator of T like I wanted. How do I do that?

도움이 되었습니까?

해결책

You need to use the label's setBuddy method to get the accelerator to work:

    self.label = QtGui.QLabel('&Title:', self)
    self.textedit = QtGui.QTextEdit(self)
    self.label.setBuddy(self.textedit)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top