highlight the thumbnail under the mouse

svn path=/trunk/KDE/kdelibs/; revision=1047608
This commit is contained in:
Marco Martin 2009-11-11 15:28:40 +00:00
parent fda0f6c4de
commit 01790c83c3
2 changed files with 22 additions and 0 deletions

View File

@ -45,6 +45,7 @@ WindowPreview::WindowPreview(QWidget *parent)
m_background = new Plasma::FrameSvg(this);
m_background->setImagePath("widgets/frame");
m_background->setElementPrefix("raised");
setMouseTracking(true);
}
void WindowPreview::setWindowIds(const QList<WId> wids)
@ -193,6 +194,25 @@ void WindowPreview::mousePressEvent(QMouseEvent *event)
}
}
void WindowPreview::mouseMoveEvent(QMouseEvent *event)
{
int i = 0;
foreach (QRect rect, m_thumbnailRects) {
if (rect.contains(event->pos())) {
WindowEffects::highlightWindows(effectiveWinId(), QList<WId>()<<effectiveWinId()<<ids[i]);
return;
}
++i;
}
WindowEffects::highlightWindows(effectiveWinId(), QList<WId>());
}
void WindowPreview::leaveEvent(QEvent *event)
{
Q_UNUSED(event)
WindowEffects::highlightWindows(effectiveWinId(), QList<WId>());
}
} // namespace Plasma
#include "windowpreview_p.moc"

View File

@ -56,6 +56,8 @@ Q_SIGNALS:
protected:
void paintEvent(QPaintEvent *e);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void leaveEvent(QEvent *event);
private: