itom
Loading...
Searching...
No Matches
widgetInfoBox.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität 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
33namespace ito
34{
35
36class WidgetInfoBox : public QWidget
37{
38 Q_OBJECT
39
40public:
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
65
66 void setInfoText(QString &infoText)
67 {
68 ui.lblInfo->setText(infoText);
69 }
70
71private:
72 Ui::WidgetInfoBox ui;
73
74};
75
76} //end namespace ito
77
78#endif
static float screenDpiFactor(const QPoint *pos=nullptr)
Definition guiHelper.cpp:201
Definition widgetInfoBox.h:37
Definition apiFunctionsGraph.cpp:40