NDEVR
API Documentation
DrawCommandsWidget

A widget for interfacing with GeometryMaker to allow the user to draw 3D objects or shapes. More...

Collaboration diagram for DrawCommandsWidget:
[legend]

Public Member Functions

 DrawCommandsWidget (QTModelManager *manager, QWidget *parent=nullptr)
 Constructs a DrawCommandsWidget bound to the given model manager.
void addCustomDrawWidget (GeometryMaker::GeometryCreateMode create_mode, Editor *widget)
 Registers a custom editor widget for a specific drawing mode.
void controlModeSet (GeometryMaker::GeometryCreateMode mode)
 Emitted when the geometry creation mode changes.
void hideEvent (QHideEvent *event) override
 Handles the hide event by cleaning up active drawing state.
GeometryMaker::GeometryCreateMode mode () const
 Returns the currently active geometry creation mode.
void removeControl (bool keep_existing)
 Removes the active drawing control, optionally preserving existing geometry.
void removeCustomDrawWidget (GeometryMaker::GeometryCreateMode create_mode)
 Removes a custom editor widget for a specific drawing mode.
bool requestVisibleSignal (bool visible)
 Emitted to request that this widget be shown or hidden.
void setControl (GeometryMaker::GeometryCreateMode mode)
 Activates the specified geometry creation mode.
void setControlEnabled (bool enabled)
 Enables or disables the drawing controls.
void setupRibbon (RibbonGroup *group, bool add_2D, bool add_3D)
 Populates a ribbon group with draw mode buttons for 2D and/or 3D shapes.
void setupRibbonStep (RibbonGroup *group)
 Populates a ribbon group with step-by-step drawing controls.
void showLocalRibbon (bool show_ribbon)
 Shows or hides the local ribbon containing draw mode buttons.

Public Attributes

Resource< Model * > root_model
 The root model under which new geometry is created.

Protected Member Functions

EditorcustomEditor ()
 Returns the custom editor for the current drawing mode, if any.
void onDeletedSlot (UUID id)
 Slot called when a drawn object is deleted.
void onSelectedSlot (Buffer< UUID > ids, bool is_selected)
 Slot called when objects are selected or deselected in the viewport.
void refreshUI (bool force)
 Refreshes the UI to reflect the current drawing state.
void setStep (uint04 step, GeometryMaker::GeometrySpecMode mode)
 Slot called to advance to a specific drawing step.
void setupRibbon ()
 Sets up the local ribbon with draw mode buttons.
void setupRibbon2D (uint04 index, RibbonGroup *group)
 Sets up 2D drawing mode buttons in the ribbon.
void setupRibbon3D (uint04 index, RibbonGroup *group)
 Sets up 3D drawing mode buttons in the ribbon.
void setupRibbonSteps (RibbonGroup *group)
 Sets up ribbon step buttons within the given group.
StringView specIcon (GeometryMaker::GeometrySpecMode spec)
 Returns the icon name for the given geometry spec mode.
TranslatedString specText (GeometryMaker::GeometrySpecMode spec)
 Returns the display text for the given geometry spec mode.
void updateSnapIcon ()
 Updates the snap button icon to reflect the current snap mode.
void updateSpecificContainer ()
 Updates the container showing spec-specific options for the current step.

Detailed Description

A widget for interfacing with GeometryMaker to allow the user to draw 3D objects or shapes.


Definition at line 55 of file DrawCommandsWidget.h.

Constructor & Destructor Documentation

◆ DrawCommandsWidget()

DrawCommandsWidget::DrawCommandsWidget ( QTModelManager * manager,
QWidget * parent = nullptr )

Constructs a DrawCommandsWidget bound to the given model manager.

Parameters
[in]managerThe QTModelManager providing design objects and viewports.
[in]parentThe parent widget.

References DrawCommandsWidget().

Referenced by DrawCommandsWidget().

Member Function Documentation

◆ addCustomDrawWidget()

void DrawCommandsWidget::addCustomDrawWidget ( GeometryMaker::GeometryCreateMode create_mode,
Editor * widget )

Registers a custom editor widget for a specific drawing mode.

Parameters
[in]create_modeThe geometry creation mode.
[in]widgetThe custom editor widget.

◆ controlModeSet()

void DrawCommandsWidget::controlModeSet ( GeometryMaker::GeometryCreateMode mode)

Emitted when the geometry creation mode changes.

Parameters
[in]modeThe new geometry creation mode.

References mode().

◆ customEditor()

Editor * DrawCommandsWidget::customEditor ( )
protected

Returns the custom editor for the current drawing mode, if any.

Returns
A pointer to the custom Editor, or nullptr.

◆ hideEvent()

void DrawCommandsWidget::hideEvent ( QHideEvent * event)
override

