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

CanvasSizeToolbar provides controls to configure the canvas size. More...

#include <CanvasSizeToolbarSection.h>

Inherited by PreviewCanvasSizeToolbarSection, and ReferenceCanvasSizeToolbarSection.

Classes

struct  CanvasSizePresets
 Simple encapsulation of canvas size width and height presets, along with descriptions. More...
 

Public Member Functions

 CanvasSizeToolbarSection (QToolBar *parent)
 
void InitWidgets (QToolBar *parent, bool addSeparator)
 
void SetInitialResolution (const AZ::Vector2 &canvasSize)
 
void SetIndex (int index)
 Change the combo box index. Called by undo/redo commands.
 
void SetCustomCanvasSize (AZ::Vector2 canvasSize, bool findPreset)
 Change the combo box index to that of the specified canvas size. Called by undo/redo commands.
 
const QString & IndexToString (int index)
 

Protected Types

typedef AZStd::vector< CanvasSizePresetsComboBoxOptions
 

Protected Member Functions

void ToggleLineEditBoxes ()
 Updates the state of the custom canvas size fields based on the currently selected index.
 
virtual void SetCanvasSizeByComboBoxIndex ()=0
 Sets the canvas size based on the current canvas ComboBox selection.
 
virtual void OnComboBoxIndexChanged (int index)=0
 Called when the user has changed the index.
 
virtual void AddSpecialPresets ()
 Add any special entries in the combo box.
 
bool ParseCanvasSizePresetsJson (const QJsonDocument &jsonDoc)
 Attempts to parse the canvas size presets JSON.
 
void InitCanvasSizePresets ()
 Initializes canvas size presets options via JSON file.
 
int GetPresetIndexFromSize (AZ::Vector2 size)
 Return a preset index based on specified canvas size.
 
void LineEditWidthEditingFinished ()
 Called when the user is finished entering text for custom canvas width size.
 
void LineEditHeightEditingFinished ()
 Called when the user is finished entering text for custom canvas height size.
 
void HandleIndexChanged ()
 Handle updates after index has changed.
 
int GetCustomSizeIndex ()
 

Protected Attributes

EditorWindowm_editorWindow
 
int m_comboIndex
 
bool m_isChangeUndoable
 
ComboBoxOptions m_canvasSizePresets
 
QComboBox * m_combobox
 
QLineEdit * m_lineEditCanvasWidth
 
QLabel * m_labelCustomSizeDelimiter
 
QLineEdit * m_lineEditCanvasHeight
 
QMetaObject::Connection m_lineEditCanvasWidthConnection
 
QMetaObject::Connection m_lineEditCanvasHeightConnection
 
QAction * m_canvasWidthAction
 
QAction * m_canvasDelimiterAction
 
QAction * m_canvasHeightAction
 

Detailed Description

CanvasSizeToolbar provides controls to configure the canvas size.

Member Function Documentation

◆ InitCanvasSizePresets()

void CanvasSizeToolbarSection::InitCanvasSizePresets ( )
protected

Initializes canvas size presets options via JSON file.

Falls back on hard-coded defaults if JSON file parsing fails.

◆ ParseCanvasSizePresetsJson()

bool CanvasSizeToolbarSection::ParseCanvasSizePresetsJson ( const QJsonDocument &  jsonDoc)
protected

Attempts to parse the canvas size presets JSON.

Returns
True if successful, false otherwise

◆ SetInitialResolution()

void CanvasSizeToolbarSection::SetInitialResolution ( const AZ::Vector2 &  canvasSize)

Given a canvas set, select a preset or automatically populate the custom canvas size text boxes

This method is called when loading a canvas

◆ ToggleLineEditBoxes()

void CanvasSizeToolbarSection::ToggleLineEditBoxes ( )
protected

Updates the state of the custom canvas size fields based on the currently selected index.

When "other..." is selected, the fields become visible and take focus. Otherwise, this method hides the fields (as they are not needed when using preset canvas sizes).


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