![]() |
NDEVR
API Documentation
|
A class for easily showing or hiding a Model in 3D space. More...
Public Member Functions | |
| DesignObjectVisibleButton (const DynamicPointer< QTDesignObject > &object, QWidget *parent=nullptr) | |
| Constructs a visibility button bound to the given design object. | |
| DesignObjectVisibleButton (QWidget *parent=nullptr) | |
| Constructs an unbound visibility button in a disabled state. | |
| void | setShowLineworkVisibleToggle (bool show, bool toggled) |
| Shows or hides the linework visibility toggle and sets its initial state. | |
| void | setShowMeshVisibleToggle (bool show, bool toggled) |
| Shows or hides the mesh visibility toggle and sets its initial state. | |
| void | setShowPointsVisibleToggle (bool show, bool toggled) |
| Shows or hides the points visibility toggle and sets its initial state. | |
| Public Member Functions inherited from Button | |
| Button (ButtonState state, QWidget *parent=nullptr) | |
| Constructs a Button with a specified visual state. | |
| Button (const std::function< void(Button *)> &on_click, QWidget *parent=nullptr) | |
| Constructs a Button with a click callback. | |
| Button (const TranslatedString &name, const std::function< void(Button *)> &on_click, QWidget *parent=nullptr) | |
| Constructs a Button with a title and click callback. | |
| Button (const TranslatedString &name, const StringView &icon, const std::function< void(Button *)> &on_click, QWidget *parent=nullptr) | |
| Constructs a Button with a title, icon, and click callback. | |
| Button (const TranslatedString &name, const StringView &icon, TooltipType tooltip, const std::function< void(Button *)> &on_click, QWidget *parent=nullptr) | |
| Constructs a Button with a title, icon, tooltip type, and click callback. | |
| Button (const TranslatedString &name, const StringView &icon=StringView(), QWidget *parent=nullptr) | |
| Constructs a Button with a title and optional icon. | |
| Button (QWidget *parent=nullptr) | |
| Constructs a Button with an optional parent widget. | |
| ~Button () | |
| Destroys the Button and releases resources. | |
| ButtonState | buttonState () const |
| Returns the current visual state of the button. | |
| void | clearBackgroundColor () |
| Clears any custom background color, reverting to the theme default. | |
| void | copyButtonFrom (Button *button) |
| Copies all visual properties and settings from another Button. | |
| void | enterEvent (ButtonEnterEvent *e) override |
| Handles the mouse enter event. | |
| bool | event (QEvent *e) override |
| Processes a generic event, handling theme and style changes. | |
| bool | eventFilter (QObject *watched, QEvent *event) override |
| Filters events for watched objects, used for push button event forwarding. | |
| const String & | iconName () const |
| Returns the current icon resource name. | |
| void | leaveEvent (QEvent *e) override |
| Handles the mouse leave event. | |
| QMenu * | menu () const |
| Returns the dropdown menu attached to this button, if any. | |
| QSize | minimumSizeHint () const override |
| Returns the minimum recommended size for the button. | |
| void | paintEvent (QPaintEvent *event) override |
| Handles the paint event, rendering the button with its current style and state. | |
| bool | requestButtonState (ButtonState state) |
| Requests that the button adopt the specified state, returning whether it was accepted. | |
| void | requestFixedState (bool fixed_state) |
| Requests that the button maintain a fixed state, preventing automatic state changes. | |
| int | scaledIconSize () const |
| Returns the icon size after applying the current size multiplier. | |
| void | setAlignment (Qt::Alignment m_alignment) |
| Sets the text alignment within the button. | |
| void | setAutoDefault (bool is_auto_default) |
| Sets whether the button is an auto-default button in dialogs. | |
| void | setBackgroundColor (const RGBColor &color, bool update_foreground=true) |
| Sets a custom background color for the button. | |
| void | setBackgroundOpacity (fltp04 background_opacity) |
| Sets the opacity of the button background (0.0 = transparent, 1.0 = opaque). | |
| void | setBold (bool is_bold) |
| Sets whether the button text is rendered in bold. | |
| void | setButtonDialog (ButtonDialog *dialog) |
| Associates a ButtonDialog with this button for toggle-controlled dialog visibility. | |
| void | setButtonState (ButtonState state) |
| Sets the visual state/style of the button. | |
| void | setCheckable (bool checkable) |
| Sets whether the button supports a checked/unchecked toggle state. | |
| void | setChecked (bool checked) |
| Sets the checked state of the button. | |
| void | setCheckedIconName (const StringView &icon) |
| Sets an alternate icon displayed when the button is checked. | |
| void | setClickCooldown (const TimeSpan &span) |
| Sets the minimum time between successive click events. | |
| void | setDefault (bool is_default) |
| Sets whether the button is the default button in dialogs. | |
| void | setDisabledToolTip (const TranslatedString &tooltip) |
| Sets the tooltip shown when the button is disabled. | |
| void | setFlat (bool is_flat) |
| Sets whether the button has a flat (borderless) appearance. | |
| void | setFocusOnPress (bool focus_on_press) |
| Sets whether the button should receive focus when pressed. | |
| void | setFontMultiplier (fltp04 font_multiplier) |
| Sets a multiplier for the button's font size. | |
| void | setForErrorOrSuccess (bool is_error, bool is_success) |
| Sets the button's visual state to indicate an error or success condition. | |
| void | setFunction (const std::function< void(Button *)> &on_click) |
| Sets the callback function invoked when the button is clicked. | |
| void | setHoverFunction (const std::function< void(Button *, bool hovering)> &on_hover) |
| Sets a callback function invoked when the mouse enters or leaves the button. | |
| void | setHoverIconName (const StringView &icon) |
| Sets an alternate icon displayed when the button is hovered. | |
| void | setHoverIconSizeMultiplier (fltp04 icon_size_multiplier) |
| Sets a multiplier for the icon size when the button is hovered. | |
| void | setIcon (const QIcon &icon) |
| Sets the icon directly from a QIcon object. | |
| void | setIconColor (const RGBColor &color) |
| Sets a custom color for the button icon. | |
| void | setIconName (const StringView &icon) |
| Sets the icon by resource name, triggering an icon update. | |
| void | setIconSize (int size) |
| Sets the icon size in pixels, overriding automatic scaling. | |
| void | setIconSizeMultiplier (fltp04 icon_size_multiplier) |
| Sets a multiplier for the default icon size. | |
| void | setIgnoreClicks (bool ignore_clicks) |
| Sets whether click events should be ignored. | |
| void | setLogOutput (bool log_output) |
| Enables or disables logging of button click events. | |
| void | setMargin (uint04 margin) |
| Sets the margin around the button content in pixels. | |
| void | setMenu (QMenu *menu) |
| Sets a dropdown QMenu to display when the button is clicked. | |
| void | setMenuDialog (QWidget *widget) |
| Sets a widget to be shown as a popup menu when the button is clicked. | |
| void | setPressFunction (const std::function< void(Button *, bool hovering)> &on_press) |
| Sets a callback function invoked when the button is pressed or released. | |
| void | setProgressPercent (fltp04 progress) |
| Sets a progress percentage to display as an overlay on the button. | |
| void | setSound (const StringView &sound) |
| Sets the sound played when the button is clicked. | |
| void | setText (const QString &text) |
| Sets the display text of the button (Qt override). | |
| void | setTitle (const TranslatedString &title) |
| Sets the display title of the button. | |
| void | setToolTip (const QString &tip) |
| Sets the tooltip text from a QString. | |
| void | setToolTip (const TranslatedString &enabled_tooltip, const TranslatedString &disabled_tooltip) |
| Sets separate tooltips for the enabled and disabled states. | |
| void | setToolTip (const TranslatedString &tooltip) |
| Sets the tooltip text from a TranslatedString. | |
| void | setToolTip (TooltipType type) |
| Sets the tooltip from a predefined tooltip type. | |
| void | setup (ApplicationOption< bool > &checked_var) |
| Sets up the button as a checkable toggle bound to an ApplicationOption<bool>. | |
| void | setup (const TranslatedString &name, const StringView &icon, ApplicationOption< bool > &checked_var) |
| Sets up the button with a name, icon, and ApplicationOption<bool> binding. | |
| void | setup (const TranslatedString &name, const StringView &icon, const std::function< void(Button *)> &on_click) |
| Sets up the button with a name, icon, and click callback. | |
| void | setup (const TranslatedString &name, const StringView &icon, Resource< bool > &checked_var) |
| Sets up the button as a checkable toggle bound to a bool Resource. | |
| void | setup (const TranslatedString &name, const StringView &icon, TooltipType tooltip, const std::function< void(Button *)> &on_click) |
| Sets up the button with a name, icon, tooltip type, and click callback. | |
| void | setup (GenericOption &checked_var) |
| Sets up the button from a GenericOption, using its name, icon, and value. | |
| void | showPopupMenu (QWidget *widget, bool is_popup=true) |
| Shows a popup menu widget anchored to this button. | |
| void | showToolTip () const |
| Programmatically shows the button's tooltip at the button's position. | |
| QSize | sizeHint () const override |
| Returns the recommended size for the button. | |
| int | styleDefaultIconSize () const |
| Returns the default icon size as determined by the current style. | |
| const TranslatedString & | title () const |
| Returns the translated title of the button. | |
| void | virtualMouseEvent (QEvent::Type event) |
| Simulates a mouse event of the given type on the button. | |
| Public Member Functions inherited from DesignObjectWidgetInterface | |
| virtual void | addTarget (const DynamicPointer< QTDesignObject > &object) |
| Adds a design object to the set of targets. | |
| virtual Bounds< 3, fltp08 > | bounds () const |
| Returns the combined 3D bounding box of all target design objects. | |
| void | clearTargets () |
| Removes all target design objects from this widget. | |
| QTModelManager * | manager () const |
| Returns the current model manager. | |
| Buffer< Model > | models () const |
| Returns all target objects as Models. | |
| virtual void | removeTarget (const DynamicPointer< QTDesignObject > &object) |
| Removes a specific target design object. | |
| virtual void | removeTarget (const UUID &object) |
| Removes a specific target by UUID. | |
| void | setManager (QTModelManager *manager) |
| Sets the model manager used for UUID-based lookups. | |
| void | setTarget (const DynamicPointer< QTDesignObject > &object) |
| Sets a single target design object, replacing any existing targets. | |
| void | setTargetID (const UUID &object) |
| Sets a single target by UUID, replacing any existing targets. | |
| void | setTargetIDs (const Buffer< UUID > &objects) |
| Sets multiple targets by UUID, replacing any existing targets. | |
| void | setTargets (const Buffer< DynamicPointer< QTDesignObject > > &objects) |
| Sets multiple target design objects, replacing any existing targets. | |
| Buffer< UUID > | targetIDs () const |
| Returns the UUIDs of all current target design objects. | |
Protected Member Functions | |
| void | init () |
| Initializes the button icon, checkable state, and context menu. | |
| void | onClicked () |
| Handles the button click to toggle visibility of the target design object. | |
| void | onTargetUpdated (UUID) override |
| Called when the target design object is updated, refreshing the button icon state. | |
| void | updateToggles () |
| Updates the context menu to show or hide the mesh, linework, and points toggles. | |
| Protected Member Functions inherited from Button | |
| void | mousePressEvent (QMouseEvent *) override |
| Handles the mouse press event. | |
| void | mouseReleaseEvent (QMouseEvent *) override |
| Handles the mouse release event for click detection. | |
| void | onButtonClickSlot () |
| Slot invoked when the button is clicked, executing the click callback. | |
| void | onButtonPressSlot () |
| Slot invoked when the button is pressed down. | |
| void | onButtonReleaseSlot () |
| Slot invoked when the button is released. | |
| Protected Member Functions inherited from DesignObjectWidgetInterface | |
| const Dictionary< UUID, DynamicPointer< QTDesignObject > > & | targets () const |
| Returns a const reference to the dictionary of all targets. | |
Protected Attributes | |
| QMenu * | m_menu = nullptr |
| The context menu containing visibility toggles. | |
| Toggle * | m_show_linework = nullptr |
| Toggle widget for linework visibility. | |
| QWidgetAction * | m_show_linework_group = nullptr |
| Widget action wrapping the linework toggle for the context menu. | |
| bool | m_show_linework_visible_toggle = false |
| Whether the linework visibility toggle is shown. | |
| Toggle * | m_show_mesh = nullptr |
| Toggle widget for mesh visibility. | |
| QWidgetAction * | m_show_mesh_group = nullptr |
| Widget action wrapping the mesh toggle for the context menu. | |
| bool | m_show_mesh_visible_toggle = false |
| Whether the mesh visibility toggle is shown. | |
| Toggle * | m_show_points = nullptr |
| Toggle widget for points visibility. | |
| QWidgetAction * | m_show_points_group = nullptr |
| Widget action wrapping the points toggle for the context menu. | |
| bool | m_show_points_visible_toggle = false |
| Whether the points visibility toggle is shown. | |
| Protected Attributes inherited from Button | |
| Qt::Alignment | m_alignment |
| Text alignment within the button. | |
| fltp04 | m_background_opacity = 1.0f |
| Opacity of the button background. | |
| String | m_checked_icon |
| Icon resource name displayed when checked. | |
| TimeSpan | m_click_cooldown = TimeSpan(0.1) |
| Minimum duration between successive clicks. | |
| String | m_current_icon |
| The currently displayed icon resource name. | |
| ButtonDialog * | m_dialog = nullptr |
| Associated ButtonDialog for toggle-controlled visibility. | |
| TranslatedString | m_disabled_tooltip |
| Tooltip shown when the button is disabled. | |
| TranslatedString | m_enabled_tooltip |
| Tooltip shown when the button is enabled. | |
| bool | m_fixed_state_requested = false |
| Whether the button state has been locked. | |
| bool | m_focus_on_press = true |
| Whether the button receives focus when pressed. | |
| fltp04 | m_font_multiplier = 1.0f |
| Multiplier applied to the default font size. | |
| bool | m_has_custom_background_color = false |
| Whether a custom background color has been set. | |
| String | m_hover_icon |
| Icon resource name displayed on hover. | |
| fltp04 | m_hover_icon_size_multiplier = Constant<fltp04>::Invalid |
| Icon size multiplier when hovered, or Invalid for default. | |
| String | m_icon |
| The requested icon resource name. | |
| RGBColor | m_icon_color |
| Custom icon color override. | |
| fltp04 | m_icon_size_multiplier = 1.0f |
| Multiplier applied to the default icon size. | |
| QTResourceListener * | m_icon_theme_listener = nullptr |
| Listener for icon theme changes. | |
| bool | m_ignore_clicks = false |
| Whether to ignore click events. | |
| bool | m_is_auto_default_button = false |
| Whether this is an auto-default button in a dialog. | |
| bool | m_is_bold = false |
| Whether the button text is bold. | |
| bool | m_is_default_button = false |
| Whether this is the default button in a dialog. | |
| Time | m_last_click_time = Time(0) |
| Timestamp of the most recent click event. | |
| bool | m_log_output = true |
| Whether click events are logged. | |
| uint04 | m_margin = Constant<uint04>::Invalid |
| Custom margin around button content, or Invalid for default. | |
| QPointer< QWidget > | m_menu_dialog = nullptr |
| Widget shown as a popup menu on click. | |
| std::function< void(Button *)> | m_on_click = nullptr |
| Callback invoked on button click. | |
| std::function< void(Button *, bool hovering)> | m_on_hover = nullptr |
| Callback invoked on hover state change. | |
| std::function< void(Button *, bool pressing)> | m_on_press = nullptr |
| Callback invoked on press state change. | |
| fltp04 | m_progress = Constant<fltp04>::Invalid |
| Progress overlay value (0.0-1.0), or Invalid to hide. | |
| QPushButton * | m_push_button = nullptr |
| Internal QPushButton used for push button state rendering. | |
| String | m_sound |
| Sound resource name played on click. | |
| ButtonState | m_state = ButtonState::e_large |
| The current visual state/style of the button. | |
| TranslatedString | m_title |
| The display title of the button. | |
| Protected Attributes inherited from DesignObjectWidgetInterface | |
| DesignObjectInterface * | m_interface |
| The internal QObject-based implementation handling signals and target storage. | |
Additional Inherited Members | |
| Public Types inherited from Button | |
| enum | ButtonState { e_large , e_medium , e_medium_centered , e_small , e_circular , e_circular_small , e_push_button , e_none } |
| Defines the visual size and style of the button. More... | |
| Static Public Attributes inherited from Button | |
| static String | s_default_sound |
| The default sound played by all buttons on click. | |
A class for easily showing or hiding a Model in 3D space.
Definition at line 45 of file DesignObjectVisibleButton.h.
|
inline |
Constructs a visibility button bound to the given design object.
| [in] | object | The design object whose visibility is controlled. |
| [in] | parent | The parent widget. |
Definition at line 54 of file DesignObjectVisibleButton.h.
References Button::Button(), init(), and DesignObjectWidgetInterface::setTarget().
|
inline |
Constructs an unbound visibility button in a disabled state.
| [in] | parent | The parent widget. |
Definition at line 64 of file DesignObjectVisibleButton.h.
References Button::Button(), and init().
|
overrideprotectedvirtual |
Called when the target design object is updated, refreshing the button icon state.
| [in] | id | The UUID of the updated object (unused). |
Reimplemented from DesignObjectWidgetInterface.
|
inline |
Shows or hides the linework visibility toggle and sets its initial state.
| [in] | show | Whether to display the linework toggle. |
| [in] | toggled | The initial checked state of the linework toggle. |
Definition at line 87 of file DesignObjectVisibleButton.h.
References m_show_linework, m_show_linework_visible_toggle, and updateToggles().
|
inline |
Shows or hides the mesh visibility toggle and sets its initial state.
| [in] | show | Whether to display the mesh toggle. |
| [in] | toggled | The initial checked state of the mesh toggle. |
Definition at line 75 of file DesignObjectVisibleButton.h.
References m_show_mesh, m_show_mesh_visible_toggle, and updateToggles().
|
inline |
Shows or hides the points visibility toggle and sets its initial state.
| [in] | show | Whether to display the points toggle. |
| [in] | toggled | The initial checked state of the points toggle. |
Definition at line 99 of file DesignObjectVisibleButton.h.
References m_show_points, m_show_points_visible_toggle, and updateToggles().