1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-14 02:14:21 +01:00

Make the search term widget slightly prettier

This commit is contained in:
David Sansome 2010-11-03 20:12:42 +00:00
parent 40fcf7d41f
commit 63fc80543e

View File

@ -238,7 +238,6 @@ SmartPlaylistSearchTermWidget::Overlay::Overlay(SmartPlaylistSearchTermWidget* p
icon_(IconLoader::Load("list-add").pixmap(kIconSize))
{
raise();
setCursor(Qt::PointingHandCursor);
}
void SmartPlaylistSearchTermWidget::Overlay::SetOpacity(float opacity) {
@ -278,6 +277,12 @@ void SmartPlaylistSearchTermWidget::Overlay::paintEvent(QPaintEvent*) {
p.setOpacity(0.25 + opacity_ * 0.25);
p.drawPixmap(0, 0, pixmap_);
// Draw a frame
p.setOpacity(1.0);
p.setPen(palette().color(QPalette::Mid));
p.setRenderHint(QPainter::Antialiasing);
p.drawRoundedRect(rect(), 5, 5);
// Geometry
const QSize contents_size(kIconSize + kSpacing + fontMetrics().width(text_),
qMax(kIconSize, fontMetrics().height()));
@ -290,9 +295,9 @@ void SmartPlaylistSearchTermWidget::Overlay::paintEvent(QPaintEvent*) {
contents.height());
// Icon and text
p.setOpacity(1.0);
p.setPen(palette().color(QPalette::Text));
p.drawPixmap(icon, icon_);
p.drawText(text, text_);
p.drawText(text, Qt::TextDontClip | Qt::AlignVCenter, text_);
}
void SmartPlaylistSearchTermWidget::Overlay::mouseReleaseEvent(QMouseEvent*) {