Krita Source Code Documentation
Loading...
Searching...
No Matches
KisScreenColorSampler.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KISSCREENCOLORSAMPLER_H
7#define KISSCREENCOLORSAMPLER_H
8
9#include <QScopedPointer>
10#include <QEvent>
11#include <QMouseEvent>
12
13#include "KoColor.h"
15
16#include "kritaui_export.h"
17
24{
25 Q_OBJECT
26public:
27 explicit KisScreenColorSampler(bool showInfoLabel = false, QWidget *parent = 0);
28 ~KisScreenColorSampler() override;
29
30 KoColor currentColor();
31
32 bool handleColorSamplingMouseMove(QMouseEvent *e);
33 bool handleColorSamplingMouseButtonRelease(QMouseEvent *e);
34 bool handleColorSamplingKeyPress(QKeyEvent *e);
35
37 void updateIcons() override;
38
39 bool performRealColorSamplingOfCanvas() const;
40
41 static KisScreenColorSampler *createScreenColorSampler(QWidget *parent = 0) {return new KisScreenColorSampler(parent);}
42
43Q_SIGNALS:
46
47public Q_SLOTS:
48 void sampleScreenColor();
49 void setPerformRealColorSamplingOfCanvas(bool enable);
50 void setCurrentColor(KoColor c);
51 void cancel();
52
53private Q_SLOTS:
54 void updateColorSampling();
55protected:
56 void changeEvent(QEvent *event) override;
57private:
58 struct Private; //The private struct
59 const QScopedPointer<Private> m_d; //the private pointer
60
61 KoColor grabScreenColor(const QPoint &p);
62 void updateColorLabelText(const QPoint &globalPos);
63 void releaseColorSampling();
64 void continueUpdateColorSampling(const QPoint &globalPos);
65};
66
67class KisScreenColorSamplingEventFilter : public QObject {
68public:
69 explicit KisScreenColorSamplingEventFilter(KisScreenColorSampler *w, QObject *parent = 0);
70
71 bool eventFilter(QObject *, QEvent *event) override;
72private:
74};
75
76#endif // KISSCREENCOLORSAMPLER_H
const Params2D p
virtual void updateIcons()=0
reloads icon(s) when theme is updated
The KisScreenColorSampler class Based on the original QColorDialog's screen color picker,...
void sigNewColorHovered(KoColor c)
const QScopedPointer< Private > m_d
void sigNewColorSampled(KoColor c)
static KisScreenColorSampler * createScreenColorSampler(QWidget *parent=0)
bool eventFilter(QObject *, QEvent *event) override
KisScreenColorSamplingEventFilter(KisScreenColorSampler *w, QObject *parent=0)