projects
/
yandex-traffic
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e90948f
)
Display region and it's name in widget
author
Max Lapan
<max.lapan@gmail.com>
Sun, 7 Mar 2010 18:10:30 +0000
(21:10 +0300)
committer
Max Lapan
<max.lapan@gmail.com>
Sun, 7 Mar 2010 18:10:30 +0000
(21:10 +0300)
mainwidget.hpp
patch
|
blob
|
history
diff --git
a/mainwidget.hpp
b/mainwidget.hpp
index
3469b8b
..
eac62a9
100644
(file)
--- a/
mainwidget.hpp
+++ b/
mainwidget.hpp
@@
-18,16
+18,32
@@
public:
MainWidget ()
: QLabel ()
{
MainWidget ()
: QLabel ()
{
+ const RegionInfo *ri;
+
setAlignment(Qt::AlignCenter);
setAttribute(Qt::WA_TranslucentBackground);
setAlignment(Qt::AlignCenter);
setAttribute(Qt::WA_TranslucentBackground);
- setText (_settings.regions ().join (", "));
+ ri = _regions.lookup (_settings.regions ()[0]);
+
+ setText (_settings.regions ().join (", ") + ", " + QString (ri ? ri->name () : ""));
}
QSize sizeHint() const
{
return 2 * QLabel::sizeHint();
}
}
QSize sizeHint() const
{
return 2 * QLabel::sizeHint();
}
+
+protected:
+ void paintEvent(QPaintEvent *event)
+ {
+ QPainter p(this);
+ p.setBrush(QColor(0, 0, 0, 128));
+ p.setPen(Qt::NoPen);
+ p.drawRoundedRect(rect(), 25, 25);
+ p.end();
+
+ QLabel::paintEvent(event);
+ }
};
#endif /* __MAINWIDGET_H__ */
};
#endif /* __MAINWIDGET_H__ */