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
This commit is contained in:
David Sansome 2011-08-26 23:32:28 +01:00
parent 3dc4e3aa0b
commit 263f57b47b
3 changed files with 20 additions and 12 deletions

View File

@ -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);

View File

@ -19,15 +19,15 @@
#include "ui_osdpretty.h"
#include <QColor>
#include <QPainter>
#include <QLayout>
#include <QApplication>
#include <QDesktopWidget>
#include <QSettings>
#include <QMouseEvent>
#include <QTimer>
#include <QBitmap>
#include <QColor>
#include <QDesktopWidget>
#include <QLayout>
#include <QMouseEvent>
#include <QPainter>
#include <QSettings>
#include <QTimer>
#include <QTimeLine>
#include <QtDebug>
@ -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

View File

@ -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; }