Domanda

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?

È stato utile?

Soluzione

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)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top