From 263f57b47b95a4e90af0b2e4c6814249c387d00b Mon Sep 17 00:00:00 2001 From: David Sansome Date: Fri, 26 Aug 2011 23:32:28 +0100 Subject: [PATCH] Only set the pretty OSD's message in the notifications settings page's constructor - don't show it as well. It would just get hidden again straight away, and for some reason this triggers a (Qt?) bug where the window gets painted in the top-left corner, but reacts to mouse clicks in its actual position. Fixes issue 2110 --- src/ui/notificationssettingspage.cpp | 4 ++-- src/widgets/osdpretty.cpp | 23 ++++++++++++++--------- src/widgets/osdpretty.h | 5 ++++- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/ui/notificationssettingspage.cpp b/src/ui/notificationssettingspage.cpp index 1866fe94d..781aa77af 100644 --- a/src/ui/notificationssettingspage.cpp +++ b/src/ui/notificationssettingspage.cpp @@ -34,8 +34,8 @@ NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog) ui_->setupUi(this); setWindowIcon(IconLoader::Load("help-hint")); - pretty_popup_->ShowMessage(tr("OSD Preview"), tr("Drag to reposition"), - QImage(":nocover.png")); + pretty_popup_->SetMessage(tr("OSD Preview"), tr("Drag to reposition"), + QImage(":nocover.png")); ui_->notifications_bg_preset->setItemData(0, QColor(OSDPretty::kPresetBlue), Qt::DecorationRole); ui_->notifications_bg_preset->setItemData(1, QColor(OSDPretty::kPresetOrange), Qt::DecorationRole); diff --git a/src/widgets/osdpretty.cpp b/src/widgets/osdpretty.cpp index 8120f0f1f..5aa12d655 100644 --- a/src/widgets/osdpretty.cpp +++ b/src/widgets/osdpretty.cpp @@ -19,15 +19,15 @@ #include "ui_osdpretty.h" -#include -#include -#include #include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -223,8 +223,7 @@ void OSDPretty::paintEvent(QPaintEvent *) { p.drawRoundedRect(box, kBorderRadius, kBorderRadius); } -// Set the desidered message and then show the OSD -void OSDPretty::ShowMessage(const QString& summary, const QString& message, +void OSDPretty::SetMessage(const QString& summary, const QString& message, const QImage& image) { if (!image.isNull()) { @@ -242,6 +241,12 @@ void OSDPretty::ShowMessage(const QString& summary, const QString& message, if (isVisible()) Reposition(); +} + +// Set the desired message and then show the OSD +void OSDPretty::ShowMessage(const QString& summary, const QString& message, + const QImage& image) { + SetMessage(summary, message, image); if (isVisible() && mode_ == Mode_Popup) { // The OSD is already visible, toggle or restart the timer diff --git a/src/widgets/osdpretty.h b/src/widgets/osdpretty.h index f02a70fe3..0dc49d3da 100644 --- a/src/widgets/osdpretty.h +++ b/src/widgets/osdpretty.h @@ -49,9 +49,12 @@ class OSDPretty : public QWidget { static bool IsTransparencyAvailable(); - void ShowMessage(const QString& summary, + void SetMessage(const QString& summary, const QString& message, const QImage& image); + void ShowMessage(const QString& summary, + const QString& message, + const QImage& image); // Controls the fader. This is enabled by default on Windows. void set_fading_enabled(bool enabled) { fading_enabled_ = enabled; }