Krita Source Code Documentation
Loading...
Searching...
No Matches
KUndo2View Class Reference

The KUndo2View class displays the contents of a KUndo2QStack. More...

#include <kundo2view.h>

+ Inheritance diagram for KUndo2View:

Public Slots

void setGroup (KUndo2Group *group)
 
void setStack (KUndo2QStack *stack)
 

Public Member Functions

QIcon cleanIcon () const
 
QString emptyLabel () const
 
KUndo2Groupgroup () const
 
 KUndo2View (KUndo2Group *group, QWidget *parent=0)
 
 KUndo2View (KUndo2QStack *stack, QWidget *parent=0)
 
 KUndo2View (QWidget *parent=0)
 
void setCleanIcon (const QIcon &icon)
 
void setEmptyLabel (const QString &label)
 
KUndo2QStackstack () const
 
 ~KUndo2View () override
 

Properties

QIcon cleanIcon
 the icon used to represent the clean state.
 
QString emptyLabel
 the label used for the empty state.
 

Private Attributes

KUndo2ViewPrivate *const d
 

Detailed Description

The KUndo2View class displays the contents of a KUndo2QStack.

Since
4.2

KUndo2View is a QListView which displays the list of commands pushed on an undo stack. The most recently executed command is always selected. Selecting a different command results in a call to KUndo2QStack::setIndex(), rolling the state of the document backwards or forward to the new command.

The stack can be set explicitly with setStack(). Alternatively, a QUndoGroup object can be set with setGroup(). The view will then update itself automatically whenever the active stack of the group changes.

Definition at line 61 of file kundo2view.h.

Constructor & Destructor Documentation

◆ KUndo2View() [1/3]

KUndo2View::KUndo2View ( QWidget * parent = 0)
explicit

Constructs a new view with parent parent.

Definition at line 107 of file kundo2view.cpp.

107 : QListView(parent), d(new KUndo2ViewPrivate)
108{
109 d->init(this);
110}
void init(KUndo2View *view)
KUndo2ViewPrivate *const d
Definition kundo2view.h:93

References d, and KUndo2ViewPrivate::init().

◆ KUndo2View() [2/3]

KUndo2View::KUndo2View ( KUndo2QStack * stack,
QWidget * parent = 0 )
explicit

Constructs a new view with parent parent and sets the observed stack to stack.

Definition at line 116 of file kundo2view.cpp.

116 : QListView(parent), d(new KUndo2ViewPrivate)
117{
118 d->init(this);
120}
void setStack(KUndo2QStack *stack)
KUndo2QStack * stack() const

References d, KUndo2ViewPrivate::init(), setStack(), and stack().

◆ KUndo2View() [3/3]

KUndo2View::KUndo2View ( KUndo2Group * group,
QWidget * parent = 0 )
explicit

Constructs a new view with parent parent and sets the observed group to group.

The view will update itself automatically whenever the active stack of the group changes.

Definition at line 130 of file kundo2view.cpp.

130 : QListView(parent), d(new KUndo2ViewPrivate)
131{
132 d->init(this);
134}
KUndo2Group * group() const
void setGroup(KUndo2Group *group)

References d, group(), KUndo2ViewPrivate::init(), and setGroup().

◆ ~KUndo2View()

KUndo2View::~KUndo2View ( )
override

Destroys this view.

Definition at line 142 of file kundo2view.cpp.

143{
144 delete d;
145}

References d.

Member Function Documentation

◆ cleanIcon()

QIcon KUndo2View::cleanIcon ( ) const

Definition at line 266 of file kundo2view.cpp.

267{
268
269 return d->model->cleanIcon();
270}
QIcon cleanIcon() const
KUndo2Model * model

References KUndo2Model::cleanIcon(), d, and KUndo2ViewPrivate::model.

◆ emptyLabel()

QString KUndo2View::emptyLabel ( ) const

Definition at line 243 of file kundo2view.cpp.

244{
245
246 return d->model->emptyLabel();
247}
QString emptyLabel() const

References d, KUndo2Model::emptyLabel(), and KUndo2ViewPrivate::model.

