Skip to content

Commit

Permalink
Add example OpenGL view default point opacity global setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasKroes committed Jan 22, 2024
1 parent fe57ff3 commit 2704c56
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ExampleViewOpenGL/src/GlobalSettingsAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ using namespace mv::gui;

GlobalSettingsAction::GlobalSettingsAction(QObject* parent, const plugin::PluginFactory* pluginFactory) :
PluginGlobalSettingsGroupAction(parent, pluginFactory),
_defaultPointSizeAction(this, "Default point Size", 1, 50, 10)
_defaultPointSizeAction(this, "Default point Size", 1, 50, 10),
_defaultPointOpacityAction(this, "Default point opacity", 0.f, 1.f, 0.5f)
{
_defaultPointSizeAction.setToolTip("Default size of individual points");
_defaultPointOpacityAction.setToolTip("Default opacity of individual points");

// The add action automatically assigns a settings prefix to _pointSizeAction so there is no need to do this manually
addAction(&_defaultPointSizeAction);
addAction(&_defaultPointOpacityAction);
}
4 changes: 3 additions & 1 deletion ExampleViewOpenGL/src/GlobalSettingsAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class GlobalSettingsAction : public mv::gui::PluginGlobalSettingsGroupAction
public: // Action getters

mv::gui::DecimalAction& getDefaultPointSizeAction() { return _defaultPointSizeAction; }
mv::gui::DecimalAction& getDefaultPointOpacityAction() { return _defaultPointOpacityAction; }

private:
mv::gui::DecimalAction _defaultPointSizeAction; /** Default point size action */
mv::gui::DecimalAction _defaultPointSizeAction; /** Default point size action */
mv::gui::DecimalAction _defaultPointOpacityAction; /** Default point opacity action */
};
1 change: 1 addition & 0 deletions ExampleViewOpenGL/src/SettingsAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SettingsAction::SettingsAction(QObject* parent, const QString& title) :
_datasetNameAction.setString(" (No data loaded yet)");

_pointSizeAction.setValue(mv::settings().getPluginGlobalSettingsGroupAction<GlobalSettingsAction>(_exampleViewGLPlugin)->getDefaultPointSizeAction().getValue());
_pointOpacityAction.setValue(mv::settings().getPluginGlobalSettingsGroupAction<GlobalSettingsAction>(_exampleViewGLPlugin)->getDefaultPointOpacityAction().getValue());

connect(&_xDimensionPickerAction, &DimensionPickerAction::currentDimensionIndexChanged, _exampleViewGLPlugin, &ExampleViewGLPlugin::updatePlot);
connect(&_yDimensionPickerAction, &DimensionPickerAction::currentDimensionIndexChanged, _exampleViewGLPlugin, &ExampleViewGLPlugin::updatePlot);
Expand Down

0 comments on commit 2704c56

Please sign in to comment.