On Tuesday wk27 2012 July 03 09:36:26 AM ext Anselmo L. S. Melo wrote: > Hi, > > On 07/03/2012 05:06 AM, Davide Bettio wrote: > > Hello, > > > > I've noticed that QAction hasn't been moved from QtWidgets module to > > QtGui module, it would be really good if also that module gets moved > > there. > > QAction require QWidget for few things but I think that it is possible > > to solve this problem easily.
How would you suggest solving it? QAction does have stuff like bool showStatusText(QWidget *widget=0); QWidget *parentWidget() const; QList<QWidget *> associatedWidgets() const; friend class QWidget; so it seems difficult to make it avoid depending on widgets without breaking API compatibility, which is why I figured we would need a separate Qt Quick action class. Do you have any better ideas? If we could somehow use the same class for both, maybe it would be possible to build UIs partially in Qt Quick and partially with widgets. > It was discussed a few months ago, but at that time the decision was to not > move QAction to QtGui. Unless this position has changed (as example of what > happened to QIcon), there is a version of QAction without the QWidget > dependency, in UiHelpers (http://qt-project.org/wiki/Qt-5-Ui-Helpers). The > destiny of this "new version" still not defined. > > Last week, Shawn Rutledge sent an e-mail to the qt-components list about > updating this stripped version of QAction so it could be used by the > desktop components. I think it's a good idea to check the status with him. Yes I was still thinking of merging the one from UiHelpers, with some improvements, and then working on making it useful in Desktop Components. (But instead I've been working on multipoint-touch support some more, the last couple of days.) The open issues I can think of are * it needs to be possible to specify an icon with some kind of QML syntax (different pixmaps for different sizes) * desktop components needs a mechanism to handle keyboard shortcuts * need to make sure it's possible to create an action just once, but add it to multiple menus/toolbars/etc. * need to associate a handler to do the actual work when the action is executed * the undo/redo mechanism in UiHelpers doesn't have any connection with actions, rather it uses separate command objects. But that makes sense in that actions are supposed to be single-instance objects; if you store the same pointer repeatedly on the undo stack, you won't be able to store any related state along with it, so probably there needs to be a separate instance of something each time the action is executed. Maybe the action could at least act as a factory for the commands and push them on the undo stack automatically? -- MVH, Shawn Rutledge ❖ "ecloud" on IRC _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development