◆ group()

KUndo2Group * KUndo2View::group ( ) const

Returns the group displayed by this view.

If the view is not looking at group, this function returns 0.

See also
setGroup() setStack()

Definition at line 220 of file kundo2view.cpp.

221{
222
223 return d->group;
224}
QPointer< KUndo2Group > group

References d, and KUndo2ViewPrivate::group.

◆ setCleanIcon()

void KUndo2View::setCleanIcon ( const QIcon & icon)

Definition at line 259 of file kundo2view.cpp.

260{
261
262 d->model->setCleanIcon(icon);
263
264}
void setCleanIcon(const QIcon &icon)

References d, KUndo2ViewPrivate::model, and KUndo2Model::setCleanIcon().

◆ setEmptyLabel()

void KUndo2View::setEmptyLabel ( const QString & label)

Definition at line 237 of file kundo2view.cpp.

238{
239
240 d->model->setEmptyLabel(label);
241}
void setEmptyLabel(const QString &label)

References d, KUndo2ViewPrivate::model, and KUndo2Model::setEmptyLabel().

◆ setGroup

void KUndo2View::setGroup ( KUndo2Group * group)
slot

Sets the group displayed by this view to group. If group is 0, the view will be empty.

The view will update itself automatically whenever the active stack of the group changes.

See also
group() setStack()

Definition at line 189 of file kundo2view.cpp.

190{
191
192
193 if (d->group == group)
194 return;
195
196 if (d->group != 0) {
197 disconnect(d->group, SIGNAL(activeStackChanged(KUndo2QStack*)),
198 d->model, SLOT(setStack(KUndo2QStack*)));
199 }
200
201 d->group = group;
202
203 if (d->group != 0) {
204 connect(d->group, SIGNAL(activeStackChanged(KUndo2QStack*)),
205 d->model, SLOT(setStack(KUndo2QStack*)));
206 d->model->setStack((KUndo2QStack *)d->group->activeStack());
207 } else {
208 d->model->setStack(0);
209 }
210}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void setStack(KUndo2QStack *stack)
The KUndo2QStack class is a stack of KUndo2Command objects.

References connect(), d, KUndo2ViewPrivate::group, group(), KUndo2ViewPrivate::model, KUndo2Model::setStack(), and setStack().

◆ setStack

void KUndo2View::setStack ( KUndo2QStack * stack)
slot

Sets the stack displayed by this view to stack. If stack is 0, the view will be empty.

If the view was previously looking at a QUndoGroup, the group is set to 0.

See also
stack() setGroup()

Definition at line 169 of file kundo2view.cpp.

170{
171
172#ifndef QT_NO_UNDOGROUP
173 setGroup(0);
174#endif
176}

References d, KUndo2ViewPrivate::model, setGroup(), KUndo2Model::setStack(), and stack().

◆ stack()

KUndo2QStack * KUndo2View::stack ( ) const

Returns the stack currently displayed by this view. If the view is looking at a QUndoGroup, this the group's active stack.

See also
setStack() setGroup()

Definition at line 154 of file kundo2view.cpp.

155{
156
157 return d->model->stack();
158}
KUndo2QStack * stack() const

References d, KUndo2ViewPrivate::model, and KUndo2Model::stack().

Member Data Documentation

◆ d

KUndo2ViewPrivate* const KUndo2View::d
private

Definition at line 93 of file kundo2view.h.

Property Documentation

◆ cleanIcon

KUndo2View::cleanIcon
readwrite

the icon used to represent the clean state.

A stack may have a clean state set with KUndo2QStack::setClean(). This is usually the state of the document at the point it was saved. KUndo2View can display an icon in the list of commands to show the clean state. If this property is a null icon, no icon is shown. The default value is the null icon.

Definition at line 65 of file kundo2view.h.

◆ emptyLabel

KUndo2View::emptyLabel
readwrite

the label used for the empty state.

The empty label is the topmost element in the list of commands, which represents the state of the document before any commands were pushed on the stack. The default is the string "<empty>".

Definition at line 64 of file kundo2view.h.


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