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->text->setContent(data);
|
||||||
d->imageLabel->setPixmap(data.image());
|
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());
|
WindowEffects::highlightWindows(winId(), QList<WId>()<<winId()<<data.windowsToPreview());
|
||||||
}
|
}
|
||||||
if (data.windowsToPreview().size() > 1) {
|
if (data.windowsToPreview().size() > 1) {
|
||||||
@ -286,6 +286,7 @@ void ToolTip::setContent(QObject *tipper, const ToolTipContent &data)
|
|||||||
ids.append(data.windowToPreview());
|
ids.append(data.windowToPreview());
|
||||||
d->preview->setWindowIds(ids);
|
d->preview->setWindowIds(ids);
|
||||||
}
|
}
|
||||||
|
d->preview->setHighlightWindows(data.highlightWindows());
|
||||||
|
|
||||||
d->autohide = data.autohide();
|
d->autohide = data.autohide();
|
||||||
d->source = tipper;
|
d->source = tipper;
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
namespace Plasma {
|
namespace Plasma {
|
||||||
|
|
||||||
WindowPreview::WindowPreview(QWidget *parent)
|
WindowPreview::WindowPreview(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent),
|
||||||
|
m_highlightWindows(false)
|
||||||
{
|
{
|
||||||
m_background = new Plasma::FrameSvg(this);
|
m_background = new Plasma::FrameSvg(this);
|
||||||
m_background->setImagePath("widgets/frame");
|
m_background->setImagePath("widgets/frame");
|
||||||
@ -119,6 +120,17 @@ bool WindowPreview::isEmpty() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WindowPreview::setHighlightWindows(const bool highlight)
|
||||||
|
{
|
||||||
|
m_highlightWindows = highlight;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WindowPreview::highlightWindows() const
|
||||||
|
{
|
||||||
|
return m_highlightWindows;
|
||||||
|
}
|
||||||
|
|
||||||
void WindowPreview::setInfo()
|
void WindowPreview::setInfo()
|
||||||
{
|
{
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
@ -196,6 +208,10 @@ void WindowPreview::mousePressEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
void WindowPreview::mouseMoveEvent(QMouseEvent *event)
|
void WindowPreview::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
if (!m_highlightWindows) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (QRect rect, m_thumbnailRects) {
|
foreach (QRect rect, m_thumbnailRects) {
|
||||||
if (rect.contains(event->pos())) {
|
if (rect.contains(event->pos())) {
|
||||||
@ -210,6 +226,9 @@ void WindowPreview::mouseMoveEvent(QMouseEvent *event)
|
|||||||
void WindowPreview::leaveEvent(QEvent *event)
|
void WindowPreview::leaveEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
|
if (!m_highlightWindows) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
WindowEffects::highlightWindows(effectiveWinId(), QList<WId>());
|
WindowEffects::highlightWindows(effectiveWinId(), QList<WId>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,8 @@ public:
|
|||||||
void setInfo();
|
void setInfo();
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
virtual QSize sizeHint() const;
|
virtual QSize sizeHint() const;
|
||||||
|
void setHighlightWindows(const bool highlight);
|
||||||
|
bool highlightWindows() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void windowPreviewClicked(WId wid, Qt::MouseButtons buttons, Qt::KeyboardModifiers keys, const QPoint &screenPos);
|
void windowPreviewClicked(WId wid, Qt::MouseButtons buttons, Qt::KeyboardModifiers keys, const QPoint &screenPos);
|
||||||
@ -65,6 +67,7 @@ private:
|
|||||||
mutable QList<QSize> windowSizes;
|
mutable QList<QSize> windowSizes;
|
||||||
QList <QRect> m_thumbnailRects;
|
QList <QRect> m_thumbnailRects;
|
||||||
FrameSvg *m_background;
|
FrameSvg *m_background;
|
||||||
|
bool m_highlightWindows;
|
||||||
|
|
||||||
static const int WINDOW_MARGIN = 10;
|
static const int WINDOW_MARGIN = 10;
|
||||||
static const int WINDOW_WIDTH = 200;
|
static const int WINDOW_WIDTH = 200;
|
||||||
|
@ -48,7 +48,8 @@ class ToolTipContentPrivate
|
|||||||
public:
|
public:
|
||||||
ToolTipContentPrivate()
|
ToolTipContentPrivate()
|
||||||
: autohide(true),
|
: autohide(true),
|
||||||
clickable(false)
|
clickable(false),
|
||||||
|
highlightWindows(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ public:
|
|||||||
QHash<QString, ToolTipResource> resources;
|
QHash<QString, ToolTipResource> resources;
|
||||||
bool autohide : 1;
|
bool autohide : 1;
|
||||||
bool clickable : 1;
|
bool clickable : 1;
|
||||||
|
bool highlightWindows : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
ToolTipContent::ToolTipContent()
|
ToolTipContent::ToolTipContent()
|
||||||
@ -170,6 +172,16 @@ QList<WId> ToolTipContent::windowsToPreview() const
|
|||||||
return d->windowsToPreview;
|
return d->windowsToPreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolTipContent::setHighlightWindows(bool highlight)
|
||||||
|
{
|
||||||
|
d->highlightWindows = highlight;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ToolTipContent::highlightWindows() const
|
||||||
|
{
|
||||||
|
return d->highlightWindows;
|
||||||
|
}
|
||||||
|
|
||||||
void ToolTipContent::setAutohide(bool autohide)
|
void ToolTipContent::setAutohide(bool autohide)
|
||||||
{
|
{
|
||||||
d->autohide = autohide;
|
d->autohide = autohide;
|
||||||
|
@ -142,6 +142,20 @@ public:
|
|||||||
*/
|
*/
|
||||||
QList<WId> windowsToPreview() const;
|
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
|
/** Sets whether or not to autohide the tooltip, defaults to true
|
||||||
*/
|
*/
|
||||||
void setAutohide(bool autohide);
|
void setAutohide(bool autohide);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user