Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_custom_brush_widget.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2005 Bart Coppens <kde@bartcoppens.be>
3 * SPDX-FileCopyrightText: 2026 Freya Lupen <penguinflyer2222@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8#ifndef KIS_CUSTOM_BRUSH_H_
9#define KIS_CUSTOM_BRUSH_H_
10
11#include <QDialog>
12
13#include "kis_config_widget.h"
14#include "kis_types.h"
15#include "KoResourceServer.h"
16
17class QLabel;
18class QDialogButtonBox;
19
20class KisBrush;
21
22class KisCustomBrushWidget : public QDialog
23{
24 Q_OBJECT
25public:
26 KisCustomBrushWidget(QWidget *parent, const QString& caption);
27 virtual ~KisCustomBrushWidget();
28
29private Q_SLOTS:
30 // Swaps the brush widget and reloads the brush.
31 void slotSourceChanged(int source);
32
33 void slotReload();
34
35 // Exports the brushtip and adds it to the resource server.
36 void slotAddPredefined();
37
39
40 // Responds to the the export configuration changing.
41 void slotUpdateBrush();
42
43Q_SIGNALS:
45
46private:
47 // @returns the brush widget that should be shown according to m_clipboard.
49
50 // @returns the brush widget that should not be shown according to m_clipboard.
52
53 /* Swaps between GBR (non-animated) and GIH (animated) brush widgets.
54 * Clipboard source doesn't support animated and shows the GBR widget,
55 * otherwise the GIH widget allowing animated is shown.
56 */
57 void swapBrushWidget();
58
59 // @returns the current view's image.
62
63 // @returns a temporary filepath to export to with the proper filename and extension.
64 QString fileName();
65
66 // Caches the device(s) used for the brushtip from the image or clipboard.
67 void loadImage();
68
69 /* Updates the preview thumbnail if brush style, use mask, or preserve alpha
70 * have changed, or if updateDev indicates the paint device has changed.
71 * @param updateDev whether the paint device has changed.
72 */
73 void updatePreviewImage(bool updateDev);
74
75 QLabel* m_preview {nullptr};
78 QDialogButtonBox* m_buttonBox {nullptr};
79
81 QRect m_devRect;
85
87
88 bool m_useClipboard {false};
90};
91
92
93#endif // KIS_CUSTOM_BRUSH_H_
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
KisPropertiesConfigurationSP m_oldConfig
void sigNewPredefinedBrush(KoResourceSP)
KisConfigWidget * m_animBrushWidget
const KoColorSpace * m_imageColorSpace
QDialogButtonBox * m_buttonBox
KisConfigWidget * currentBrushWidget()
KisConfigWidget * m_brushWidget
KoResourceServer< KisBrush > * m_rServer
KisCustomBrushWidget(QWidget *parent, const QString &caption)
void updatePreviewImage(bool updateDev)
QVector< QVector< KisPaintDevice * > > m_devices
KisConfigWidget * otherBrushWidget()