BibleTime
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
Functions
a
b
c
d
e
f
g
h
i
l
m
n
p
q
r
s
t
v
Variables
a
b
c
d
g
h
i
k
l
m
p
r
s
u
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
u
w
Properties
Related Symbols
Files
File List
File Members
All
a
b
c
e
f
h
i
j
k
l
m
o
p
r
s
t
u
w
Functions
b
c
f
i
j
l
m
o
p
r
t
Variables
Typedefs
Enumerations
Enumerator
Macros
a
b
c
i
l
m
r
s
t
u
w
src
frontend
display
btcolorwidget.cpp
Go to the documentation of this file.
1
/*********
2
*
3
* In the name of the Father, and of the Son, and of the Holy Spirit.
4
*
5
* This file is part of BibleTime's source code, https://bibletime.info/
6
*
7
* Copyright 1999-2025 by the BibleTime developers.
8
* The BibleTime source code is licensed under the GNU General Public License
9
* version 2.0.
10
*
11
**********/
12
13
#include "
btcolorwidget.h
"
14
15
#include <QColorDialog>
16
#include <QMouseEvent>
17
#include <QPalette>
18
#include <QSizePolicy>
19
#include <Qt>
20
21
22
BtColorWidget::BtColorWidget
(
QWidget
* parent)
23
:
QFrame
(parent)
24
{
25
setFrameShadow(QFrame::Sunken);
26
setFrameShape(QFrame::StyledPanel);
27
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
28
setAutoFillBackground(
true
);
29
setBackgroundRole(QPalette::Window);
30
}
22
BtColorWidget::BtColorWidget
(
QWidget
* parent) {
…
}
31
32
QSize
BtColorWidget::sizeHint
()
const
{
return
QSize(35, 18); }
33
34
void
BtColorWidget::setColor
(QColor
const
& color) {
35
QPalette p(palette());
36
p.setColor(QPalette::Normal, QPalette::Window, color);
37
setPalette(p);
38
update();
39
}
34
void
BtColorWidget::setColor
(QColor
const
& color) {
…
}
40
41
void
BtColorWidget::mouseReleaseEvent
(QMouseEvent * event) {
42
if
(event->button() == Qt::LeftButton) {
43
event
->accept();
44
QColor
const
color(QColorDialog::getColor(
45
palette().color(QPalette::Normal, QPalette::Window),
46
this
));
47
if
(color.isValid()) {
48
setColor
(color);
49
Q_EMIT
changed
(color);
50
}
51
}
52
}
41
void
BtColorWidget::mouseReleaseEvent
(QMouseEvent * event) {
…
}
btcolorwidget.h
BtColorWidget::setColor
void setColor(QColor const &color)
Definition
btcolorwidget.cpp:34
BtColorWidget::changed
void changed(QColor const &color)
BtColorWidget::BtColorWidget
BtColorWidget(QWidget *parent=nullptr)
Definition
btcolorwidget.cpp:22
BtColorWidget::sizeHint
QSize sizeHint() const override
Definition
btcolorwidget.cpp:32
BtColorWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) override
Definition
btcolorwidget.cpp:41
QFrame
QWidget
Generated by
1.9.8