KQuickImageEditor
7#include "imagedocument.h"
9#include "commands/cropcommand.h"
10#include "commands/mirrorcommand.h"
11#include "commands/resizecommand.h"
12#include "commands/rotatecommand.h"
14ImageDocument::ImageDocument(
QObject *parent)
17 connect(
this, &ImageDocument::pathChanged,
this, [
this](
const QUrl &url) {
20 Q_EMIT editedChanged();
21 Q_EMIT imageChanged();
27 while (!m_undos.empty()) {
28 const auto command = m_undos.pop();
29 m_image = command->undo(m_image);
41bool ImageDocument::edited()
const
48 Q_ASSERT(!m_undos.empty());
49 const auto command = m_undos.pop();
50 m_image = command->undo(m_image);
53 if (m_undos.empty()) {
61 m_image = command->redo(m_image);
62 m_undos.append(command);
70 m_image = command->redo(m_image);
71 m_undos.append(command);
79 m_image = command->redo(m_image);
80 m_undos.append(command);
88 transform.rotate(angle);
90 m_image = command->redo(m_image);
91 m_undos.append(command);
98 if (m_edited == value) {
108 return m_image.save(m_path.isLocalFile() ? m_path.toLocalFile() : m_path.toString());
113 return m_image.save(location.isLocalFile() ? location.toLocalFile() : location.
toString());
116QUrl ImageDocument::path()
const
121void ImageDocument::setPath(
const QUrl &path)
127#include "moc_imagedocument.cpp"
CropCommand that crop the current image.
Q_INVOKABLE void undo()
Undo the last edit on the images.
Q_INVOKABLE void rotate(int angle)
Rotate the image.
Q_INVOKABLE bool saveAs(const QUrl &location)
Save current edited image as a new image.
Q_INVOKABLE bool save()
Save current edited image in place.
Q_INVOKABLE void mirror(bool horizontal, bool vertical)
Mirror the image.
Q_INVOKABLE void crop(int x, int y, int width, int height)
Crop the image.
Q_INVOKABLE void cancel()
Cancel all the edit.
void setEdited(bool value)
Change the edited value.
Q_INVOKABLE void resize(int width, int height)
Resize the image.
MirrorCommand that mirror an image horizontally or vertically.
ResizeCommand that resizes the current image.
RotateCommand that rotates the current image.
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
bool isLocalFile() const const
QString toLocalFile() const const
QString toString(FormattingOptions options) const const
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:50:25 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.