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,8 +143,6 @@ void ToolTip::showToolTip()
|
||||
|
||||
//heuristics for knowing the diration
|
||||
Plasma::Types::Direction dir;
|
||||
if (location == Plasma::Types::Floating) {
|
||||
dir = Plasma::Types::Up;
|
||||
QPoint pos = mapToScene(QPoint(0, 0)).toPoint();
|
||||
|
||||
if (window() && window()->screen()) {
|
||||
@ -152,6 +150,9 @@ void ToolTip::showToolTip()
|
||||
}
|
||||
QPoint popupPos = dlg->popupPosition(this, dlg->size());
|
||||
|
||||
if (location == Plasma::Types::Floating) {
|
||||
dir = Plasma::Types::Up;
|
||||
|
||||
if (pos.y() + height() <= popupPos.y()) {
|
||||
dir = Plasma::Types::Down;
|
||||
} else if (pos.x() + width() <= popupPos.x()) {
|
||||
@ -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,8 +126,9 @@ bool ToolTipDialog::event(QEvent *e)
|
||||
|
||||
void ToolTipDialog::adjustGeometry(const QRect &geom)
|
||||
{
|
||||
if (isVisible()) {
|
||||
switch (m_direction) {
|
||||
case Plasma::Types::Right:
|
||||
case Plasma::Types::Left:
|
||||
setX(x() + (size().width() - geom.size().width()));
|
||||
break;
|
||||
case Plasma::Types::Up:
|
||||
@ -137,8 +138,6 @@ void ToolTipDialog::adjustGeometry(const QRect &geom)
|
||||
break;
|
||||
}
|
||||
|
||||
if (isVisible()) {
|
||||
|
||||
resize(geom.size());
|
||||
m_animation->setStartValue(position());
|
||||
m_animation->setEndValue(geom.topLeft());
|
||||
|
@ -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