svgui
1.9
LEDButton.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3
/*
4
Sonic Visualiser
5
An audio file viewer and annotation editor.
6
Centre for Digital Music, Queen Mary, University of London.
7
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License as
10
published by the Free Software Foundation; either version 2 of the
11
License, or (at your option) any later version. See the file
12
COPYING included with this distribution for more information.
13
*/
14
15
/*
16
This is a modified version of a source file from the KDE
17
libraries. Copyright (c) 1998-2004 Jörg Habenicht, Richard J
18
Moore and others, distributed under the GNU Lesser General Public
19
License.
20
21
Ported to Qt4 by Chris Cannam.
22
23
The original KDE widget comes in round and rectangular and flat,
24
raised, and sunken variants. This version retains only the round
25
sunken variant. This version also implements a simple button API.
26
*/
27
28
#ifndef _LED_BUTTON_H_
29
#define _LED_BUTTON_H_
30
31
#include <QWidget>
32
#include "base/Debug.h"
33
34
class
QColor;
35
36
class
LEDButton
:
public
QWidget
37
{
38
Q_OBJECT
39
Q_PROPERTY(QColor
color
READ
color
WRITE
setColor
)
40
Q_PROPERTY(
int
darkFactor
READ
darkFactor
WRITE
setDarkFactor
)
41
42
public:
43
LEDButton
(QWidget *parent = 0);
44
LEDButton
(const QColor &col, QWidget *parent = 0);
45
LEDButton
(const QColor& col,
bool
state
, QWidget *parent = 0);
46
~
LEDButton
();
47
48
bool
state
() const;
49
QColor
color
() const;
50
int
darkFactor
() const;
51
52
virtual QSize
sizeHint
() const;
53
virtual QSize
minimumSizeHint
() const;
54
55
signals:
56
void
stateChanged
(
bool
);
57
58
void
mouseEntered
();
59
void
mouseLeft
();
60
61
public slots:
62
void
toggle
();
63
void
on
();
64
void
off
();
65
66
void
setState
(
bool
);
67
void
toggleState
();
68
void
setColor
(const QColor&
color
);
69
void
setDarkFactor
(
int
darkfactor);
70
71
protected:
72
void
paintEvent
(QPaintEvent *);
73
void
mousePressEvent
(QMouseEvent *);
74
void
enterEvent
(QEvent *);
75
void
leaveEvent
(QEvent *);
76
77
bool
led_state
;
78
QColor
led_color
;
79
80
class
LEDButtonPrivate
;
81
LEDButtonPrivate
*
d
;
82
};
83
84
#endif
LEDButton::LEDButtonPrivate
Definition:
LEDButton.cpp:35
LEDButton::paintEvent
void paintEvent(QPaintEvent *)
Definition:
LEDButton.cpp:120
LEDButton::mouseEntered
void mouseEntered()
LEDButton::minimumSizeHint
virtual QSize minimumSizeHint() const
Definition:
LEDButton.cpp:355
LEDButton::enterEvent
void enterEvent(QEvent *)
Definition:
LEDButton.cpp:108
LEDButton::on
void on()
Definition:
LEDButton.cpp:337
LEDButton::leaveEvent
void leaveEvent(QEvent *)
Definition:
LEDButton.cpp:114
LEDButton::d
LEDButtonPrivate * d
Definition:
LEDButton.h:80
LEDButton::mouseLeft
void mouseLeft()
LEDButton::setDarkFactor
void setDarkFactor(int darkfactor)
Definition:
LEDButton.cpp:315
LEDButton::toggle
void toggle()
Definition:
LEDButton.cpp:331
LEDButton::off
void off()
Definition:
LEDButton.cpp:343
LEDButton::led_color
QColor led_color
Definition:
LEDButton.h:78
LEDButton::darkFactor
int darkFactor() const
LEDButton::color
QColor color() const
LEDButton::led_state
bool led_state
Definition:
LEDButton.h:77
LEDButton::toggleState
void toggleState()
Definition:
LEDButton.cpp:293
LEDButton::sizeHint
virtual QSize sizeHint() const
Definition:
LEDButton.cpp:349
LEDButton::setState
void setState(bool)
Definition:
LEDButton.cpp:283
LEDButton::stateChanged
void stateChanged(bool)
LEDButton::mousePressEvent
void mousePressEvent(QMouseEvent *)
Definition:
LEDButton.cpp:95
LEDButton
Definition:
LEDButton.h:36
LEDButton::setColor
void setColor(const QColor &color)
Definition:
LEDButton.cpp:301
LEDButton::state
bool state() const
Definition:
LEDButton.cpp:271
widgets
LEDButton.h
Generated by
1.8.15