From 80874e9ad78130a4c06e8c8a66de56215dc3550f Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 3 Nov 2008 05:03:36 +0000 Subject: [PATCH] put the code in a central place, back out the NET stuff as it breaks more than it fixes svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=879365 --- private/tooltip.cpp | 49 +++++++++++++++++++++++---------------------- private/tooltip_p.h | 1 + 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/private/tooltip.cpp b/private/tooltip.cpp index b34d5b94a..7baac7727 100644 --- a/private/tooltip.cpp +++ b/private/tooltip.cpp @@ -117,6 +117,29 @@ ToolTip::~ToolTip() delete d; } +void ToolTip::checkSize() +{ + QSize hint = sizeHint(); + QSize current = size(); + + if (hint != current) { + /* +#ifdef Q_WS_X11 + NETRootInfo i(QX11Info::display(), 0); + int flags = NET::BottomLeft; + i.moveResizeWindowRequest(winId(), flags, + x(), y() + (current.height() - hint.height()), + hint.width(), hint.height()); +#else + move(x(), y() + (current.height() - hint.height())); + resize(hint); +#endif + */ + move(x(), y() + (current.height() - hint.height())); + resize(hint); + } +} + void ToolTip::setContent(const ToolTipContent &data) { //reset our size @@ -127,22 +150,7 @@ void ToolTip::setContent(const ToolTipContent &data) if (isVisible()) { d->preview->setInfo(); - - QSize hint = sizeHint(); - QSize current = size(); - - if (hint != current) { -#ifdef Q_WS_X11 - NETRootInfo i(QX11Info::display(), 0); - int flags = (0x20 << 12) | (0x03 << 8) | 1; // from tool, x/y, northwest gravity - i.moveResizeWindowRequest(winId(), flags, - x(), y() + (current.height() - hint.height()), - hint.width(), hint.height()); -#else - move(x(), y() + (current.height() - hint.height())); - resize(hint); -#endif - } + checkSize(); } } @@ -161,14 +169,7 @@ void ToolTip::prepareShowing(bool cueUpdate) layout()->activate(); d->preview->setInfo(); - - QSize hint = sizeHint(); - QSize current = size(); - - if (hint != current) { - move(x(), y() + (current.height() - hint.height())); - } - resize(sizeHint()); + checkSize(); } void ToolTip::moveTo(const QPoint &to) diff --git a/private/tooltip_p.h b/private/tooltip_p.h index 461f1e118..45d20b3e7 100644 --- a/private/tooltip_p.h +++ b/private/tooltip_p.h @@ -43,6 +43,7 @@ public: bool autohide() const; protected: + void checkSize(); void showEvent(QShowEvent *); void hideEvent(QHideEvent *); void mouseReleaseEvent(QMouseEvent *);