-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcwidgetbase.cpp
More file actions
52 lines (45 loc) · 1.14 KB
/
Copy pathcwidgetbase.cpp
File metadata and controls
52 lines (45 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <QString>
#include <QMessageBox>
#include <QStyleOption>
#include <QPainter>
#include "cwidgetbase.h"
#include "WidgetSelector.h"
#include "Fader.h"
#include "Log.h"
CWidgetBase::CWidgetBase(QWidget *parent)
:QWidget(parent,Qt::FramelessWindowHint)
{
pConfigWidget=NULL;
}
CWidgetBase::~CWidgetBase()
{
}
void CWidgetBase::setBackground(QString fileName)
{
//setStyleSheet("background-image: url(./"+fileName+")");
QPixmap pixmapOriginal;
if(pixmapOriginal.load(fileName))
{
QPalette p = palette();
QPixmap pixmap(pixmapOriginal.scaled(size()));
p.setBrush(QPalette::Background,QBrush(pixmap));
setPalette(p);
}
else
{
QMessageBox::warning(this,"Problem","Can't load image: "+fileName);
CLog::Log("Can't load background image file");
}
}
void CWidgetBase::Initialize(CWidgetSelector* pSelector, QSettings* pSettings)
{
this->pSettings = pSettings;
this->pSelector = pSelector;
}
void CWidgetBase::paintEvent (QPaintEvent *)
{
QStyleOption opt;
opt.init (this);
QPainter p (this);
style ()->drawPrimitive (QStyle::PE_Widget, &opt, &p, this);
}