in case a tooltip becomes permanent, allow clicking it away

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=760180
This commit is contained in:
Aaron J. Seigo 2008-01-12 05:32:07 +00:00
parent 834ce37f54
commit 8801af70e5
2 changed files with 10 additions and 1 deletions

View File

@ -22,6 +22,7 @@
#include <QBitmap> #include <QBitmap>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QMouseEvent>
#include <QPixmap> #include <QPixmap>
#include <QTimer> #include <QTimer>
#include <QGraphicsView> #include <QGraphicsView>
@ -138,6 +139,13 @@ void ToolTip::showEvent(QShowEvent *e)
d->preview->setInfo(); d->preview->setInfo();
} }
void ToolTip::mouseReleaseEvent(QMouseEvent* event)
{
if (rect().contains(event->pos())) {
hide();
}
}
ToolTip::ToolTip() ToolTip::ToolTip()
: QWidget(0) : QWidget(0)
, d( new Private ) , d( new Private )

View File

@ -50,7 +50,8 @@ public:
Plasma::Widget *currentWidget() const; Plasma::Widget *currentWidget() const;
protected: protected:
virtual void showEvent(QShowEvent *); void showEvent(QShowEvent *);
void mouseReleaseEvent(QMouseEvent *);
void resizeEvent(QResizeEvent *); void resizeEvent(QResizeEvent *);
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);