Open 3D Engine AzQtComponents 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.
AzQtComponents::Palette Class Reference

#include <Palette.h>

Public Member Functions

 Palette (const Palette &)=default
 
 Palette (Palette &&)=default
 
 Palette (const QVector< AZ::Color > &colors)
 
Paletteoperator= (const Palette &other)=default
 
bool save (const QString &fileName) const
 
bool save (QIODevice *device) const
 
bool save (QMimeData *mimeData) const
 
bool load (const QString &fileName)
 
bool load (QIODevice *device)
 
bool load (const QMimeData *mimeData)
 
bool tryInsertColor (int index, const AZ::Color &color)
 
bool tryInsertColors (int index, const QVector< AZ::Color > &colors)
 
bool tryInsertColors (int index, QVector< AZ::Color >::const_iterator first, QVector< AZ::Color >::const_iterator last)
 
bool tryAppendColor (const AZ::Color &color)
 
bool tryAppendColors (const QVector< AZ::Color > &colors)
 
bool tryAppendColors (QVector< AZ::Color >::const_iterator first, QVector< AZ::Color >::const_iterator last)
 
bool tryRemoveColors (int index, int count=1)
 
bool trySetColor (int index, const AZ::Color &color)
 
bool containsColor (const AZ::Color &color)
 Check whether a color is present in the palette.
 
bool containsAnyColor (const QVector< AZ::Color > &colors)
 Check whether any of the specified colors are present in the palette.
 
bool containsAnyColor (QVector< AZ::Color >::const_iterator first, QVector< AZ::Color >::const_iterator last)
 Check whether any of the specified colors are present in the palette.
 
bool isValid () const
 
const QVector< AZ::Color > & colors () const
 

Protected Member Functions

void insertColorsIgnoringDuplicates (int index, QVector< AZ::Color >::const_iterator first, QVector< AZ::Color >::const_iterator last)
 

Friends

class PaletteModel
 
QDataStream & operator<< (QDataStream &out, const Palette &palette)
 
QDataStream & operator>> (QDataStream &in, Palette &palette)
 

Detailed Description

A collection of colors and associated information. Duplicate colors are not permitted within a palette, with comparison between colors being defined by AZ::Color::IsClose.

Member Function Documentation

◆ insertColorsIgnoringDuplicates()

void AzQtComponents::Palette::insertColorsIgnoringDuplicates ( int  index,
QVector< AZ::Color >::const_iterator  first,
QVector< AZ::Color >::const_iterator  last 
)
protected

Used by PaletteModel to insert potentially duplicate colors during drag & drop operations The reason is that the model sees two changes for an internal drag that repositions items: The first is a removal of the moved items and the second is the insertion of them in their new location.

◆ isValid()

bool AzQtComponents::Palette::isValid ( ) const

Check whether the palette is valid Currently this is only a check for duplicate colors.

◆ tryAppendColor()

bool AzQtComponents::Palette::tryAppendColor ( const AZ::Color &  color)

Attempt to append a color to the palette. Attempts to append a duplicate color (according to AZ::Color::IsClose) will be rejected.

◆ tryAppendColors() [1/2]

bool AzQtComponents::Palette::tryAppendColors ( const QVector< AZ::Color > &  colors)

Attempt to append several colors to the palette. Attempts to append a duplicate color (according to AZ::Color::IsClose) will cause the entire append to be rejected.

◆ tryAppendColors() [2/2]

bool AzQtComponents::Palette::tryAppendColors ( QVector< AZ::Color >::const_iterator  first,
QVector< AZ::Color >::const_iterator  last 
)

Attempt to append several colors to the palette. Attempts to append a duplicate color (according to AZ::Color::IsClose) will cause the entire append to be rejected.

◆ tryInsertColor()

bool AzQtComponents::Palette::tryInsertColor ( int  index,
const AZ::Color &  color 
)

Attempt to insert a color at the specified position. Attempts to insert duplicate colors (according to AZ::Color::IsClose) will be rejected.

◆ tryInsertColors() [1/2]

bool AzQtComponents::Palette::tryInsertColors ( int  index,
const QVector< AZ::Color > &  colors 
)

Attempt to insert several colors at the specified position. Attempts to insert a duplicate color (according to AZ::Color::IsClose) will cause the entire insertion to be rejected.

◆ tryInsertColors() [2/2]

bool AzQtComponents::Palette::tryInsertColors ( int  index,
QVector< AZ::Color >::const_iterator  first,
QVector< AZ::Color >::const_iterator  last 
)

Attempt to insert several colors at the specified position. Attempts to insert a duplicate color (according to AZ::Color::IsClose) will cause the entire insertion to be rejected.

◆ tryRemoveColors()

bool AzQtComponents::Palette::tryRemoveColors ( int  index,
int  count = 1 
)

Remove colors from the palette. The color at index will be removed, along with count - 1 that follow it. All indices must be valid in order for the removal to succeed.


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