Code_TYMPAN
4.4.0
Industrial site acoustic simulation
Tympan
gui
widgets
TYToolButton.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) <2012> <EDF-R&D> <FRANCE>
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation; either version 2 of the License, or
6
* (at your option) any later version.
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
* See the GNU General Public License for more details.
11
* You should have received a copy of the GNU General Public License along
12
* with this program; if not, write to the Free Software Foundation, Inc.,
13
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14
*/
15
23
#include <qcolordialog.h>
24
#include <QPainter>
25
#include <QStyle>
26
#include "
TYToolButton.h
"
27
28
using namespace
Qt;
29
30
TYToolButton::TYToolButton
(QWidget* parent,
const
char
*
name
) : QToolButton(parent)
31
{
32
setAutoFillBackground(
true
);
33
setObjectName(
name
);
34
setToolButtonStyle(Qt::ToolButtonTextOnly);
35
_color
= white;
36
QObject::connect(
this
, &TYToolButton::clicked,
this
, &
TYToolButton::selectColor
);
37
}
38
39
TYToolButton::~TYToolButton
() {}
40
41
void
TYToolButton::selectColor
()
42
{
43
QColor
c
= QColorDialog::getColor(
_color
);
44
45
if
(
c
.isValid())
46
{
47
_color
=
c
;
48
updateColor
();
49
50
emit
colorAccepted
(
_color
);
51
}
52
else
53
{
54
emit
colorRejected
();
55
}
56
}
57
58
void
TYToolButton::updateColor
()
59
{
60
setStyleSheet(QString(
"background-color: %1;"
).arg(
_color
.name()));
61
}
c
NxReal c
Definition:
NxVec3.cpp:317
name
const char * name
Definition:
TYRouteWidget.cpp:34
TYToolButton.h
outil IHM pour la gestion de la couleur des ToolButton (fichier header)
TYToolButton::_color
QColor _color
Couleur du bouton.
Definition:
TYToolButton.h:83
TYToolButton::colorAccepted
void colorAccepted(QColor c)
TYToolButton::updateColor
virtual void updateColor()
Definition:
TYToolButton.cpp:58
TYToolButton::~TYToolButton
virtual ~TYToolButton()
Definition:
TYToolButton.cpp:39
TYToolButton::selectColor
virtual void selectColor()
Definition:
TYToolButton.cpp:41
TYToolButton::colorRejected
void colorRejected()
TYToolButton::TYToolButton
TYToolButton(QWidget *parent=0, const char *name=0)
Definition:
TYToolButton.cpp:30
Generated on Mon Nov 27 2023 07:56:32 for Code_TYMPAN by
1.9.1