This is really similar to your last question about wheel events.
Have you tried anything yet like catching keyPress events? Calling
setFocus() on your text edit? Trying grabKeyboard()?
 On Jul 21, 2013 2:22 PM, "iMath" <[email protected]> wrote:

> when the QTextEdit doesn’t have focus ,how to redirect keyboard events to
> the text editor ?
> as This saves the user from clicking the text editor before entering text,
> making the application more user-friendly.
>
> import sys
> from PyQt4.QtGui import *
> from PyQt4.QtCore import *
> class BoxLayout(QWidget):
>     def __init__(self, parent=None):
>         super(BoxLayout, self).__init__(parent)
> #        self.resize(100, 300)
>
>         ok = QPushButton("OK")
>         cancel = QPushButton("Cancel")
>         self.textEdit = QTextEdit()
>         vbox = QVBoxLayout()
>         vbox.addWidget(self.textEdit)
>         vbox.addWidget(ok)
>         vbox.addWidget(cancel)
>         self.setLayout(vbox)
>
>
> app = QApplication(sys.argv)
> qb = BoxLayout()
> qb.show()
> sys.exit(app.exec_())
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to