hydrogen
1.2.3
ColorSelectionButton.h
Go to the documentation of this file.
1
/*
2
* Hydrogen
3
* Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
4
*
5
* http://www.hydrogen-music.org
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY, without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
*
21
*/
22
23
24
#ifndef COLORSELECTIONBUTTON_H
25
#define COLORSELECTIONBUTTON_H
26
27
28
#include <
core/Object.h
>
29
#include <
core/Preferences/Preferences.h
>
30
31
#include <QtGui>
32
#include <QPushButton>
33
#include <QColor>
34
40
class
ColorSelectionButton
:
public
QPushButton,
public
H2Core::Object
<ColorSelectionButton>
41
{
42
H2_OBJECT
(
ColorSelectionButton
)
43
Q_OBJECT
44
45
public
:
46
ColorSelectionButton
( QWidget *pParent, QColor sInitialColor = Qt::black,
int
nSize = 0 );
47
~ColorSelectionButton
();
48
49
QColor
getColor
()
const
;
50
void
setColor
(
const
QColor& color );
51
52
signals:
53
void
colorChanged
();
54
55
private
:
56
bool
m_bMouseOver
;
57
58
virtual
void
mousePressEvent
(QMouseEvent *ev)
override
;
59
virtual
void
enterEvent
(QEvent *ev)
override
;
60
virtual
void
leaveEvent
(QEvent *ev)
override
;
61
virtual
void
paintEvent
( QPaintEvent* ev)
override
;
62
63
QColor
m_sColor
;
64
};
65
66
inline
QColor
ColorSelectionButton::getColor
()
const
{
67
return
m_sColor
;
68
}
69
70
#endif
Object.h
H2_OBJECT
#define H2_OBJECT(name)
Definition
Object.h:224
Preferences.h
ColorSelectionButton
QPushButton opening a QColorDialog when clicked and displaying the selected color as background - wit...
Definition
ColorSelectionButton.h:41
ColorSelectionButton::mousePressEvent
virtual void mousePressEvent(QMouseEvent *ev) override
Definition
ColorSelectionButton.cpp:45
ColorSelectionButton::getColor
QColor getColor() const
Definition
ColorSelectionButton.h:66
ColorSelectionButton::m_sColor
QColor m_sColor
Definition
ColorSelectionButton.h:63
ColorSelectionButton::ColorSelectionButton
ColorSelectionButton(QWidget *pParent, QColor sInitialColor=Qt::black, int nSize=0)
Definition
ColorSelectionButton.cpp:28
ColorSelectionButton::leaveEvent
virtual void leaveEvent(QEvent *ev) override
Definition
ColorSelectionButton.cpp:71
ColorSelectionButton::setColor
void setColor(const QColor &color)
Definition
ColorSelectionButton.cpp:66
ColorSelectionButton::colorChanged
void colorChanged()
ColorSelectionButton::paintEvent
virtual void paintEvent(QPaintEvent *ev) override
Definition
ColorSelectionButton.cpp:77
ColorSelectionButton::~ColorSelectionButton
~ColorSelectionButton()
Definition
ColorSelectionButton.cpp:42
ColorSelectionButton::m_bMouseOver
bool m_bMouseOver
Definition
ColorSelectionButton.h:56
ColorSelectionButton::enterEvent
virtual void enterEvent(QEvent *ev) override
Definition
ColorSelectionButton.cpp:59
H2Core::Object
Definition
Object.h:178
src
gui
src
Widgets
ColorSelectionButton.h
Generated by
1.10.0