Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_color_label_button.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Eoin O 'Neill <eoinoneill1991@gmail.com>
3 * SPDX-FileCopyrightText: 2020 Emmet O 'Neill <emmetoneill.pdx@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7#ifndef KISCOLORLABELBUTTON_H
8#define KISCOLORLABELBUTTON_H
9
10#include <QButtonGroup>
11#include <QAbstractButton>
12#include <QSet>
13
14#include "kritaui_export.h"
15
16class KRITAUI_EXPORT KisColorLabelButton : public QAbstractButton
17{
18 Q_OBJECT
19public:
24
25 KisColorLabelButton(QColor color, uint sizeSquared = 32, QWidget *parent = nullptr);
26 ~KisColorLabelButton() override;
27
28 void paintEvent(QPaintEvent* event) override;
29#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
30 void enterEvent(QEvent *event) override;
31#else
32 void enterEvent(QEnterEvent *event) override;
33#endif
34 void leaveEvent(QEvent *event) override;
35 QSize sizeHint() const override;
36 SelectionIndicationType selectionVisType() const;
37 void setSelectionVisType( SelectionIndicationType type );
38 void setSize(uint size);
39
40 void nextCheckState() override;
41
42private:
43 struct Private;
44 const QScopedPointer<Private> m_d;
45};
46
47
48class KRITAUI_EXPORT KisColorLabelFilterGroup : public QButtonGroup {
49 Q_OBJECT
50public:
51 KisColorLabelFilterGroup(QObject* parent);
53
54 QList<QAbstractButton*> viableButtons() const;
55 void setViableLabels(const QSet<int> &buttons);
56 void setViableLabels(const QList<int> &viableLabels);
57 QSet<int> getActiveLabels() const;
58
59 QList<QAbstractButton*> checkedViableButtons() const;
60 int countCheckedViableButtons() const;
61 int countViableButtons() const;
62
63 void setMinimumRequiredChecked( int checkedBtns );
64 int minimumRequiredChecked() const;
65
66public Q_SLOTS:
67 void reset();
68 void setAllVisibility(const bool vis);
69
70private:
71 void disableAll();
74
75};
76
77class KRITAUI_EXPORT KisColorLabelMouseDragFilter : public QObject {
78 enum State{
80 WaitingForDragLeave, //Waiting for mouse to exit first clicked while the mouse button is down.
81 WaitingForDragEnter //Waiting for mouse to slide across buttons within the same button group.
82 };
83
86
87public:
88 KisColorLabelMouseDragFilter(QObject *parent = nullptr);
89
90protected:
91 bool eventFilter(QObject *obj, QEvent *event) override;
92 void checkSlideOverNeighborButtons(QMouseEvent* mouseEvent, class QAbstractButton* startingButton);
93};
94
95
96#endif // KISCOLORLABELBUTTON_H
unsigned int uint
const QScopedPointer< Private > m_d
QString buttons(const T &ev)