A widget meant to be placed beside a camera view showing either directional or measurement markings depending on whether or not a camera is orthographic.
More...
|
| | Ruler (bool is_horizontal, bool is_left_or_top, QWidget *parent=nullptr) |
| | Constructs a Ruler widget with the specified orientation and side.
|
| | Ruler (QWidget *parent=nullptr) |
| | Constructs a horizontal Ruler widget.
|
|
| ~Ruler () |
| | Destroys this Ruler widget.
|
| uint01 | dimension () const |
| | Returns the dimension index this ruler represents.
|
| String | label () const |
| | Returns the current label text.
|
| RGBColor | labelBackground () |
| | Returns the background color for the label.
|
| void | paintBackground (QPainter &g2D) |
| | Paints the ruler background.
|
| void | paintEvent (QPaintEvent *event) override |
| | Paints the ruler including background, tick marks, and labels.
|
| void | paintRuler (QPainter &g2D) |
| | Paints the ruler tick marks and labels.
|
| void | setCamera (const DynamicPointer< Camera > &camera) |
| | Sets the camera whose view this ruler reflects.
|
| void | setHorizontal (bool is_horizontal) |
| | Sets the orientation of the ruler.
|
| void | setLabel (const String &label, const Vector< 2, fltp08 > &location=Vector< 2, fltp08 >(0.0)) |
| | Sets a label to display on the ruler at the given location.
|
| void | setLabelMode (LabelMode mode) |
| | Sets the label display mode.
|
| void | setLabelsVisible (bool visible) |
| | Sets whether tick mark labels are visible.
|
| void | setScroller (QScrollArea *scroll_area_target, fltp08 scroll_scale=1.0) |
| | Associates a scroll area with this ruler for synchronized scrolling.
|
| QSize | sizeHint () const override |
| | Returns the recommended size for this widget.
|
|
|
static const int | MARGIN = 4 |
| | The pixel margin around the ruler.
|
|
|
Vector< 2, uint01 > | m_axis |
| | The axis mapping for ruler dimensions.
|
|
ConstPointer< Camera > | m_camera |
| | The camera this ruler tracks.
|
|
QTResourceListener * | m_camera_listener = nullptr |
| | Listener for camera property changes.
|
|
QTResourceListener * | m_coordinate_listener = nullptr |
| | Listener for coordinate system changes.
|
|
bool | m_draw_minor |
| | Whether to draw minor tick marks.
|
|
bool | m_is_horizontal = true |
| | Whether the ruler is oriented horizontally.
|
|
bool | m_is_left_or_top |
| | Whether the ruler is on the left or top side.
|
|
bool | m_is_opaque |
| | Whether the ruler background is opaque.
|
|
Vector< 2, uint01 > | m_label_axis |
| | The axis mapping for label positioning.
|
|
RGBColor | m_label_background |
| | The background color for the label.
|
|
fltp08 | m_label_location |
| | The current label position along the ruler.
|
|
LabelMode | m_label_mode |
| | The current label display mode.
|
|
QRect | m_label_rect |
| | The bounding rectangle for the current label.
|
|
String | m_label_text |
| | The current label text.
|
|
bool | m_labels_visible |
| | Whether tick mark labels are visible.
|
|
RGBColor | m_last_label_background |
| | The label background from the last paint operation.
|
|
fltp08 | m_last_label_location |
| | The label location from the last paint operation.
|
|
String | m_last_label_text |
| | The label text from the last paint operation.
|
|
fltp08 | m_last_paint_scale |
| | The scale factor from the last paint operation.
|
|
fltp08 | m_last_world_offset |
| | The world offset from the last paint operation.
|
|
fltp08 | m_last_world_spacing |
| | The world grid spacing from the last paint operation.
|
|
QScrollArea * | m_scroll_area_target = nullptr |
| | The scroll area this ruler is synchronized with.
|
|
fltp08 | m_scroll_scale = 1.0 |
| | The scale factor for scroll area synchronization.
|
A widget meant to be placed beside a camera view showing either directional or measurement markings depending on whether or not a camera is orthographic.
Definition at line 53 of file Ruler.h.
◆ LabelMode
Controls what information is displayed as a label on the ruler.
| Enumerator |
|---|
| e_camera_location | Shows the current camera location on the ruler.
|
| e_selection | Shows the current selection position on the ruler.
|
| e_none | No label is displayed.
|
Definition at line 60 of file Ruler.h.
◆ Ruler() [1/2]
| Ruler::Ruler |
( |
QWidget * | parent = nullptr | ) |
|
Constructs a horizontal Ruler widget.
- Parameters
-
| [in] | parent | The parent widget. |
◆ Ruler() [2/2]
| Ruler::Ruler |
( |
bool | is_horizontal, |
|
|
bool | is_left_or_top, |
|
|
QWidget * | parent = nullptr ) |
Constructs a Ruler widget with the specified orientation and side.
- Parameters
-
| [in] | is_horizontal | Whether the ruler is horizontal (true) or vertical (false). |
| [in] | is_left_or_top | Whether the ruler is on the left/top side of the viewport. |
| [in] | parent | The parent widget. |
◆ convertModelToPixel()
Converts a model-space coordinate to a pixel coordinate.
- Parameters
-
| [in] | dim | The dimension index. |
| [in] | model | The model-space coordinate. |
- Returns
- The pixel coordinate.
◆ convertPixelToModel()
Converts a pixel coordinate to a model-space coordinate.
- Parameters
-
| [in] | dim | The dimension index. |
| [in] | pixel | The pixel coordinate. |
- Returns
- The model-space coordinate.
◆ dimension()
| uint01 Ruler::dimension |
( |
| ) |
const |
|
inline |
Returns the dimension index this ruler represents.
- Returns
- X (0) for horizontal rulers, Y (1) for vertical rulers.
Definition at line 150 of file Ruler.h.
References m_is_horizontal.
◆ getFormattedTickText()
Formats a tick mark value as a display string with appropriate precision.
- Parameters
-
| [in] | value | The world-space value to format. |
| [in] | spacing | The current tick spacing, used to determine precision. |
| [in] | dim | The dimension index. |
- Returns
- The formatted tick label text.
◆ label()
Returns the current label text.
- Returns
- The label text.
Referenced by setLabel().
◆ labelBackground()
Returns the background color for the label.
- Returns
- The label background color.
◆ labelPixelLocation()
| fltp08 Ruler::labelPixelLocation |
( |
| ) |
const |
|
protected |
Returns the pixel location of the label along the ruler.
- Returns
- The label position in pixels.
◆ paintBackground()
| void Ruler::paintBackground |
( |
QPainter & | g2D | ) |
|
Paints the ruler background.
- Parameters
-
| [in] | g2D | The painter to draw with. |
◆ paintEvent()
| void Ruler::paintEvent |
( |
QPaintEvent * | event | ) |
|
|
override |
Paints the ruler including background, tick marks, and labels.
- Parameters
-
| [in] | event | The paint event. |
◆ paintRuler()
| void Ruler::paintRuler |
( |
QPainter & | g2D | ) |
|
Paints the ruler tick marks and labels.
- Parameters
-
| [in] | g2D | The painter to draw with. |
◆ scale()
Returns the pixels-per-world-unit scale factor.
- Returns
- The scale factor.
◆ setCamera()
Sets the camera whose view this ruler reflects.
- Parameters
-
| [in] | camera | The camera to track. |
◆ setHorizontal()
| void Ruler::setHorizontal |
( |
bool | is_horizontal | ) |
|
Sets the orientation of the ruler.
- Parameters
-
| [in] | is_horizontal | Whether the ruler is horizontal (true) or vertical (false). |
◆ setLabel()
Sets a label to display on the ruler at the given location.
- Parameters
-
| [in] | label | The label text. |
| [in] | location | The 2D position for the label in normalized coordinates. |
References label().
◆ setLabelMode()
Sets the label display mode.
- Parameters
-
| [in] | mode | The label mode to use. |
◆ setLabelsVisible()
| void Ruler::setLabelsVisible |
( |
bool | visible | ) |
|
Sets whether tick mark labels are visible.
- Parameters
-
| [in] | visible | Whether labels should be shown. |
◆ setScroller()
| void Ruler::setScroller |
( |
QScrollArea * | scroll_area_target, |
|
|
fltp08 | scroll_scale = 1.0 ) |
Associates a scroll area with this ruler for synchronized scrolling.
- Parameters
-
| [in] | scroll_area_target | The scroll area to synchronize with. |
| [in] | scroll_scale | The scale factor applied to scroll offset calculations. |
◆ sizeHint()
| QSize Ruler::sizeHint |
( |
| ) |
const |
|
override |
Returns the recommended size for this widget.
- Returns
- The size hint.
◆ unit()
Returns the unit associated with the ruler's camera.
- Returns
- The unit.
◆ worldBounds()
Returns the world-space bounding box visible in the camera view.
- Returns
- The 3D world bounds.
◆ worldGridSpacing()
| fltp08 Ruler::worldGridSpacing |
( |
| ) |
const |
|
protected |
Returns the world-space spacing between grid lines or tick marks.
- Returns
- The grid spacing in world units.
◆ worldOffset()
| fltp08 Ruler::worldOffset |
( |
| ) |
const |
|
protected |
Returns the world-space offset for the start of the ruler.
- Returns
- The world offset.
◆ worldSpan()
| fltp08 Ruler::worldSpan |
( |
| ) |
const |
|
protected |
Returns the world-space span along this ruler's dimension.
- Returns
- The world span.
The documentation for this class was generated from the following file: