Pencil2D Animation
Download
Community
News
Docs
Contribute
Overview
Articles
Code
Class List
Class Index
Class Hierarchy
Class Members
File List
Loading...
Searching...
No Matches
app
src
colorwheel.h
1
/*
2
3
Pencil2D - Traditional Animation Software
4
Copyright (C) 2012-2020 Matthew Chiawen Chang
5
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of the GNU General Public License
8
as published by the Free Software Foundation; version 2 of the License.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
*/
16
17
#ifndef COLORWHEEL_H
18
#define COLORWHEEL_H
19
20
#include <QWidget>
21
22
23
class
ColorWheel
:
public
QWidget
24
{
25
Q_OBJECT
26
public
:
27
explicit
ColorWheel
(
QWidget
*
parent
);
28
29
QColor
color();
30
31
signals:
32
void
colorSelected(
const
QColor
& color);
33
void
colorChanged(
const
QColor
& color);
34
35
public
slots:
36
void
setColor(
QColor
color);
37
38
protected
:
39
void
mousePressEvent(
QMouseEvent
*)
override
;
40
void
mouseMoveEvent(
QMouseEvent
*)
override
;
41
void
mouseReleaseEvent(
QMouseEvent
*)
override
;
42
void
resizeEvent(
QResizeEvent
*)
override
;
43
void
paintEvent(
QPaintEvent
*)
override
;
44
45
private
:
46
void
hueChanged(
const
int
& hue);
47
void
saturationChanged(
const
int
& sat);
48
void
valueChanged(
const
int
& value);
49
50
QColor
pickColor(
const
QPoint
& point);
51
52
void
drawHueIndicator(
const
int
& hue);
53
void
drawPicker(
const
QColor
& color);
54
55
void
drawWheelImage(
const
QSize
& newSize);
56
void
drawSquareImage(
const
int
& hue);
57
void
composeWheel(
QPixmap
& pixmap);
58
59
private
:
60
QSize
mInitSize{ 20, 20 };
61
QImage
mWheelImage;
62
QImage
mSquareImage;
63
QPixmap
mWheelPixmap;
64
65
int
mWheelThickness = 20;
66
QRect
mWheelRect;
67
QRect
mSquareRect;
68
QColor
mCurrentColor =
Qt::red
;
69
bool
mIsInWheel =
false
;
70
bool
mIsInSquare =
false
;
71
72
};
73
74
#endif
// COLORWHEEL_H
ColorWheel
Definition:
colorwheel.h:24
QColor
QImage
QMouseEvent
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::parent
QObject * parent() const const
QPaintEvent
QPixmap
QPoint
QRect
QResizeEvent
QSize
Qt::red
red
QWidget