From 04d8434a0965a7d00fb5dcc8d6344f203be503f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Thu, 18 Jan 2018 19:59:17 +0100 Subject: [PATCH] KWin: tooltips Summary: BUG: 383040 KDecoration part of the patch: https://phabricator.kde.org/D7246 Reviewers: graesslin Reviewed By: graesslin Subscribers: cfeck, graesslin, luebking, broulik, kwin, #kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D9294 --- decorations/decoratedclient.cpp | 12 ++++++++++++ decorations/decoratedclient.h | 2 ++ .../declarative-plugin/previewclient.cpp | 10 ++++++++++ .../declarative-plugin/previewclient.h | 2 ++ 4 files changed, 26 insertions(+) diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index ff5ce64d4e..09cc3d6410 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -31,6 +31,7 @@ along with this program. If not, see . #include #include +#include namespace KWin { @@ -200,6 +201,17 @@ QColor DecoratedClientImpl::color(KDecoration2::ColorGroup group, KDecoration2:: return QColor(); } +void DecoratedClientImpl::requestShowToolTip(const QString &text) +{ + QPoint pos = Cursor::pos(); + QToolTip::showText(pos, text); +} + +void DecoratedClientImpl::requestHideToolTip() +{ + QToolTip::hideText(); +} + void DecoratedClientImpl::requestShowWindowMenu() { // TODO: add rect to requestShowWindowMenu diff --git a/decorations/decoratedclient.h b/decorations/decoratedclient.h index e01a2e6a05..5323a00413 100644 --- a/decorations/decoratedclient.h +++ b/decorations/decoratedclient.h @@ -72,6 +72,8 @@ public: bool hasApplicationMenu() const override; bool isApplicationMenuActive() const override; + void requestShowToolTip(const QString &text) override; + void requestHideToolTip() override; void requestClose() override; void requestContextHelp() override; void requestToggleMaximization(Qt::MouseButtons buttons) override; diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp index 2a022473f2..c5856ebd5f 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp @@ -351,6 +351,16 @@ void PreviewClient::setBordersTopEdge(bool enabled) emit bordersTopEdgeChanged(enabled); } +void PreviewClient::requestShowToolTip(const QString &text) +{ + qDebug() << "tooltip show requested with text:" << text; +} + +void PreviewClient::requestHideToolTip() +{ + qDebug() << "tooltip hide requested"; +} + void PreviewClient::requestClose() { emit closeRequested(); diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.h b/kcmkwin/kwindecoration/declarative-plugin/previewclient.h index 8fb681e1ef..df3608393e 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.h +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.h @@ -97,6 +97,8 @@ public: bool hasApplicationMenu() const override; bool isApplicationMenuActive() const override; + void requestShowToolTip(const QString &text) override; + void requestHideToolTip() override; void requestClose() override; void requestContextHelp() override; void requestToggleMaximization(Qt::MouseButtons buttons) override;