diff --git a/data/data.qrc b/data/data.qrc index 688081952..678ca3f57 100644 --- a/data/data.qrc +++ b/data/data.qrc @@ -177,5 +177,6 @@ icons/48x48/document-new.png schema-10.sql schema-11.sql + osd_background.png diff --git a/data/osd_background.png b/data/osd_background.png new file mode 100644 index 000000000..f11404b96 Binary files /dev/null and b/data/osd_background.png differ diff --git a/src/widgets/osdpretty.cpp b/src/widgets/osdpretty.cpp index a4f3f64b2..913f6d701 100644 --- a/src/widgets/osdpretty.cpp +++ b/src/widgets/osdpretty.cpp @@ -100,6 +100,7 @@ OSDPretty::OSDPretty(Mode mode, QWidget *parent) shadow_edge_[i] = QPixmap::fromImage(shadow_edge.transformed(rotation)); shadow_corner_[i] = QPixmap::fromImage(shadow_corner.transformed(rotation)); } + background_ = QPixmap(":osd_background.png"); // Set the margins to allow for the drop shadow QBoxLayout* l = static_cast(layout()); @@ -178,12 +179,20 @@ void OSDPretty::paintEvent(QPaintEvent *) { p.setOpacity(background_opacity_); p.drawRoundedRect(box, kBorderRadius, kBorderRadius); + // Background pattern + QPainterPath background_path; + background_path.addRoundedRect(box, kBorderRadius, kBorderRadius); + p.setClipPath(background_path); + p.setOpacity(1.0); + p.drawPixmap(box.right() - background_.width(), + box.bottom() - background_.height(), background_); + p.setClipping(false); + // Gradient overlay QLinearGradient gradient(0, 0, 0, height()); gradient.setColorAt(0, QColor(255, 255, 255, 130)); gradient.setColorAt(1, QColor(255, 255, 255, 50)); p.setBrush(gradient); - p.setOpacity(1.0); p.drawRoundedRect(box, kBorderRadius, kBorderRadius); // Box border diff --git a/src/widgets/osdpretty.h b/src/widgets/osdpretty.h index 23d508397..df37307d4 100644 --- a/src/widgets/osdpretty.h +++ b/src/widgets/osdpretty.h @@ -113,6 +113,7 @@ class OSDPretty : public QWidget { // Cached pixmaps QPixmap shadow_edge_[4]; QPixmap shadow_corner_[4]; + QPixmap background_; // For dragging the OSD QPoint original_window_pos_;