From a98e4c82b2613263aeca7abca2c5cafdf31708cc Mon Sep 17 00:00:00 2001 From: Chani Armitage Date: Fri, 26 Dec 2008 20:38:59 +0000 Subject: [PATCH] tooltips don't need an offset if the panel is on the top or left side svn path=/trunk/KDE/kdelibs/; revision=901879 --- private/tooltip.cpp | 14 ++++++++------ private/tooltip_p.h | 2 +- tooltipmanager.cpp | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/private/tooltip.cpp b/private/tooltip.cpp index c1d8f4651..21d28c355 100644 --- a/private/tooltip.cpp +++ b/private/tooltip.cpp @@ -100,7 +100,7 @@ class ToolTipPrivate preview(0), source(0), timeline(0), - orientation(Qt::Horizontal), + direction(Plasma::Up), autohide(true) { } @@ -112,7 +112,7 @@ class ToolTipPrivate QTimeLine *timeline; QPoint to; QPoint from; - Qt::Orientation orientation; + Plasma::Direction direction; bool autohide; }; @@ -187,9 +187,11 @@ void ToolTip::checkSize() resize(hint); #endif */ + + //offsets to stop tooltips from jumping when they resize int deltaX = 0; int deltaY = 0; - if (d->orientation == Qt::Horizontal) { + if (d->direction == Plasma::Up) { /* kDebug() << "resizing from" << current << "to" << hint << "and moving from" << pos() << "to" @@ -197,7 +199,7 @@ void ToolTip::checkSize() << current.height() - hint.height(); */ deltaY = current.height() - hint.height(); - } else { + } else if (d->direction == Plasma::Left) { /* kDebug() << "vertical resizing from" << current << "to" << hint << "and moving from" << pos() << "to" @@ -319,9 +321,9 @@ bool ToolTip::autohide() const return d->autohide; } -void ToolTip::setOrientation(Qt::Orientation orientation) +void ToolTip::setDirection(Plasma::Direction direction) { - d->orientation = orientation; + d->direction = direction; } void ToolTip::updateTheme() diff --git a/private/tooltip_p.h b/private/tooltip_p.h index 6b44be693..5346a54dd 100644 --- a/private/tooltip_p.h +++ b/private/tooltip_p.h @@ -41,7 +41,7 @@ public: void prepareShowing(bool cueUpdate); void moveTo(const QPoint &to); bool autohide() const; - void setOrientation(Qt::Orientation); + void setDirection(Plasma::Direction); protected: void checkSize(); diff --git a/tooltipmanager.cpp b/tooltipmanager.cpp index b148ba7bb..0acf6161f 100644 --- a/tooltipmanager.cpp +++ b/tooltipmanager.cpp @@ -317,7 +317,7 @@ void ToolTipManagerPrivate::showToolTip() Containment *c = dynamic_cast(currentWidget->topLevelItem()); kDebug() << "about to show" << justCreated << (QObject*)c; if (c) { - tipWidget->setOrientation(c->formFactor() == Vertical ? Qt::Vertical : Qt::Horizontal); + tipWidget->setDirection(Plasma::locationToDirection(c->location())); } tipWidget->setContent(currentWidget, tooltip.value());