
xavier.hervy at bluebottle
Nov 23, 2008, 3:43 AM
Post #1 of 2
(988 views)
Permalink
|
|
keypressEvent improvement: Add actionEvent in mythuitype class
|
|
Hi, I would like to modify keypressEvent in mythui to make use of a new public method "actionEvent" in mythuitype as below : virtual bool keyPressEvent(QKeyEvent *); Here is a example of implementation with mythuibutton: bool MythUIButton::actionEvent(QString action) { if (action == "SELECT") { if (!IsEnabled()) return false; if (m_Pushed) UnPush(); else Push(); } else handled = false; } bool MythUIButton::keyPressEvent(QKeyEvent *e) { QStringList actions; bool handled = false; GetMythMainWindow()->TranslateKeyPress("Global", e, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; handled = actionEvent(action); } return handled; } This would allow the network protocol to use action instead of key to send command to the frontend, preventing to break any client using the network control protocol when the default key binding is modified by the user. The telnet interface could easily implement : action SELECT to send an action to the frontend. This is a minor change but on a lot of file which is why I like to have a feedback before doing any patch (especially from stuart). Regqrds, Xavier _______________________________________________ mythtv-dev mailing list mythtv-dev [at] mythtv http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
|