Krita Source Code Documentation
Loading...
Searching...
No Matches
KisColorPatchesTableView.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Sharaf Zaman <shzam@sdf.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef __KISCOLORPATCHESTABLEVIEW_H_
8#define __KISCOLORPATCHESTABLEVIEW_H_
9
10#include <QAbstractItemModel>
11#include <QScroller>
12#include <QTableView>
13
14#include <KisKineticScroller.h>
15#include <KoColor.h>
16
17class KoColor;
18class KisCanvas2;
19
20class KisColorPatchesTableView : public QTableView
21{
22 Q_OBJECT
23public:
24 KisColorPatchesTableView(const QString &configPrefix, QWidget *parent = nullptr);
26
27 void setColors(const QList<KoColor> &colors);
28 void addColorPatch(const KoColor &color);
29 QList<KoColor> colors() const;
30 boost::optional<KoColor> colorPatchAt(const QPoint &pos) const;
31
32 QSize cellSize() const;
33 int patchCount() const;
34 void reloadWidgetConfig();
35
36 void wheelEvent(QWheelEvent *event) override;
37 void mousePressEvent(QMouseEvent *event) override;
38 void mouseReleaseEvent(QMouseEvent *event) override;
39
40public Q_SLOTS:
41 void slotScrollerStateChanged(QScroller::State state)
42 {
44 }
45
46private:
47 void redraw();
48
49private:
50 struct Private;
51 QScopedPointer<Private> m_d;
52};
53
54#endif // __KISCOLORPATCHESTABLEVIEW_H_
void mouseReleaseEvent(QMouseEvent *event) override
void setColors(const QList< KoColor > &colors)
void slotScrollerStateChanged(QScroller::State state)
void wheelEvent(QWheelEvent *event) override
boost::optional< KoColor > colorPatchAt(const QPoint &pos) const
void addColorPatch(const KoColor &color)
QScopedPointer< Private > m_d
void mousePressEvent(QMouseEvent *event) override
KisColorPatchesTableView(const QString &configPrefix, QWidget *parent=nullptr)
KRITAWIDGETUTILS_EXPORT void updateCursor(QWidget *source, QScroller::State state)