dtkWidgetsHUDInfo.cpp 1.39 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Version: $Id$
//
//

// Commentary:
//
//

// Change Log:
//
//

// Code:

#include "dtkWidgetsHUDInfo.h"

17
#include <dtkThemes/dtkThemesEngine>
KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
18
19
20
21
22
23
#include <QtGui>

// ///////////////////////////////////////////////////////////////////
// dtkWidgetsHUDInfoPrivate
// ///////////////////////////////////////////////////////////////////

24
25
26
27
28
29
class dtkWidgetsHUDInfoPrivate
{
public:
    QString text;
};

KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
30
31
32
33
34
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsHUDInfo
// ///////////////////////////////////////////////////////////////////

dtkWidgetsHUDInfo::dtkWidgetsHUDInfo(const QString& text, QWidget *parent) : QFrame(parent), d(new dtkWidgetsHUDInfoPrivate)
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
    d->text = text;

    this->setVisible(true);
}

dtkWidgetsHUDInfo::~dtkWidgetsHUDInfo(void)
{
    delete d;
}

QSize dtkWidgetsHUDInfo::sizeHint(void) const
{
    return QSize(200, 50);
}

void dtkWidgetsHUDInfo::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);

56
57
58
59
60
    QColor fg = dtkThemesEngine::instance()->color("@fgalt");
    QColor bg = dtkThemesEngine::instance()->color("@bgalt");

    painter.setPen(bg);
    painter.setBrush(bg);
61
    painter.drawRoundedRect(event->rect(), 25 + 2, 25 + 2);
62
    painter.setPen(fg);
63
64
65
66
67
68
69
    painter.drawText(event->rect(), d->text, QTextOption(Qt::AlignCenter));

    QFrame::paintEvent(event);
}

//
// dtkWidgetsHUDInfo.cpp ends here