File indexing completed on 2024-05-12 15:59:14
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2012 Boudewijn Rempt <boud@kogmbh.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #ifndef KRITA_SKETCH_VIEW_H 0007 #define KRITA_SKETCH_VIEW_H 0008 0009 #include <QQuickItem> 0010 0011 #include "krita_sketch_export.h" 0012 0013 class KRITA_SKETCH_EXPORT KisSketchView : public QQuickItem 0014 { 0015 Q_OBJECT 0016 // Q_PROPERTY(QObject *selectionManager READ selectionManager NOTIFY viewChanged) 0017 // Q_PROPERTY(QObject *selectionExtras READ selectionExtras NOTIFY viewChanged) 0018 Q_PROPERTY(QObject *view READ view NOTIFY viewChanged) 0019 // Q_PROPERTY(QString file READ file WRITE setFile NOTIFY fileChanged) 0020 // Q_PROPERTY(QString fileTitle READ fileTitle NOTIFY fileChanged); 0021 // Q_PROPERTY(bool modified READ isModified NOTIFY modifiedChanged) 0022 0023 // Q_PROPERTY(bool canUndo READ canUndo NOTIFY canUndoChanged); 0024 // Q_PROPERTY(bool canRedo READ canRedo NOTIFY canRedoChanged); 0025 0026 // Q_PROPERTY(int imageHeight READ imageHeight NOTIFY imageSizeChanged) 0027 // Q_PROPERTY(int imageWidth READ imageWidth NOTIFY imageSizeChanged) 0028 0029 public: 0030 explicit KisSketchView(QQuickItem *parent = nullptr); 0031 ~KisSketchView() override; 0032 0033 QObject* selectionManager() const; 0034 QObject* selectionExtras() const; 0035 QObject* doc() const; 0036 QObject* view() const; 0037 QString file() const; 0038 QString fileTitle() const; 0039 bool isModified() const; 0040 0041 void componentComplete() override; 0042 void geometryChanged(const QRectF &newGeometry, 0043 const QRectF &oldGeometry) override; 0044 0045 void setFile(const QString &file); 0046 0047 void showFloatingMessage(const QString message, const QIcon& icon); 0048 0049 bool canUndo() const; 0050 bool canRedo() const; 0051 0052 int imageHeight() const; 0053 int imageWidth() const; 0054 0055 public Q_SLOTS: 0056 void undo(); 0057 void redo(); 0058 0059 void zoomIn(); 0060 void zoomOut(); 0061 0062 void save(); 0063 void saveAs(const QString& fileName, const QString& mimeType); 0064 0065 void documentAboutToBeDeleted(); 0066 void documentChanged(); 0067 void centerDoc(); 0068 0069 void activate(); 0070 0071 Q_SIGNALS: 0072 // This is directly forwarded from the document, which means that 0073 // value 0-100 means in progress 0074 // value -1 means completed 0075 void progress(int value); 0076 void viewChanged(); 0077 void fileChanged(); 0078 void modifiedChanged(); 0079 void floatingMessageRequested(const QString &message, const QString &iconName); 0080 void interactionStarted(); 0081 void loadingFinished(); 0082 void savingFinished(); 0083 void canUndoChanged(); 0084 void canRedoChanged(); 0085 void imageSizeChanged(); 0086 0087 protected: 0088 bool event(QEvent *event) override; 0089 // QT5TODO 0090 // virtual bool sceneEvent(QEvent* event); 0091 0092 private: 0093 class Private; 0094 Private * const d; 0095 0096 Q_PRIVATE_SLOT(d, void imageUpdated(const QRect &updated)) 0097 Q_PRIVATE_SLOT(d, void documentOffsetMoved()) 0098 Q_PRIVATE_SLOT(d, void zoomChanged()) 0099 Q_PRIVATE_SLOT(d, void resetDocumentPosition()) 0100 Q_PRIVATE_SLOT(d, void removeNodeAsync(KisNodeSP removedNode)) 0101 }; 0102 0103 #endif // KRITA_SKETCH_CANVAS_H