سؤال

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