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

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

#include <KisUndoView.h>

+ Inheritance diagram for KisUndoView:

Public Slots

void setGroup (KUndo2Group *group)
 
void setStack (KUndo2QStack *stack)
 
void slotScrollerStateChanged (QScroller::State state)
 

Public Member Functions

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

Properties

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

Private Attributes

KisUndoViewPrivate *const d
 

Detailed Description

The KisUndoView class displays the contents of a KUndo2QStack.

Since
4.2

KisUndoView 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 KUndo2Group object can be set with setGroup(). The view will then update itself automatically whenever the active stack of the group changes.

Definition at line 65 of file KisUndoView.h.

Constructor & Destructor Documentation

◆ KisUndoView() [1/3]

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

Constructs a new view with parent parent.

Definition at line 112 of file KisUndoView.cpp.

113 : QListView(parent)
114 , d(new KisUndoViewPrivate)
115{
116 d->init(this);
117
118 QScroller *scroller = KisKineticScroller::createPreconfiguredScroller(this);
119 if (scroller) {
120 connect(scroller, SIGNAL(stateChanged(QScroller::State)),
121 this, SLOT(slotScrollerStateChanged(QScroller::State)));
122 }
123}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void init(KisUndoView *view)
KisUndoViewPrivate *const d
void slotScrollerStateChanged(QScroller::State state)
Definition KisUndoView.h:98
KRITAWIDGETUTILS_EXPORT QScroller * createPreconfiguredScroller(QAbstractScrollArea *target)

References connect(), KisKineticScroller::createPreconfiguredScroller(), d, KisUndoViewPrivate::init(), and slotScrollerStateChanged().

◆ KisUndoView() [2/3]

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

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

Definition at line 129 of file KisUndoView.cpp.

130 : KisUndoView(parent)
131{
133}
KisUndoView(QWidget *parent=0)
KUndo2QStack * stack() const
void setStack(KUndo2QStack *stack)

References setStack(), and stack().

◆ KisUndoView() [3/3]

KisUndoView::KisUndoView ( 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 143 of file KisUndoView.cpp.

144 : KisUndoView(parent)
145{
147}
KUndo2Group * group() const
void setGroup(KUndo2Group *group)

References group(), and setGroup().

◆ ~KisUndoView()

KisUndoView::~KisUndoView ( )
override

Destroys this view.

Definition at line 155 of file KisUndoView.cpp.

156{
157 delete d;
158
159}

References d.

Member Function Documentation

◆ cleanIcon()

QIcon KisUndoView::cleanIcon ( ) const

Definition at line 280 of file KisUndoView.cpp.

281{
282
283 return d->model->cleanIcon();
284}
QIcon cleanIcon() const
KisUndoModel * model

References KisUndoModel::cleanIcon(), d, and KisUndoViewPrivate::model.

◆ emptyLabel()

QString KisUndoView::emptyLabel ( ) const

Definition at line 257 of file KisUndoView.cpp.

258{
259
260 return d->model->emptyLabel();
261}
QString emptyLabel() const

References d, KisUndoModel::emptyLabel(), and KisUndoViewPrivate::model.

◆ group()

KUndo2Group * KisUndoView::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 234 of file KisUndoView.cpp.

235{
236
237 return d->group;
238}
QPointer< KUndo2Group > group

References d, and KisUndoViewPrivate::group.

◆ setCanvas()

void KisUndoView::setCanvas ( KisCanvas2 * canvas)

Definition at line 286 of file KisUndoView.cpp.

286 {
287 d->model->setCanvas(canvas);
288}
void setCanvas(KisCanvas2 *canvas)

References d, KisUndoViewPrivate::model, and KisUndoModel::setCanvas().

◆ setCleanIcon()

void KisUndoView::setCleanIcon ( const QIcon & icon)

Definition at line 273 of file KisUndoView.cpp.

274{
275
276 d->model->setCleanIcon(icon);
277
278}
void setCleanIcon(const QIcon &icon)

References d, KisUndoViewPrivate::model, and KisUndoModel::setCleanIcon().

◆ setEmptyLabel()

void KisUndoView::setEmptyLabel ( const QString & label)

Definition at line 251 of file KisUndoView.cpp.

252{
253
254 d->model->setEmptyLabel(label);
255}
void setEmptyLabel(const QString &label)

References d, KisUndoViewPrivate::model, and KisUndoModel::setEmptyLabel().

◆ setGroup

void KisUndoView::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 203 of file KisUndoView.cpp.

204{
205
206
207 if (d->group == group)
208 return;
209
210 if (d->group != 0) {
211 disconnect(d->group, SIGNAL(activeStackChanged(KUndo2QStack*)),
212 d->model, SLOT(setStack(KUndo2QStack*)));
213 }
214
215 d->group = group;
216
217 if (d->group != 0) {
218 connect(d->group, SIGNAL(activeStackChanged(KUndo2QStack*)),
219 d->model, SLOT(setStack(KUndo2QStack*)));
220 d->model->setStack(d->group->activeStack());
221 } else {
222 d->model->setStack(0);
223 }
224}
The KUndo2QStack class is a stack of KUndo2Command objects.
void setStack(KUndo2QStack *stack)

References connect(), d, KisUndoViewPrivate::group, group(), KisUndoViewPrivate::model, KisUndoModel::setStack(), and setStack().

◆ setStack

void KisUndoView::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 KUndo2Group, the group is set to 0.

See also
stack() setGroup()

Definition at line 183 of file KisUndoView.cpp.

184{
185
186#ifndef QT_NO_UNDOGROUP
187 setGroup(0);
188#endif
190}

References d, KisUndoViewPrivate::model, setGroup(), KisUndoModel::setStack(), and stack().

◆ slotScrollerStateChanged

void KisUndoView::slotScrollerStateChanged ( QScroller::State state)
inlineslot

Definition at line 98 of file KisUndoView.h.

KRITAWIDGETUTILS_EXPORT void updateCursor(QWidget *source, QScroller::State state)

References KisKineticScroller::updateCursor().

◆ stack()

KUndo2QStack * KisUndoView::stack ( ) const

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

See also
setStack() setGroup()

Definition at line 168 of file KisUndoView.cpp.

169{
170
171 return d->model->stack();
172}
KUndo2QStack * stack() const

References d, KisUndoViewPrivate::model, and KisUndoModel::stack().

Member Data Documentation

◆ d

KisUndoViewPrivate* const KisUndoView::d
private

Definition at line 102 of file KisUndoView.h.

Property Documentation

◆ cleanIcon

KisUndoView::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. KisUndoView 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 69 of file KisUndoView.h.

◆ emptyLabel

KisUndoView::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 68 of file KisUndoView.h.


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