Palette

Search for usage in LXR

#include <Palette.h>

Inheritance diagram for Palette:

Public Slots

void addEntry (Swatch entry, QString groupName=QString())
 
void addGroup (QString name)
 
Q_DECL_DEPRECATED void changeGroupName (QString oldGroupName, QString newGroupName)
 
int colorsCountTotal ()
 
Q_DECL_DEPRECATED SwatchcolorSetEntryByIndex (int index)
 
Q_DECL_DEPRECATED SwatchcolorSetEntryFromGroup (int index, const QString &groupName)
 
int columnCount ()
 
QString comment ()
 
SwatchentryByIndex (int index)
 
SwatchentryByIndexFromGroup (int index, const QString &groupName)
 
QStringList groupNames () const
 
void moveGroup (const QString &groupName, const QString &groupNameInsertBefore=QString())
 
int numberOfEntries () const
 
void removeEntry (int index, const QString &groupName)
 
void removeGroup (QString name, bool keepColors=true)
 
void renameGroup (QString oldGroupName, QString newGroupName)
 
bool save ()
 
void setColumnCount (int columns)
 
void setComment (QString comment)
 

Public Member Functions

 Palette (Resource *resource, QObject *parent=0)
 
bool operator!= (const Palette &other) const
 
bool operator== (const Palette &other) const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

The Palette class Palette is a resource object that stores organised color data.

It's purpose is to allow artists to save colors and store them.

An example for printing all the palettes and the entries:

import sys
from krita import *
resources = Application.resources("palette")
for (k, v) in resources.items():
print(k)
palette = Palette(v)
for x in range(palette.numberOfEntries()):
entry = palette.colorSetEntryByIndex(x)
print(x, entry.name(), entry.id(), entry.spotColor())
The Palette class Palette is a resource object that stores organised color data.
Definition Palette.h:45
Q_DECL_DEPRECATED Swatch * colorSetEntryByIndex(int index)
colorSetEntryByIndex get the colorsetEntry from the global index.
Definition Palette.cpp:94

Definition at line 44 of file Palette.h.

Constructor & Destructor Documentation

◆ Palette()

Palette::Palette ( Resource * resource,
QObject * parent = 0 )
explicit

Definition at line 18 of file Palette.cpp.

◆ ~Palette()

Palette::~Palette ( )
override

Definition at line 24 of file Palette.cpp.

Member Function Documentation

◆ addEntry

void Palette::addEntry ( Swatch entry,
QString groupName = QString() )
slot

add a color entry to a group.

Color is appended to the end.

Parameters
entrythe entry
groupNamethe name of the group to add to.

Definition at line 125 of file Palette.cpp.

◆ addGroup

void Palette::addGroup ( QString name)
slot

Palette content can be organized in groups.

This method allows to add a new group in palette.

Parameters
nameThe name of the new group to add.

Definition at line 76 of file Palette.cpp.

◆ changeGroupName

void Palette::changeGroupName ( QString oldGroupName,
QString newGroupName )
slot

changeGroupName change the group name.

DEPRECATED: use renameGroup() instead

Parameters
oldGroupNamethe old groupname to change.
newGroupNamethe new name to change it into.
Returns
whether successful. Reasons for failure include not knowing have oldGroupName

Definition at line 150 of file Palette.cpp.

◆ colorsCountTotal

int Palette::colorsCountTotal ( )
slot

number of colors (swatches) in palette NOTE: same as numberOfEntries()

Returns
total number of colors

Definition at line 88 of file Palette.cpp.

◆ colorSetEntryByIndex

Swatch * Palette::colorSetEntryByIndex ( int index)
slot

colorSetEntryByIndex get the colorsetEntry from the global index.

DEPRECATED: use entryByIndex() instead

Parameters
indexthe global index
Returns
the colorset entry

Definition at line 94 of file Palette.cpp.

◆ colorSetEntryFromGroup

