tooltips don't need an offset if the panel is on the top or left side
svn path=/trunk/KDE/kdelibs/; revision=901879
This commit is contained in:
parent
e3f1b2fda8
commit
a98e4c82b2
@ -100,7 +100,7 @@ class ToolTipPrivate
|
|||||||
preview(0),
|
preview(0),
|
||||||
source(0),
|
source(0),
|
||||||
timeline(0),
|
timeline(0),
|
||||||
orientation(Qt::Horizontal),
|
direction(Plasma::Up),
|
||||||
autohide(true)
|
autohide(true)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class ToolTipPrivate
|
|||||||
QTimeLine *timeline;
|
QTimeLine *timeline;
|
||||||
QPoint to;
|
QPoint to;
|
||||||
QPoint from;
|
QPoint from;
|
||||||
Qt::Orientation orientation;
|
Plasma::Direction direction;
|
||||||
bool autohide;
|
bool autohide;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -187,9 +187,11 @@ void ToolTip::checkSize()
|
|||||||
resize(hint);
|
resize(hint);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//offsets to stop tooltips from jumping when they resize
|
||||||
int deltaX = 0;
|
int deltaX = 0;
|
||||||
int deltaY = 0;
|
int deltaY = 0;
|
||||||
if (d->orientation == Qt::Horizontal) {
|
if (d->direction == Plasma::Up) {
|
||||||
/*
|
/*
|
||||||
kDebug() << "resizing from" << current << "to" << hint
|
kDebug() << "resizing from" << current << "to" << hint
|
||||||
<< "and moving from" << pos() << "to"
|
<< "and moving from" << pos() << "to"
|
||||||
@ -197,7 +199,7 @@ void ToolTip::checkSize()
|
|||||||
<< current.height() - hint.height();
|
<< current.height() - hint.height();
|
||||||
*/
|
*/
|
||||||
deltaY = current.height() - hint.height();
|
deltaY = current.height() - hint.height();
|
||||||
} else {
|
} else if (d->direction == Plasma::Left) {
|
||||||
/*
|
/*
|
||||||
kDebug() << "vertical resizing from" << current << "to" << hint
|
kDebug() << "vertical resizing from" << current << "to" << hint
|
||||||
<< "and moving from" << pos() << "to"
|
<< "and moving from" << pos() << "to"
|
||||||
@ -319,9 +321,9 @@ bool ToolTip::autohide() const
|
|||||||
return d->autohide;
|
return d->autohide;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTip::setOrientation(Qt::Orientation orientation)
|
void ToolTip::setDirection(Plasma::Direction direction)
|
||||||
{
|
{
|
||||||
d->orientation = orientation;
|
d->direction = direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTip::updateTheme()
|
void ToolTip::updateTheme()
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
void prepareShowing(bool cueUpdate);
|
void prepareShowing(bool cueUpdate);
|
||||||
void moveTo(const QPoint &to);
|
void moveTo(const QPoint &to);
|
||||||
bool autohide() const;
|
bool autohide() const;
|
||||||
void setOrientation(Qt::Orientation);
|
void setDirection(Plasma::Direction);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void checkSize();
|
void checkSize();
|
||||||
|
@ -317,7 +317,7 @@ void ToolTipManagerPrivate::showToolTip()
|
|||||||
Containment *c = dynamic_cast<Containment *>(currentWidget->topLevelItem());
|
Containment *c = dynamic_cast<Containment *>(currentWidget->topLevelItem());
|
||||||
kDebug() << "about to show" << justCreated << (QObject*)c;
|
kDebug() << "about to show" << justCreated << (QObject*)c;
|
||||||
if (c) {
|
if (c) {
|
||||||
tipWidget->setOrientation(c->formFactor() == Vertical ? Qt::Vertical : Qt::Horizontal);
|
tipWidget->setDirection(Plasma::locationToDirection(c->location()));
|
||||||
}
|
}
|
||||||
|
|
||||||
tipWidget->setContent(currentWidget, tooltip.value());
|
tipWidget->setContent(currentWidget, tooltip.value());
|
||||||
|
Loading…
Reference in New Issue
Block a user