don't make the tooltip dance
note: this is different from the "dancing dialog" bug. the tooltip should now appear in the proper position and behave reasonably good
This commit is contained in:
parent
d488420dcb
commit
13016a42b4
@ -143,14 +143,15 @@ void ToolTip::showToolTip()
|
||||
|
||||
//heuristics for knowing the diration
|
||||
Plasma::Types::Direction dir;
|
||||
QPoint pos = mapToScene(QPoint(0, 0)).toPoint();
|
||||
|
||||
if (window() && window()->screen()) {
|
||||
pos = window()->mapToGlobal(pos);
|
||||
}
|
||||
QPoint popupPos = dlg->popupPosition(this, dlg->size());
|
||||
|
||||
if (location == Plasma::Types::Floating) {
|
||||
dir = Plasma::Types::Up;
|
||||
QPoint pos = mapToScene(QPoint(0, 0)).toPoint();
|
||||
|
||||
if (window() && window()->screen()) {
|
||||
pos = window()->mapToGlobal(pos);
|
||||
}
|
||||
QPoint popupPos = dlg->popupPosition(this, dlg->size());
|
||||
|
||||
if (pos.y() + height() <= popupPos.y()) {
|
||||
dir = Plasma::Types::Down;
|
||||
@ -163,6 +164,11 @@ void ToolTip::showToolTip()
|
||||
}
|
||||
} else {
|
||||
dir = Plasma::locationToDirection(location);
|
||||
if (dir == Plasma::Types::Left && (pos.x() + width() <= popupPos.x())) {
|
||||
dir = Plasma::Types::Right;
|
||||
} else if (dir == Plasma::Types::Up && (pos.y() + height() <= popupPos.y())) {
|
||||
dir = Plasma::Types::Down;
|
||||
}
|
||||
}
|
||||
|
||||
dlg->setDirection(dir);
|
||||
@ -170,7 +176,7 @@ void ToolTip::showToolTip()
|
||||
dlg->setMainItem(mainItem());
|
||||
dlg->setVisualParent(this);
|
||||
dlg->setInteractive(m_interactive);
|
||||
dlg->setVisible(true);
|
||||
QMetaObject::invokeMethod(dlg, "show", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QString ToolTip::mainText() const
|
||||
|
@ -126,18 +126,17 @@ bool ToolTipDialog::event(QEvent *e)
|
||||
|
||||
void ToolTipDialog::adjustGeometry(const QRect &geom)
|
||||
{
|
||||
switch (m_direction) {
|
||||
case Plasma::Types::Right:
|
||||
setX(x() + (size().width() - geom.size().width()));
|
||||
break;
|
||||
case Plasma::Types::Up:
|
||||
setY(y() + (size().height() - geom.size().height()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (isVisible()) {
|
||||
switch (m_direction) {
|
||||
case Plasma::Types::Left:
|
||||
setX(x() + (size().width() - geom.size().width()));
|
||||
break;
|
||||
case Plasma::Types::Up:
|
||||
setY(y() + (size().height() - geom.size().height()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
resize(geom.size());
|
||||
m_animation->setStartValue(position());
|
||||
|
@ -392,12 +392,6 @@ Dialog::Dialog(QQuickItem *parent)
|
||||
connect(d->syncTimer, SIGNAL(timeout()),
|
||||
this, SLOT(syncToMainItemSize()));
|
||||
|
||||
connect(this, &QWindow::xChanged, [=]() {
|
||||
d->requestSyncToMainItemSize(true);
|
||||
});
|
||||
connect(this, &QWindow::yChanged, [=]() {
|
||||
d->requestSyncToMainItemSize(true);
|
||||
});
|
||||
connect(this, SIGNAL(visibleChanged(bool)),
|
||||
this, SLOT(updateInputShape()));
|
||||
connect(this, SIGNAL(outputOnlyChanged()),
|
||||
|
Loading…
Reference in New Issue
Block a user