mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Ref T592, improved position handling/failover: use screen position if main widget pos. is unavailable
This commit is contained in:
committed by
Mat Sutcliffe
parent
89c5d87c1c
commit
546a8a06d3
@@ -411,13 +411,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
|
|
||||||
// and move
|
// and move
|
||||||
QPoint mainWindowPos = BlackGui::CGuiUtility::mainWidgetPosition();
|
this->resetPosition();
|
||||||
if (!mainWindowPos.isNull())
|
|
||||||
{
|
|
||||||
int x = mainWindowPos.x() + m_offsetWhenFloating.x();
|
|
||||||
int y = mainWindowPos.y() + m_offsetWhenFloating.y();
|
|
||||||
this->move(x, y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CDockWidget::windowTitleOrBackup() const
|
QString CDockWidget::windowTitleOrBackup() const
|
||||||
@@ -623,6 +617,17 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
// center on screen when floating
|
// center on screen when floating
|
||||||
if (!this->isFloating()) { return; }
|
if (!this->isFloating()) { return; }
|
||||||
this->move(sGui->currentScreen()->geometry().center() - this->rect().center());
|
if (!sGui) { return; }
|
||||||
|
|
||||||
|
// pos can be null during init
|
||||||
|
QPoint pos = CGuiUtility::mainWidgetGlobalPosition();
|
||||||
|
if (pos.isNull())
|
||||||
|
{
|
||||||
|
pos = sGui->currentScreen()->geometry().center() - this->rect().center();
|
||||||
|
}
|
||||||
|
|
||||||
|
const int x = pos.x() + m_offsetWhenFloating.x();
|
||||||
|
const int y = pos.y() + m_offsetWhenFloating.y();
|
||||||
|
this->move(x, y);
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user