itom  4.1.0
widgetInfoBox.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef WIDGETINFOBOX_H
24 #define WIDGETINFOBOX_H
25 
26 #include <QtGui>
27 #include <qwidget.h>
28 
29 #include "../helper/guiHelper.h"
30 
31 #include "ui_widgetInfoBox.h"
32 
33 namespace ito
34 {
35 
36 class WidgetInfoBox : public QWidget
37 {
38  Q_OBJECT
39 
40 public:
41  WidgetInfoBox(QString infoText, QWidget *parent = NULL) :
42  QWidget(parent)
43  {
44  ui.setupUi(this);
45  ui.lblInfo->setText(infoText);
46  QFont f = ui.lblInfo->font();
47  float factor = GuiHelper::screenDpiFactor();
48  f.setPointSize(factor * f.pointSize());
49  ui.lblInfo->setFont(f);
50 
51  ui.btnClose->setIcon( QIcon(":/plugins/icons/pluginCloseInstance.png") );
52  ui.btnClose->setText("");
53  ui.btnClose->setIconSize( QSize(12 * factor, 12 * factor) );
54 
55  //setStyleSheet(QString("background-color: %1").arg(QColor(255, 255, 166).name()));
56  //setStyleSheet( "QWidget { background-color: blue; }" );
57  //this->setPalette( QPalette(Qt::red) );
58  setAutoFillBackground(true);
59  QPalette pal = this->palette();
60  pal.setColor(QPalette::Window, QColor(255, 255, 166));
61  this->setPalette(pal);
62  }
63 
64  ~WidgetInfoBox(){}
65 
66  void setInfoText(QString &infoText)
67  {
68  ui.lblInfo->setText(infoText);
69  }
70 
71 private:
72  Ui::WidgetInfoBox ui;
73 
74 };
75 
76 } //end namespace ito
77 
78 #endif
Definition: widgetInfoBox.h:36
static float screenDpiFactor()
Definition: guiHelper.cpp:77
Definition: apiFunctionsGraph.cpp:39