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
This commit is contained in:
Aaron J. Seigo 2008-11-03 05:03:36 +00:00
parent ce90860d4d
commit 80874e9ad7
2 changed files with 26 additions and 24 deletions

View File

@ -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)

View File

@ -43,6 +43,7 @@ public:
bool autohide() const;
protected:
void checkSize();
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *);
void mouseReleaseEvent(QMouseEvent *);