![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GUI/InteractiveViewOptionsOverlay.h>
Button overlay for InteractiveView that allows for setting up the view or display options of the view. More...
Button overlay for InteractiveView that allows for setting up the view or display options of the view.
The settings are shown in a custom styled popup menu when clicking the button. This class currently supports ImageView2D and ImageView3D.
Public Types | |
enum class | Type { ViewOptions , DisplayOptions } |
Type of settings to display in popup menu. More... | |
using | DisplayOptionsWidgetCreator = std::function<std::unique_ptr<QWidget>(Data* data, GUI::DisplayBase& display, GUI::View& view)> |
![]() | |
enum | AnchorPoint { BottomLeft = int(Anchor::BottomLeft) , BottomRight = int(Anchor::BottomRight) , TopLeft = int(Anchor::TopLeft) , TopRight = int(Anchor::TopRight) , Top = int(Anchor::Top) , Bottom = int(Anchor::Bottom) , Left = int(Anchor::Left) , Right = int(Anchor::Right) , Fill = int(Anchor::Fill) } |
Anchor point of the overlay in the hosting InteractiveView. More... | |
![]() | |
enum class | Anchor { BottomLeft = 0 , BottomRight = 1 , TopLeft = 2 , TopRight = 3 , Top = 4 , Bottom = 5 , Left = 6 , Right = 7 , Fill = 8 } |
Anchor point of the overlay in the parent View. More... | |
enum class | LayoutDirection { Horizontal = 0 , Vertical = 1 } |
Layout direction when stacking multiple ViewOverlays at the same anchor. | |
Public Slots | |
void | click () override |
![]() | |
virtual void | click () |
Public Member Functions | |
InteractiveViewOptionsOverlay (Type type, AnchorPoint anchor, GUI::DisplayBase &disp, GUI::View &view) | |
Instantiate a button overlay to setup the given view. | |
void | setDisplayOptionsWidgetCreator (DisplayOptionsWidgetCreator displayOptionsCreator) |
Sets a callback for creating the QWidget instance that should edit the display options. | |
DisplayOptionsWidgetCreator | displayOptionsWidgetCreator () const |
Returns the current widget creator callback. | |
void | setVisibleDisplayOptions2dSections (Flags< DisplayOptions2dWidget::Sections > visibleSections) |
Sets the list of all DisplayOptions2d widget sections to show. | |
void | setVisibleDisplayOptions3dSections (Flags< DisplayOptions3dWidget::Sections > visibleSections) |
Sets the list of all DisplayOptions3d widget sections to show. | |
bool | eventFilter (QObject *watched, QEvent *event) override |
void | setViewOptions3dWidgetCreator (std::function< QWidget *()> viewOpts3dWidget) |
Sets a factory function to create a custom widget for the 3d view-options This custom widget is created and used instead of the default ViewOptions3dWidget. | |
void | set3dDisplayOptionsInvertVisible (bool visible) |
Sets the visibility of the "Invert" label and check-box of the 3d and 2d display options. | |
void | set2dDisplayOptionsInvertVisible (bool visible) |
Type | type () const |
![]() | |
InteractiveButtonOverlay (AnchorPoint anchor) | |
void | setIcon (SharedImage *icon) |
Set the icon to use for the button. | |
void | setIcon (std::shared_ptr< GlImage > icon) |
Set the icon to use for the button. | |
void | setHighlight (bool highlight) |
Set the highlight status of the button. | |
![]() | |
InteractiveOverlay (std::unique_ptr< GlOverlay > overlay, AnchorPoint anchor) | |
Instantiate a new InteractiveOverlay taking ownership of the underlying GlOverlay. | |
InteractiveOverlay (GlOverlay &overlay, AnchorPoint anchor) | |
Instantiate a new InteractiveOverlay referencing the given overlay. | |
InteractiveOverlay (GlOverlay *overlay, AnchorPoint anchor, bool ownOverlay=true) | |
const GlOverlay * | overlay () const |
Get a pointer to the underlying overlay. | |
GlOverlay * | overlay () |
Get a pointer to the underlying overlay. | |
virtual void | setInteraction (std::unique_ptr< OverlayInteraction > interaction) |
Set an interaction event handler for this overlay. | |
QRect | rect () const |
Get position and actual size (including margins) of overlay in viewport coordinates. | |
void | setMargin (int horizontal, int vertical) |
Sets the margin in pixels between the border of the drawing area and the border of the overlay content. | |
int | horizontalMargin () const |
Gets the horizontal margin in pixels between the border of the drawing area and the border of the overlay content. Default is 2. | |
int | verticalMargin () const |
Gets the vertical margin in pixels between the border of the drawing area and the border of the overlay content. Default is 2. | |
virtual void | setSizeHint (int width, int height) |
Sets the preferred size of the overlay for a DPI scaling of 1.0. | |
virtual int | sizeHintWidth () const |
Gets the preferred width of the overlay. | |
virtual int | sizeHintHeight () const |
Gets the preferred height of the overlay. | |
virtual void | setMinimalSizeHint (int width, int height) |
Sets the minimal size of the overlay for a DPI scaling of 1.0. | |
virtual int | minimalSizeHintWidth () const |
Gets the minimal width of the overlay. | |
virtual int | minimalSizeHintHeight () const |
Gets the minimal height of the overlay. | |
void | setAnchorPoint (AnchorPoint anchorPoint) |
Set the anchor point of overlay. | |
AnchorPoint | anchorPoint () const |
Get the anchor point of overlay. | |
virtual bool | sceneEvent (QEvent *event) |
Called by the hosting InteractiveView, default implementation forwards it to the set OverlayInteraction. | |
GUI::EventResult | handleInputEvent (const GUI::InputEvent &event) override |
Calls the base interface's version and then continues propagation to sceneEvent(). | |
![]() | |
ViewOverlay (std::unique_ptr< GlOverlay > glOverlay) | |
Instantiate a new ViewOverlay taking ownership of the underlying GlOverlay which must not be null. | |
virtual void | render () |
Calls GlOverlay::render() on the underlying glOverlay() using the current viewport() shrinked by margin(). | |
const GlOverlay & | glOverlay () const |
Get a pointer to the underlying overlay. | |
GlOverlay & | glOverlay () |
Get a pointer to the underlying overlay. | |
const GL::Viewport & | viewport () |
Returns the area where this overlay is rendered. | |
bool | isVisible () const |
Returns the visibility of this overlay. | |
virtual void | setVisible (bool value) |
Sets the visibility of this overlay. | |
const vec2i & | margin () const |
Returns the margin in pixels between the border of the drawing area and the border of the overlay content. | |
void | setMargin (const vec2i &value) |
Sets the margin in pixels between the border of the drawing area and the border of the overlay content. | |
vec2i | minimalSizeHint () const |
Returns the underlying GlOverlay's minimal size hint plus the configured margin(). | |
vec2i | sizeHint () const |
Returns the underlying GlOverlay's size hint plus the configured margin(). | |
void | configure (const Properties *p) override |
Configure this object instance by de-serializing the given Properties. | |
void | configuration (Properties *p) const override |
Serialize the current object configuration into the given Properties object. | |
![]() | |
virtual void | configureDefaults () |
Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
void | registerParameter (ParameterBase *param) |
Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
void | unregisterParameter (const ParameterBase *param) |
Remove the given Parameter or SubProperty from the list of registered parameters. | |
Configurable (const Configurable &rhs) | |
Configurable (Configurable &&rhs) noexcept | |
Configurable & | operator= (const Configurable &) |
Configurable & | operator= (Configurable &&) noexcept |
![]() | |
SignalReceiver ()=default | |
Default constructor. | |
SignalReceiver (const SignalReceiver &other) | |
Copy constructor, does not copy any existing signal connections from other. | |
SignalReceiver & | operator= (SignalReceiver rhs) |
Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs. | |
virtual | ~SignalReceiver () |
Virtual destructor disconnects from all connected signals. | |
Protected Attributes | |
Type | m_type |
Type of the settings to display. | |
GUI::DisplayBase & | m_disp |
DisplayWidget hosting the view. | |
GUI::View * | m_view |
The view to configure. | |
std::unique_ptr< QMenu > | m_menu |
QMenu used for hosting the settings widget. | |
std::unique_ptr< SharedImage > | m_icon |
Icon used for the button overlay. | |
QWidget * | m_displayOptionsWidget = nullptr |
pointer to current per-data display options GUI so that it can be replaced | |
std::function< std::unique_ptr< QWidget >(Data *data, GUI::DisplayBase &display, GUI::View &view)> | m_displayOptionsCreator |
std::function< QWidget *()> | m_3dViewOptionsCreator = nullptr |
bool | m_3dDisplayOptionsInvertVisible = true |
bool | m_2dDisplayOptionsInvertVisible = true |
Flags< DisplayOptions2dWidget::Sections > | m_visibleSections2d = DisplayOptions2dWidget::Sections::All |
Flags< DisplayOptions3dWidget::Sections > | m_visibleSections3d = DisplayOptions3dWidget::Sections::All |
![]() | |
GlOverlay * | m_overlay = nullptr |
Underlying GlOverlay. | |
std::unique_ptr< OverlayInteraction > | m_interaction |
Interaction class to handle overlay events. | |
AnchorPoint | m_anchorPoint |
Anchor point within parent view. | |
bool | m_ownOverlay = true |
Flag whether m_overlay is owned by this instance. | |
![]() | |
std::unique_ptr< GlOverlay > | m_glOverlay |
GL::Viewport | m_viewport = {} |
vec2i | m_margin = vec2i::Zero() |
bool | m_isVisible = true |
![]() | |
std::vector< Param > | m_params |
List of all registered Parameter and SubProperty instances. | |
Additional Inherited Members | |
![]() | |
void | clicked () |
NOTE: use Qt::QueuedConnection when your slot is blocking (like a QMenu), otherwise the mouse release event gets lost. | |
![]() | |
void | anchorPointChanged (InteractiveOverlay::AnchorPoint anchorPoint) |
![]() | |
Signal | signalUpdateRequested |
Emitted in order to notify the parent Display that it's contents have changed and need to be re-rendered. | |
Signal | signalLayoutNeeded |
Emitted whenever the size hints or margin have changed to notify the parent View that it needs to perform overlay layouting. | |
![]() | |
Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
![]() | |
void | setOverlay (GlOverlay *overlay, bool ownOverlay) |
Update the internal GlOverlay. | |
![]() | |
void | disconnectAll () |
Disconnects all existing connections. | |
![]() | |
InteractiveOverlay::AnchorPoint | anchorPoint |
|
strong |
Type of settings to display in popup menu.
Enumerator | |
---|---|
ViewOptions | show the view options for the view |
DisplayOptions | show the display options for the view |
InteractiveViewOptionsOverlay | ( | Type | type, |
AnchorPoint | anchor, | ||
GUI::DisplayBase & | disp, | ||
GUI::View & | view ) |
Instantiate a button overlay to setup the given view.
The overlay's icon will be determined automatically based on the given type.
void setDisplayOptionsWidgetCreator | ( | DisplayOptionsWidgetCreator | displayOptionsCreator | ) |
Sets a callback for creating the QWidget instance that should edit the display options.
By default, DataDisplayDispatcher::createDisplayOptionsWidget for the view is used. nullptr is not a valid input.