Swatch * Palette::colorSetEntryFromGroup ( int index,
const QString & groupName )
slot

colorSetEntryFromGroup

DEPRECATED: use entryByIndexFromGroup() instead

Parameters
indexindex in the group.
groupNamethe name of the group to get the color from.
Returns
the colorsetentry.

Definition at line 110 of file Palette.cpp.

◆ columnCount

int Palette::columnCount ( )
slot

Palettes are defined in grids.

The number of column define grid width. The number of rows will depend of columns and total number of entries.

Returns
the number of columns this palette is set to use.

Definition at line 46 of file Palette.cpp.

◆ comment

QString Palette::comment ( )
slot

the comment or description associated with the palette.

Returns
A string for which value contains the comment/description of palette.

Definition at line 58 of file Palette.cpp.

◆ entryByIndex

Swatch * Palette::entryByIndex ( int index)
slot

get color (swatch) from the global index.

Parameters
indexthe global index
Returns
The Swatch color for given index.

Definition at line 100 of file Palette.cpp.

◆ entryByIndexFromGroup

Swatch * Palette::entryByIndexFromGroup ( int index,
const QString & groupName )
slot

get color (swatch) from the given group index.

Parameters
indexindex in the group.
groupNamethe name of the group to get the color from.
Returns
The Swatch color for given index within given group name.

Definition at line 116 of file Palette.cpp.

◆ groupNames

QStringList Palette::groupNames ( ) const
slot

Palette content can be organized in groups.

Returns
The list of group names (list of string). This list follow the order the groups are defined in palette.

Definition at line 70 of file Palette.cpp.

◆ moveGroup

void Palette::moveGroup ( const QString & groupName,
const QString & groupNameInsertBefore = QString() )
slot

Move the group groupName to position before group groupNameInsertBefore.

Parameters
groupNamegroup to move.
groupNameInsertBeforereference group for which groupName have to be moved before.

Definition at line 161 of file Palette.cpp.

◆ numberOfEntries

int Palette::numberOfEntries ( ) const
slot

number of colors (swatches) in palette NOTE: same as colorsCountTotal()

Returns
total number of colors

Definition at line 40 of file Palette.cpp.

◆ operator!=()

bool Palette::operator!= ( const Palette & other) const

Definition at line 34 of file Palette.cpp.

◆ operator==()

bool Palette::operator== ( const Palette & other) const

Definition at line 29 of file Palette.cpp.

◆ removeEntry

void Palette::removeEntry ( int index,
const QString & groupName )
slot

remove from defined group a color entry designed by given index.

Parameters
indexindex in the group.
groupNamethe name of the group within which color have to be removed.

Definition at line 130 of file Palette.cpp.

◆ removeGroup

void Palette::removeGroup ( QString name,
bool keepColors = true )
slot

Palette content can be organized in groups.

This method allows to remove an existing group from palette.

Parameters
nameThe name of the new group to remve.
keepColorswhether or not to delete all the colors inside, or to move them to the default group.

Definition at line 82 of file Palette.cpp.

◆ renameGroup

void Palette::renameGroup ( QString oldGroupName,
QString newGroupName )
slot

rename a group

Parameters
oldGroupNamethe old groupname to change.
newGroupNamethe new name to change it into.

Definition at line 156 of file Palette.cpp.

◆ save

bool Palette::save ( )
slot

save the palette

WARNING: this method does nothing and need to be implemented!

Returns
always False

Definition at line 166 of file Palette.cpp.

◆ setColumnCount

void Palette::setColumnCount ( int columns)
slot

Palettes are defined in grids.

The number of column define grid width, this value can be defined. The number of rows will depend of columns and total number of entries.

Parameters
columnsSet the amount of columns this palette should use.

Definition at line 52 of file Palette.cpp.

◆ setComment

void Palette::setComment ( QString comment)
slot

the comment or description associated with the palette.

Parameters
commentset the comment or description associated with the palette.

Definition at line 64 of file Palette.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.