Scribus
Open source desktop publishing at your fingertips
|
SimpleState provides a simple implementation of the UndoState. More...
#include <undostate.h>
Public Member Functions | |
SimpleState (const QString &name, const QString &description=0, QPixmap *pixmap=0) | |
Creates a new SimpleState instance. More... | |
bool | contains (const QString &key) |
Returns true if parameter key exists in the map. More... | |
QString | get (const QString &key, const QString &def="") |
Returns the QString value attached to the key. More... | |
int | getInt (const QString &key, int def=0) |
Returns the int value attached to the key. More... | |
uint | getUInt (const QString &key, uint def=0) |
Returns the uint value attached to the key. More... | |
double | getDouble (const QString &key, double def=0.0) |
Returns the double value attached to the key. More... | |
bool | getBool (const QString &key, bool def=false) |
Returns the boolean value attached to the key. More... | |
void | set (const QString &key, const QString &value) |
Set a value for the key. More... | |
void | set (const QString &key, int value) |
Set a value for the key. More... | |
void | set (const QString &key, uint value) |
Set a value for the key. More... | |
void | set (const QString &key, double value) |
Set a value for the key. More... | |
void | set (const QString &key, bool value) |
Set a value for the key. More... | |
Public Member Functions inherited from UndoState | |
UndoState (const QString &name, const QString &description=0, QPixmap *pixmap=0) | |
Creates a new UndoState instance. More... | |
virtual QString | getName () |
Returns name of the state (action). More... | |
virtual void | setName (const QString &newName) |
Set the name for this UndoState. More... | |
virtual QString | getDescription () |
Returns description of the state. More... | |
virtual void | setDescription (const QString &newDescription) |
Set the description for this UndoState. More... | |
virtual QPixmap * | getPixmap () |
Returns a pointer to the icon attached to the state. More... | |
virtual void | setPixmap (QPixmap *newPixmap) |
Set the icon for this UndoState. More... | |
virtual void | undo () |
undo the state described by this UndoState, More... | |
virtual void | redo () |
redo the state described by this UndoState, More... | |
virtual bool | isTransaction () |
To know if the state is a transaction. | |
virtual void | setUndoObject (UndoObject *object) |
Set the UndoObject this state belongs to. | |
virtual UndoObject * | undoObject () |
return the UndoObject this state belongs to | |
Additional Inherited Members | |
Public Attributes inherited from UndoState | |
int | transactionCode |
SimpleState provides a simple implementation of the UndoState.
SimpleState uses a QMap
to store key-value pairs that can be queried and set using it's get() and set() methods.
SimpleState::SimpleState | ( | const QString & | name, |
const QString & | description = 0 , |
||
QPixmap * | pixmap = 0 |
||
) |
Creates a new SimpleState instance.
name | Name of the state (action). Will be used when describing the state in UndoGui subclasses. |
description | Description of the state (action) |
pixmap | Pointer to an icon describing the state (action) visually. |
bool SimpleState::contains | ( | const QString & | key | ) |
Returns true if parameter key exists in the map.
key | Key that is searched from the map |
QString SimpleState::get | ( | const QString & | key, |
const QString & | def = "" |
||
) |
Returns the QString value attached to the key.
If key is not found from the map it will be added there with the value given as a parameter def. In such case def
will also be returned.
key | Key that is searched from the map |
def | Default value to be used if key is not found from the map |
def
which is then returned. bool SimpleState::getBool | ( | const QString & | key, |
bool | def = false |
||
) |
Returns the boolean value attached to the key.
Values are stored as QString
s in the map and when queried with this method value attached to the key is converted to a bool. If the conversion fails value of the parameter def
will be returned. If key is not found from the map it will be added there with the value given as a parameter def. In such case def
will also be returned.
key | Key that is searched from the map |
def | Default value to be used if key is not found from the map |
Bool
value attached to the key in the map. If the key is not found from the map it will be added with the value described in the parameter def
which is then returned. double SimpleState::getDouble | ( | const QString & | key, |
double | def = 0.0 |
||
) |
Returns the double value attached to the key.
Values are stored as QString
s in the map and when queried with this method value attached to the key is converted to a double. If the conversion fails value of the parameter def
will be returned. If key is not found from the map it will be added there with the value given as a parameter def. In such case def
will also be returned.
key | Key that is searched from the map |
def | Default value to be used if key is not found from the map |
Double
value attached to the key in the map. If the key is not found from the map it will be added with the value described in the parameter def
which is then returned. int SimpleState::getInt | ( | const QString & | key, |
int | def = 0 |
||
) |
Returns the int value attached to the key.
Values are stored as QString
s in the map and when queried with this method value attached to the key is converted to an int. If the conversion fails value of the parameter def
will be returned. If key is not found from the map it will be added there with the value given as a parameter def
. In such case def
will also be returned.
key | Key that is searched from the map |
def | Default value to be used if key is not found from the map |
int
value attached to the key in the map. If the key is not found from the map it will be added with the value described in the param def
which is then returned. uint SimpleState::getUInt | ( | const QString & | key, |
uint | def = 0 |
||
) |
Returns the uint value attached to the key.
Values are stored as QString
s in the map and when queried with this method value attached to the key is converted to an int. If the conversion fails value of the parameter def
will be returned. If key is not found from the map it will be added there with the value given as a parameter def
. In such case def
will also be returned.
key | Key that is searched from the map |
def | Default value to be used if key is not found from the map |
uint
value attached to the key in the map. If the key is not found from the map it will be added with the value described in the param def
which is then returned. void SimpleState::set | ( | const QString & | key, |
const QString & | value | ||
) |
Set a value for the key.
key | Key that can be later used to query the value. |
value | Value attached to the key. |
void SimpleState::set | ( | const QString & | key, |
int | value | ||
) |
Set a value for the key.
key | Key that can be later used to query the value. |
value | Value attached to the key. |
void SimpleState::set | ( | const QString & | key, |
uint | value | ||
) |
Set a value for the key.
key | Key that can be later used to query the value. |
value | Value attached to the key. |
void SimpleState::set | ( | const QString & | key, |
double | value | ||
) |
Set a value for the key.
key | Key that can be later used to query the value. |
value | Value attached to the key. |
void SimpleState::set | ( | const QString & | key, |
bool | value | ||
) |
Set a value for the key.
key | Key that can be later used to query the value. |
value | Value attached to the key. |