MEPP2 Project
QtHelpers.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 
13 void
14 FEVV::Helpers::changeBackgroundColor(QWidget *_widget, const Color &_color)
15 {
16  QPalette pal(_widget->palette());
17  pal.setColor(
18  QPalette::Background,
19  QColor(_color.red(), _color.green(), _color.blue(), _color.alpha()));
20  _widget->setAutoFillBackground(true);
21  _widget->setPalette(pal);
22 }
23 
24 void
25 FEVV::Helpers::changeTextColor(QWidget *_widget, const Color &_color)
26 {
27  QPalette pal(_widget->palette());
28  pal.setColor(
29  QPalette::WindowText,
30  QColor(_color.red(), _color.green(), _color.blue(), _color.alpha()));
31  _widget->setAutoFillBackground(true);
32  _widget->setPalette(pal);
33 }
FEVV::Color::blue
void blue(const unsigned char _blueValue)
Definition: Color.inl:94
FEVV::Helpers::changeBackgroundColor
void changeBackgroundColor(QWidget *_widget, const Color &_color)
Definition: QtHelpers.cpp:14
FEVV::Color::alpha
void alpha(const unsigned char _alphaValue)
Definition: Color.inl:101
FEVV::Color::green
void green(const unsigned char _greenValue)
Definition: Color.inl:87
QtHelpers.h
FEVV::Helpers::changeTextColor
void changeTextColor(QWidget *_widget, const Color &_color)
Definition: QtHelpers.cpp:25
FEVV::Color
Definition: Color.hpp:18
FEVV::Color::red
void red(const unsigned char _redValue)
Definition: Color.inl:80