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
|
//heuristics for knowing the diration
|
||||||
Plasma::Types::Direction dir;
|
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) {
|
if (location == Plasma::Types::Floating) {
|
||||||
dir = Plasma::Types::Up;
|
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()) {
|
if (pos.y() + height() <= popupPos.y()) {
|
||||||
dir = Plasma::Types::Down;
|
dir = Plasma::Types::Down;
|
||||||
@ -163,6 +164,11 @@ void ToolTip::showToolTip()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dir = Plasma::locationToDirection(location);
|
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);
|
dlg->setDirection(dir);
|
||||||
@ -170,7 +176,7 @@ void ToolTip::showToolTip()
|
|||||||
dlg->setMainItem(mainItem());
|
dlg->setMainItem(mainItem());
|
||||||
dlg->setVisualParent(this);
|
dlg->setVisualParent(this);
|
||||||
dlg->setInteractive(m_interactive);
|
dlg->setInteractive(m_interactive);
|
||||||
dlg->setVisible(true);
|
QMetaObject::invokeMethod(dlg, "show", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ToolTip::mainText() const
|
QString ToolTip::mainText() const
|
||||||
|
@ -126,18 +126,17 @@ bool ToolTipDialog::event(QEvent *e)
|
|||||||
|
|
||||||
void ToolTipDialog::adjustGeometry(const QRect &geom)
|
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()) {
|
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());
|
resize(geom.size());
|
||||||
m_animation->setStartValue(position());
|
m_animation->setStartValue(position());
|
||||||
|
@ -392,12 +392,6 @@ Dialog::Dialog(QQuickItem *parent)
|
|||||||
connect(d->syncTimer, SIGNAL(timeout()),
|
connect(d->syncTimer, SIGNAL(timeout()),
|
||||||
this, SLOT(syncToMainItemSize()));
|
this, SLOT(syncToMainItemSize()));
|
||||||
|
|
||||||
connect(this, &QWindow::xChanged, [=]() {
|
|
||||||
d->requestSyncToMainItemSize(true);
|
|
||||||
});
|
|
||||||
connect(this, &QWindow::yChanged, [=]() {
|
|
||||||
d->requestSyncToMainItemSize(true);
|
|
||||||
});
|
|
||||||
connect(this, SIGNAL(visibleChanged(bool)),
|
connect(this, SIGNAL(visibleChanged(bool)),
|
||||||
this, SLOT(updateInputShape()));
|
this, SLOT(updateInputShape()));
|
||||||
connect(this, SIGNAL(outputOnlyChanged()),
|
connect(this, SIGNAL(outputOnlyChanged()),
|
||||||
|
Loading…
Reference in New Issue
Block a user