Krita Source Code Documentation
Loading...
Searching...
No Matches
WGColorPatches.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Mathias Wein <lynx.mw+kde@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7#ifndef WGCOLORPATCHES_H
8#define WGCOLORPATCHES_H
9
11
12#include <kis_types.h>
13
16class QToolButton;
17
18namespace WGConfig {
19struct ColorPatches;
20}
21
23{
24 Q_OBJECT
25public:
31
32 WGColorPatches(WGSelectorDisplayConfigSP displayConfig, KisUniqueColorSet *history, QWidget *parent = nullptr);
33
35 void updateSettings() override;
36 void setPreset(Preset preset);
37 QPoint popupOffset() const override;
43public Q_SLOTS:
44 void updateIcons();
45protected:
46 bool event(QEvent *event) override;
47 bool eventFilter(QObject *watched, QEvent *e) override;
48 void mouseMoveEvent(QMouseEvent *event) override;
49 void mousePressEvent(QMouseEvent *event) override;
50 void mouseReleaseEvent(QMouseEvent *event) override;
51 void wheelEvent(QWheelEvent *event) override;
52 void contentPaintEvent(QPaintEvent *event);
53 void resizeEvent(QResizeEvent *event) override;
54 QSize sizeHint() const override;
55
56 int indexAt(const QPoint &widgetPos) const;
57 QRect patchRect(int gridIndex) const;
58 QPoint scrollOffset() const;
59 void updateMetrics();
60 QToolButton* fetchButton(QList<QToolButton*> &recycleList);
62
63private:
66 Qt::Orientation m_orientation {Qt::Horizontal};
68 QWidget *m_viewport {0};
69 QWidget *m_contentWidget {0};
70 int m_numLines {1};
72 int m_totalLines {1};
73 int m_patchWidth {16};
74 int m_patchHeight {16};
75 int m_patchCount {30};
77 int m_maxScroll {0};
78 int m_mouseIndex {-1};
79 bool m_allowScrolling {true};
80 bool m_scrollInline {true};
82
83Q_SIGNALS:
84 void sigColorChanged(const KoColor &color);
85
86};
87
88#endif // WGCOLORPATCHES_H
The Preset class Preset is a resource object that stores brush preset data.
Definition Preset.h:35
QPoint popupOffset() const override
The position, relative to the top left corner, where the cursor of the cursor shall be when showing t...
QSize sizeHint() const override
void mousePressEvent(QMouseEvent *event) override
void setAdditionalButtons(QList< QToolButton * > buttonList)
QRect patchRect(int gridIndex) const
int indexAt(const QPoint &widgetPos) const
void resizeEvent(QResizeEvent *event) override
QWidget * m_contentWidget
QToolButton * fetchButton(QList< QToolButton * > &recycleList)
void sigColorChanged(const KoColor &color)
void setPreset(Preset preset)
bool eventFilter(QObject *watched, QEvent *e) override
bool event(QEvent *event) override
QPointer< KisUniqueColorSet > m_colors
QPoint scrollOffset() const
QList< QToolButton * > m_buttonList
void mouseMoveEvent(QMouseEvent *event) override
void contentPaintEvent(QPaintEvent *event)
QWidget * m_viewport
void updateSettings() override
void mouseReleaseEvent(QMouseEvent *event) override
void setColorHistory(KisUniqueColorSet *history)
WGColorPatches(WGSelectorDisplayConfigSP displayConfig, KisUniqueColorSet *history, QWidget *parent=nullptr)
Qt::Orientation m_orientation
const WGConfig::ColorPatches * m_configSource
void wheelEvent(QWheelEvent *event) override
void reconnectButtons(KisUniqueColorSet *oldSet, KisUniqueColorSet *newSet)
KisUniqueColorSet * colorHistory() const