I'm working on a well-working program which is written in wxpython. I need to rewrite it using PySide. So I need to find replacement commands in PySide.
self.tc.Bind(wx.EVT_SET_FOCUS, self.HelpMessages(field))
This is one of the problems I met. I know it means an event, when something gets the focus by a mouse click, it triggers self.HelpMessages
. But which command in PySide can get a similar effect? Similarly, is there any command that can replace the lost focus like below?
self.tc.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
Another problem I have to deal with is this one.
self.tc = wx.lib.intctrl.IntCtrl(self.parent, -1, field[con.ConfigFields.VALUE], pos=(x+220, y-3), size=(200, -1), allow_none=True)
Based on the documentation wx.lib.inctrl.IntCtrl
provides a control that takes and returns integers as value, and provides bounds support and optional value limiting.
So does PySide has a similar function?
I know these two questions are fragmentary. It's really kind of you if you can give some examples to me.
Probably the easiest approach would be to search for focus events in PyQt. PySide is just a port of PyQt, so you just need to change the imports slightly to make most examples in PyQt work for PySide. Anyway, I found the following link:
I believe all you need to do is call QMainWindow's setFocusPolicy and connect the following signal:
QObject.connect(app, SIGNAL("focusChanged(QWidget *, QWidget *)"), changedFocusSlot)
Then you should be able to detect focus events.