refactor: delete unwanted border values

WINDOW_OVERFLOW
在d17b1661b13482fad66e3888aaa0f843ea2fa013提交中开始使用,现在发现不需要删除window
redius导致的边框距离了,所以删除这个值,避免影响dock中对rect的计算。
This commit is contained in:
justforlxz 2019-05-06 15:26:49 +08:00
parent 6f317050f3
commit e15f882330
No known key found for this signature in database
GPG Key ID: 593AFD577C1B1A60
3 changed files with 13 additions and 30 deletions

View File

@ -39,7 +39,6 @@
#define PANEL_BORDER 0
#define PANEL_PADDING 0
#define PANEL_MARGIN 1
#define WINDOW_OVERFLOW 4
DWIDGET_USE_NAMESPACE

View File

@ -175,17 +175,7 @@ const QRect DockSettings::primaryRect() const
const QSize DockSettings::panelSize() const
{
switch (m_position)
{
case Top:
case Bottom:
return m_mainWindowSize - QSize(0, WINDOW_OVERFLOW);
case Left:
case Right:
return m_mainWindowSize - QSize(WINDOW_OVERFLOW, 0);
}
Q_UNREACHABLE();
return m_mainWindowSize;
}
const QRect DockSettings::windowRect(const Position position, const bool hide) const
@ -210,13 +200,13 @@ const QRect DockSettings::windowRect(const Position position, const bool hide) c
switch (position)
{
case Top:
p = QPoint(offsetX, -WINDOW_OVERFLOW); break;
p = QPoint(offsetX, 0); break;
case Left:
p = QPoint(-WINDOW_OVERFLOW, offsetY); break;
p = QPoint(0, offsetY); break;
case Right:
p = QPoint(primaryRect.width() - size.width() + WINDOW_OVERFLOW, offsetY); break;
p = QPoint(primaryRect.width() - size.width(), offsetY); break;
case Bottom:
p = QPoint(offsetX, primaryRect.height() - size.height() + WINDOW_OVERFLOW); break;
p = QPoint(offsetX, primaryRect.height() - size.height()); break;
default:Q_UNREACHABLE();
}
@ -551,14 +541,14 @@ void DockSettings::calculateWindowConfig()
{
case Top:
case Bottom:
m_mainWindowSize.setHeight(defaultHeight + PANEL_BORDER + WINDOW_OVERFLOW);
m_mainWindowSize.setHeight(defaultHeight + PANEL_BORDER);
m_mainWindowSize.setWidth(primaryRect().width());
break;
case Left:
case Right:
m_mainWindowSize.setHeight(primaryRect().height());
m_mainWindowSize.setWidth(defaultWidth + PANEL_BORDER + WINDOW_OVERFLOW);
m_mainWindowSize.setWidth(defaultWidth + PANEL_BORDER);
break;
default:

View File

@ -616,12 +616,6 @@ void MainWindow::expand()
m_panelHideAni->stop();
QPoint finishPos(0, 0);
switch (m_settings->position())
{
case Left: finishPos.setX(WINDOW_OVERFLOW); break;
case Top: finishPos.setY(WINDOW_OVERFLOW); break;
default:;
}
resetPanelEnvironment(true, false);
@ -631,9 +625,9 @@ void MainWindow::expand()
const QSize &size = m_settings->windowSize();
switch (m_settings->position())
{
case Top: startPos.setY(-size.height() + WINDOW_OVERFLOW); break;
case Top: startPos.setY(-size.height()); break;
case Bottom: startPos.setY(size.height()); break;
case Left: startPos.setX(-size.width() + WINDOW_OVERFLOW); break;
case Left: startPos.setX(-size.width()); break;
case Right: startPos.setX(size.width()); break;
}
@ -652,9 +646,9 @@ void MainWindow::narrow(const Position prevPos)
QPoint finishPos(0, 0);
switch (prevPos)
{
case Top: finishPos.setY(-size.height() + WINDOW_OVERFLOW); break;
case Top: finishPos.setY(-size.height()); break;
case Bottom: finishPos.setY(size.height()); break;
case Left: finishPos.setX(-size.width() + WINDOW_OVERFLOW); break;
case Left: finishPos.setX(-size.width()); break;
case Right: finishPos.setX(size.width()); break;
}
@ -688,9 +682,9 @@ void MainWindow::resetPanelEnvironment(const bool visible, const bool resetPosit
QPoint finishPos(0, 0);
switch (position)
{
case Top: finishPos.setY((visible ? WINDOW_OVERFLOW : -r.height())); break;
case Top: finishPos.setY((visible ? 0 : -r.height())); break;
case Bottom: finishPos.setY(visible ? 0 : r.height()); break;
case Left: finishPos.setX((visible ? WINDOW_OVERFLOW : -r.width())); break;
case Left: finishPos.setX((visible ? 0 : -r.width())); break;
case Right: finishPos.setX(visible ? 0 : r.width()); break;
}