If using SHIFT and navigator button reset to screen center

This commit is contained in:
Klaus Basan
2019-09-03 00:43:59 +02:00
committed by Mat Sutcliffe
parent f20855b613
commit 2e6eac45bd
3 changed files with 13 additions and 3 deletions

View File

@@ -267,6 +267,15 @@ namespace BlackGui
}
if (shift && floating) { this->resetPosition(); }
if (floating)
{
// check where we are, otherwise reset if NOT appropriate
const QPoint p = this->rect().topLeft();
if (p.x() < 1 || p.y() < 1)
{
this->resetPosition();
}
}
}
void CDockWidget::toggleVisibility()
@@ -685,7 +694,8 @@ namespace BlackGui
if (!sGui) { return; }
// pos can be null during init
QPoint pos = CGuiUtility::mainWidgetGlobalPosition();
QWidget *mw = CGuiUtility::mainApplicationWidget();
QPoint pos = mw && mw->isVisible() ? CGuiUtility::mainWidgetGlobalPosition() : QPoint();
if (pos.isNull())
{
pos = CGuiApplication::currentScreen()->geometry().center() - this->rect().center();

View File

@@ -575,7 +575,7 @@ namespace BlackGui
if (init)
{
// float
QPoint offset(i * 25, i * 20);
const QPoint offset(i * 10, i * 10);
// after->setVisible(false);
// after->setFloating(true);
after->setOffsetWhenFloating(offset);

View File

@@ -111,7 +111,7 @@ void SwiftGuiStd::init()
// navigator
m_navigator->addAction(this->getToggleWindowVisibilityAction(m_navigator.data()));
m_navigator->addActions(ui->comp_MainInfoArea->getInfoAreaToggleFloatingActions(m_navigator.data()));
m_navigator->addActions(ui->comp_MainInfoArea->getInfoAreaToggleFloatingActions(m_navigator.data())); // here we add the actions for the main windows
m_navigator->addAction(this->getWindowNormalAction(m_navigator.data()));
m_navigator->addAction(this->getWindowMinimizeAction(m_navigator.data()));
m_navigator->addAction(this->getToggleStayOnTopAction(m_navigator.data()));