~ubuntu-branches/ubuntu/oneiric/kdeplasma-addons/oneiric-proposed

« back to all changes in this revision

Viewing changes to applets/plasmaboard/tooltip.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-10-15 10:20:33 UTC
  • mfrom: (0.7.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20111015102033-2smbzw0avgmxr23k
Tags: 4:4.7.2-0ubuntu1
New upstream release (LP: #872506)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <plasma/theme.h>
27
27
 
28
28
 
29
 
Tooltip::Tooltip(QString text) : QWidget()
 
29
Tooltip::Tooltip(const QString &text)
 
30
    : QWidget()
30
31
{
31
32
    setAttribute(Qt::WA_TranslucentBackground);
32
33
    setAttribute(Qt::WA_TransparentForMouseEvents);
33
 
    setWindowFlags( Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint );
 
34
    setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
34
35
 
35
36
    setColors();
36
37
    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(setColors()));
50
51
    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateMask()));
51
52
}
52
53
 
53
 
Tooltip::~Tooltip() {
 
54
Tooltip::~Tooltip()
 
55
{
54
56
 
55
57
}
56
58
 
67
69
    label->setText(text);
68
70
}
69
71
 
70
 
void Tooltip::resizeEvent(QResizeEvent *event) 
 
72
void Tooltip::resizeEvent(QResizeEvent *event)
71
73
{
72
74
    QSize size = event->size();
73
75
    QWidget::resize(size);
74
 
    setFont(QFont ( "Helvetica", qMin(size.height(),size.width()) / 3) );
 
76
    setFont(QFont("Helvetica", qMin(size.height(), size.width()) / 3));
75
77
    frame->resizeFrame(size);
76
78
    updateMask();
77
79
}
86
88
{
87
89
    const bool translucency = Plasma::Theme::defaultTheme()->windowTranslucencyEnabled();
88
90
    Plasma::WindowEffects::enableBlurBehind(winId(), translucency,
89
 
                                    translucency ? frame->mask() : QRegion());
 
91
                                            translucency ? frame->mask() : QRegion());
90
92
    if (translucency) {
91
93
        clearMask();
92
94
    } else {
94
96
    }
95
97
}
96
98
 
97
 
void Tooltip::paintEvent ( QPaintEvent * event )
 
99
void Tooltip::paintEvent(QPaintEvent * event)
98
100
{
99
101
    QPainter painter(this);
100
102
    painter.setRenderHint(QPainter::SmoothPixmapTransform);
103
105
    painter.fillRect(rect(), Qt::transparent);
104
106
    frame->paintFrame(&painter, event->rect());
105
107
}
 
108
 
 
109
#include "tooltip.moc"
 
110