Handles the hide event by cleaning up active drawing state.

Parameters
[in]eventThe hide event.

◆ mode()

GeometryMaker::GeometryCreateMode DrawCommandsWidget::mode ( ) const

Returns the currently active geometry creation mode.

Returns
The current GeometryCreateMode.

Referenced by controlModeSet(), setControl(), and setStep().

◆ onDeletedSlot()

void DrawCommandsWidget::onDeletedSlot ( UUID id)
protected

Slot called when a drawn object is deleted.

Parameters
[in]idThe UUID of the deleted object.

◆ onSelectedSlot()

void DrawCommandsWidget::onSelectedSlot ( Buffer< UUID > ids,
bool is_selected )
protected

Slot called when objects are selected or deselected in the viewport.

Parameters
[in]idsThe UUIDs of the affected objects.
[in]is_selectedWhether the objects are now selected.

◆ refreshUI()

void DrawCommandsWidget::refreshUI ( bool force)
protected

Refreshes the UI to reflect the current drawing state.

Parameters
[in]forceWhether to force a full refresh even if state appears unchanged.

◆ removeControl()

void DrawCommandsWidget::removeControl ( bool keep_existing)

Removes the active drawing control, optionally preserving existing geometry.

Parameters
[in]keep_existingWhether to keep the geometry created so far.

◆ removeCustomDrawWidget()

void DrawCommandsWidget::removeCustomDrawWidget ( GeometryMaker::GeometryCreateMode create_mode)

Removes a custom editor widget for a specific drawing mode.

Parameters
[in]create_modeThe geometry creation mode.

◆ requestVisibleSignal()

bool DrawCommandsWidget::requestVisibleSignal ( bool visible)

Emitted to request that this widget be shown or hidden.

Parameters
[in]visibleWhether the widget should be visible.
Returns
True if the request was accepted.

◆ setControl()

void DrawCommandsWidget::setControl ( GeometryMaker::GeometryCreateMode mode)

Activates the specified geometry creation mode.

Parameters
[in]modeThe geometry creation mode to set.

References mode().

◆ setControlEnabled()

void DrawCommandsWidget::setControlEnabled ( bool enabled)

Enables or disables the drawing controls.

Parameters
[in]enabledWhether drawing is enabled.

◆ setStep()

void DrawCommandsWidget::setStep ( uint04 step,
GeometryMaker::GeometrySpecMode mode )
protected

Slot called to advance to a specific drawing step.

Parameters
[in]stepThe step index.
[in]modeThe geometry spec mode for the step.

References mode().

◆ setupRibbon()

void DrawCommandsWidget::setupRibbon ( RibbonGroup * group,
bool add_2D,
bool add_3D )

Populates a ribbon group with draw mode buttons for 2D and/or 3D shapes.

Parameters
[in]groupThe ribbon group to populate.
[in]add_2DWhether to include 2D drawing modes.
[in]add_3DWhether to include 3D drawing modes.

◆ setupRibbon2D()

void DrawCommandsWidget::setupRibbon2D ( uint04 index,
RibbonGroup * group )
protected

Sets up 2D drawing mode buttons in the ribbon.

Parameters
[in]indexThe starting button index.
[in]groupThe ribbon group to populate.

◆ setupRibbon3D()

void DrawCommandsWidget::setupRibbon3D ( uint04 index,
RibbonGroup * group )
protected

Sets up 3D drawing mode buttons in the ribbon.

Parameters
[in]indexThe starting button index.
[in]groupThe ribbon group to populate.

◆ setupRibbonStep()

void DrawCommandsWidget::setupRibbonStep ( RibbonGroup * group)

Populates a ribbon group with step-by-step drawing controls.

Parameters
[in]groupThe ribbon group to populate.

◆ setupRibbonSteps()

void DrawCommandsWidget::setupRibbonSteps ( RibbonGroup * group)
protected

Sets up ribbon step buttons within the given group.

Parameters
[in]groupThe ribbon group to populate.

◆ showLocalRibbon()

void DrawCommandsWidget::showLocalRibbon ( bool show_ribbon)

Shows or hides the local ribbon containing draw mode buttons.

Parameters
[in]show_ribbonWhether to show the ribbon.

◆ specIcon()

StringView DrawCommandsWidget::specIcon ( GeometryMaker::GeometrySpecMode spec)
protected

Returns the icon name for the given geometry spec mode.

Parameters
[in]specThe geometry specification mode.
Returns
The icon name string.

◆ specText()

TranslatedString DrawCommandsWidget::specText ( GeometryMaker::GeometrySpecMode spec)
protected

Returns the display text for the given geometry spec mode.

Parameters
[in]specThe geometry specification mode.
Returns
The translated display text.

The documentation for this class was generated from the following file: