I started to work on an experimental branch to try to get ride of all
QAction dependencies in the core of stellarium. This is something that
we could eventually merge in the simplegles-qml branch (the Qt5 branch).
The rational to remove QAction is that in Qt5 they are not part of
QtCore, but QtWidget, and they don't interact well with qml.
List of changes (sorry for the long mail):
- There is a new class StelAction, that behaves like a qt QAction, with
the ability to handle secondary shortcuts. This class replaces the
current use of QAction and StelShortcut.
- All the StelAction are registered and connected by modules during
initialization. This is different from the current code where the
actions are first created from the default_shortcut.json file, and then
connected to the proper QObject slot during the gui and plugins
- To simplify the code, I added a method of StelModule that creates a new
StelAction and automatically connects it to an object slot or property.
The interesting thing is that using Qt class introspection, we can
directly decide if the action is checkable or not. Plus, when an
action is linked to a Qt property that defines a signal handler, the
change in the property will automatically change the state of the
StelAction. I think this has the potential to fix a few tricky issues
with the synchronisation of GUI buttons and module states.
- StelAction are identified by the action id only, and not by the group
id as it is currently the case. The group id is now only used to sort
the actions in the shortcut editor. This makes the code much simpler,
the drawback is that we have to ensure that all actions have unique
names, but that can be enforced at runtime.
- This is not implemented yet, but I am thinking of replacing the json
file to store the redefined shortcut, by a much simpler ini file (or
even just as a '[shortcuts'] usection in config.ini). It could simply
be a list of <action-name> =
- I am also thinking of giving each script a default action name (for
example "actionScript/landscapes.ssc"), that way we can also redefine
their shortcut shortcuts in the .ini file with the same syntax.
I am still working on the branch, but I'd like your input on those changes.
This is the branch simplegles-qml-noqaction on launchpad.