NDEVR
API Documentation

A decorated dial class that allows the user to set the lighting direction. More...

Collaboration diagram for SunDial:
[legend]

Public Member Functions

 SunDial (QWidget *parent=nullptr)
 Constructs a SunDial widget with the given parent.
Vector< 2, fltp04centerPoint () const
 Returns the center point of the dial in widget coordinates.
Vector< 2, fltp04knobLocation () const
 Returns the current position of the dial knob in widget coordinates.
fltp04 knobRadius () const
 Returns the radius of the dial knob in pixels, scaled to the widget size.
virtual void mouseMoveEvent (QMouseEvent *ev) override
 Handles mouse move events to update the knob position while dragging.
virtual void mousePressEvent (QMouseEvent *ev) override
 Handles mouse press events to begin dragging the dial knob.
virtual void mouseReleaseEvent (QMouseEvent *) override
 Handles mouse release events to stop dragging the dial knob.
fltp04 outerRadius () const
 Returns the outer radius of the dial in pixels.
void setBackgroundColor (QColor inner, QColor outer)
 Sets the gradient colors for the dial background.
void setKnobColor (QColor inner, QColor outer)
 Sets the gradient colors for the dial knob.
QSize sizeHint () const override
 Returns the recommended size for this dial widget.

Public Attributes

Resource< Vector< 2, fltp04 > > location
 The 2D direction resource representing the current lighting direction.

Protected Member Functions

void paintEvent (QPaintEvent *paint_event) override
 Paints the dial including the background gradient, knob, and decorations.

Protected Attributes

bool m_dragging
 Whether the user is currently dragging the knob.
QColor m_inner_color
 The inner color of the background gradient.
fltp04 m_inner_radius
 The inner radius ratio of the dial background.
QColor m_knob_inner_color
 The inner color of the knob gradient.
QColor m_knob_outer_color
 The outer color of the knob gradient.
fltp04 m_knob_radius
 The radius ratio of the knob relative to the widget size.
QColor m_outer_color
 The outer color of the background gradient.

Detailed Description

A decorated dial class that allows the user to set the lighting direction.


Definition at line 43 of file SunDial.h.

Constructor & Destructor Documentation

◆ SunDial()

SunDial::SunDial ( QWidget * parent = nullptr)

Constructs a SunDial widget with the given parent.

Parameters
[in]parentThe parent widget.

Member Function Documentation

◆ centerPoint()

Vector< 2, fltp04 > SunDial::centerPoint ( ) const

Returns the center point of the dial in widget coordinates.

Returns
The center point as a 2D vector.

◆ knobLocation()

Vector< 2, fltp04 > SunDial::knobLocation ( ) const

Returns the current position of the dial knob in widget coordinates.

Returns
The knob location as a 2D vector.

◆ knobRadius()

fltp04 SunDial::knobRadius ( ) const
inline

Returns the radius of the dial knob in pixels, scaled to the widget size.

Returns
The knob radius.

Definition at line 71 of file SunDial.h.

References getMin(), and m_knob_radius.

◆ mouseMoveEvent()

virtual void SunDial::mouseMoveEvent ( QMouseEvent * ev)
overridevirtual

Handles mouse move events to update the knob position while dragging.

Parameters
[in]evThe mouse move event.

◆ mousePressEvent()

virtual void SunDial::mousePressEvent ( QMouseEvent * ev)
overridevirtual

Handles mouse press events to begin dragging the dial knob.

Parameters
[in]evThe mouse press event.

◆ outerRadius()

fltp04 SunDial::outerRadius ( ) const

Returns the outer radius of the dial in pixels.

Returns
The outer radius.

◆ paintEvent()

void SunDial::paintEvent ( QPaintEvent * paint_event)
overrideprotected

Paints the dial including the background gradient, knob, and decorations.

Parameters
[in]paint_eventThe paint event.

◆ setBackgroundColor()

void SunDial::setBackgroundColor ( QColor inner,
QColor outer )

Sets the gradient colors for the dial background.

Parameters
[in]innerThe inner color of the background gradient.
[in]outerThe outer color of the background gradient.

◆ setKnobColor()

void SunDial::setKnobColor ( QColor inner,
QColor outer )

Sets the gradient colors for the dial knob.

Parameters
[in]innerThe inner color of the knob gradient.
[in]outerThe outer color of the knob gradient.

◆ sizeHint()

QSize SunDial::sizeHint ( ) const
inlineoverride

Returns the recommended size for this dial widget.

Returns
The size hint.

Definition at line 84 of file SunDial.h.


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