Open 3D Engine LyShine Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
RulerWidget Class Reference

The RulerWidget is drawn above or to the left of the ViewportWidget. More...

#include <RulerWidget.h>

Inherits QWidget.

Public Types

enum class  Orientation { Horizontal , Vertical }
 

Public Member Functions

 RulerWidget (Orientation orientation, QWidget *parent, EditorWindow *editorWindow)
 
Orientation GetOrientation ()
 Get the orientation of this ruler.
 
float GetOrigin ()
 Get the origin position in canvas space of the ruler scale.
 
void SetCursorPos (const QPoint &pos)
 Tell the ruler where the cursor is in global Qt space.
 
void DrawForViewport (Draw2dHelper &draw2d)
 Draw anything needed in the viewport (during adding of a guide for example)
 

Static Public Member Functions

static int GetRulerBreadth ()
 Get the the desired breadth of the ruler widgets when shown.
 

Protected Member Functions

void paintEvent (QPaintEvent *event) override
 We have a custom paintEvent to draw the tick marks and labels.
 
void mousePressEvent (QMouseEvent *ev) override
 We handle mouse press events for adding guides.
 
void mouseMoveEvent (QMouseEvent *ev) override
 We get this after pressing the mouse in the ruler, even if mouse is over viewport.
 
void mouseReleaseEvent (QMouseEvent *ev) override
 We get this after pressing the mouse in the ruler, even if mouse if over viewport.
 
void focusOutEvent (QFocusEvent *ev) override
 We need this to cancel the interaction if RMB or a Alt+char combo is pressed.
 
void DrawTickMarksWithLabels (QPainter *painter, QRectF rulerRect, float translation, float scale)
 Draw the tick marks and text on the ruler.
 
void DrawRulerSection (QPainter *painter, QRectF rulerRect, float startInCanvasPixels, float sectionLengthInScreenPixels, int numSubdivisions, float translation, float scale)
 Draw one section of the ruller scale - a ssection has one major tick mark with a label plus some smaller tick marks.
 
void DrawCursorPos (QPainter *painter, QRectF rulerRect)
 Draw the line on the rule that shows where the mouse is.
 

Detailed Description

The RulerWidget is drawn above or to the left of the ViewportWidget.


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