add a new member to the tooltip data that decides if the window highlight effect is to be enabled by default or not
svn path=/trunk/KDE/kdelibs/; revision=1065864
This commit is contained in:
parent
99500091a1
commit
353e1ca88d
@ -276,7 +276,7 @@ void ToolTip::setContent(QObject *tipper, const ToolTipContent &data)
|
||||
d->text->setContent(data);
|
||||
d->imageLabel->setPixmap(data.image());
|
||||
|
||||
if (data.windowsToPreview().size() > 1 || data.windowToPreview() != 0) {
|
||||
if (data.highlightWindows() && (data.windowsToPreview().size() > 1 || data.windowToPreview() != 0)) {
|
||||
WindowEffects::highlightWindows(winId(), QList<WId>()<<winId()<<data.windowsToPreview());
|
||||
}
|
||||
if (data.windowsToPreview().size() > 1) {
|
||||
@ -286,6 +286,7 @@ void ToolTip::setContent(QObject *tipper, const ToolTipContent &data)
|
||||
ids.append(data.windowToPreview());
|
||||
d->preview->setWindowIds(ids);
|
||||
}
|
||||
d->preview->setHighlightWindows(data.highlightWindows());
|
||||
|
||||
d->autohide = data.autohide();
|
||||
d->source = tipper;
|
||||
|
@ -40,7 +40,8 @@
|
||||
namespace Plasma {
|
||||
|
||||
WindowPreview::WindowPreview(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
: QWidget(parent),
|
||||
m_highlightWindows(false)
|
||||
{
|
||||
m_background = new Plasma::FrameSvg(this);
|
||||
m_background->setImagePath("widgets/frame");
|
||||
@ -119,6 +120,17 @@ bool WindowPreview::isEmpty() const
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void WindowPreview::setHighlightWindows(const bool highlight)
|
||||
{
|
||||
m_highlightWindows = highlight;
|
||||
}
|
||||
|
||||
bool WindowPreview::highlightWindows() const
|
||||
{
|
||||
return m_highlightWindows;
|
||||
}
|
||||
|
||||
void WindowPreview::setInfo()
|
||||
{
|
||||
if (isEmpty()) {
|
||||
@ -196,6 +208,10 @@ void WindowPreview::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
void WindowPreview::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (!m_highlightWindows) {
|
||||
return;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
foreach (QRect rect, m_thumbnailRects) {
|
||||
if (rect.contains(event->pos())) {
|
||||
@ -210,6 +226,9 @@ void WindowPreview::mouseMoveEvent(QMouseEvent *event)
|
||||
void WindowPreview::leaveEvent(QEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
if (!m_highlightWindows) {
|
||||
return;
|
||||
}
|
||||
WindowEffects::highlightWindows(effectiveWinId(), QList<WId>());
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
void setInfo();
|
||||
bool isEmpty() const;
|
||||
virtual QSize sizeHint() const;
|
||||
void setHighlightWindows(const bool highlight);
|
||||
bool highlightWindows() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void windowPreviewClicked(WId wid, Qt::MouseButtons buttons, Qt::KeyboardModifiers keys, const QPoint &screenPos);
|
||||
@ -65,6 +67,7 @@ private:
|
||||
mutable QList<QSize> windowSizes;
|
||||
QList <QRect> m_thumbnailRects;
|
||||
FrameSvg *m_background;
|
||||
bool m_highlightWindows;
|
||||
|
||||
static const int WINDOW_MARGIN = 10;
|
||||
static const int WINDOW_WIDTH = 200;
|
||||
|
@ -48,7 +48,8 @@ class ToolTipContentPrivate
|
||||
public:
|
||||
ToolTipContentPrivate()
|
||||
: autohide(true),
|
||||
clickable(false)
|
||||
clickable(false),
|
||||
highlightWindows(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -59,6 +60,7 @@ public:
|
||||
QHash<QString, ToolTipResource> resources;
|
||||
bool autohide : 1;
|
||||
bool clickable : 1;
|
||||
bool highlightWindows : 1;
|
||||
};
|
||||
|
||||
ToolTipContent::ToolTipContent()
|
||||
@ -170,6 +172,16 @@ QList<WId> ToolTipContent::windowsToPreview() const
|
||||
return d->windowsToPreview;
|
||||
}
|
||||
|
||||
void ToolTipContent::setHighlightWindows(bool highlight)
|
||||
{
|
||||
d->highlightWindows = highlight;
|
||||
}
|
||||
|
||||
bool ToolTipContent::highlightWindows() const
|
||||
{
|
||||
return d->highlightWindows;
|
||||
}
|
||||
|
||||
void ToolTipContent::setAutohide(bool autohide)
|
||||
{
|
||||
d->autohide = autohide;
|
||||
|
@ -142,6 +142,20 @@ public:
|
||||
*/
|
||||
QList<WId> windowsToPreview() const;
|
||||
|
||||
/**
|
||||
* sets if when the mouse will be over a thumbnail the corresponding window
|
||||
* will be highlighted by reducing opacity of all the other windows
|
||||
* @since 4.4
|
||||
*/
|
||||
void setHighlightWindows(bool highlight);
|
||||
|
||||
/**
|
||||
* true if when the mouse will be over a thumbnail the corresponding window
|
||||
* will be highlighted by reducing opacity of all the other windows
|
||||
* @since 4.4
|
||||
*/
|
||||
bool highlightWindows() const;
|
||||
|
||||
/** Sets whether or not to autohide the tooltip, defaults to true
|
||||
*/
|
||||
void setAutohide(bool autohide);
|
||||
|
Loading…
Reference in New Issue
Block a user