This commit addresses warnings that were raised by QtCreator's linter:
- IDs declared more than once
- variables declared more than once in the same scope
- type coercions
- variables declared as "var" when their type is known
- unclosed "case" in switch-case
The tooltip that is displayed when hovering over the icon specifies
which loader will be used, depending on the type of output attribute
(either the Image/2D viewer, or the 3D viewer).
When a node with viewable output attributes is loaded, the combo box of
the 2D Viewer lists these attributes. As some of these attributes are
enabled or disabled, they need to be added or removed from that list,
without needing to load another node first, or to unload the node.
This commit connects the signal that is emitted when an output attribute
with a viewable output is enabled or disabled to the slot that reloads
the currently loaded node (and thus updates the list).
The SfmStatsView and SfmGlobalStats components used to be loaded once
and for all with "Component.onCompleted". With the upgrade to Qt 5.14,
it is needed to load and explicitly unload the component (by resetting its
source) for the statistics to always be correctly displayed. Otherwise,
they can be loaded and viewed only once per session; after being shown for
the first time, they are set to null and never reloaded.
This commit uses the same type of loading/unloading as all the other
components in the 2D Viewer.
Some QML properties access exposed Python objects that may or may not
be null upon their access. When these objects are accessed while null,
QML issues "TypeError" warnings. These warnings have no functional
impact as QML correctly handles trying to access null objects, but can
spam the logs.
This commit aims at fixing all these warnings by checking that the
Python objects are not null before being accessed.
By default, when no node is selected, only "Image Gallery" is available.
It makes no sense to have the ComboBox dropping down when clicked since
there is nothing to select. If no node is loaded, the ComboBox is disabled.
If only images from the Image Gallery or from external sources are
displayed, no node is currently loaded and a "Clear node" button that
appears, although disabled, is unnecessary and might be confusing.
This commit hides it and only displays it again once it gets enabled.