Question

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?

Était-ce utile?

La solution

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)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top