feat(dock): add left and right side expansion function

This commit is contained in:
wangxuwen 2019-08-30 10:41:39 +08:00
parent 66e33b9b39
commit c8b30c3fe4
2 changed files with 8 additions and 2 deletions

View File

@ -589,7 +589,7 @@ void DockSettings::calculateWindowConfig()
}
case Left:
case Right: {
m_mainWindowSize.setHeight(calcHeight);
m_mainWindowSize.setHeight(primaryRect.height() - 20);
m_mainWindowSize.setWidth(defaultWidth + PANEL_BORDER);
m_isMaxSize = (calcHeight == maxHeight);
break;

View File

@ -540,6 +540,8 @@ void MainWindow::updateGeometry()
else
internalMove(windowRect.topLeft());
m_size = m_settings->m_mainWindowSize;
m_mainPanel->update();
m_shadowMaskOptimizeTimer->start();
}
@ -849,7 +851,7 @@ void MainWindow::mouseMoveEvent(QMouseEvent *event)
}
if (m_dragStatus) {
//int xdiff = QCursor::pos().x() - m_resizePoint.x();
int xdiff = QCursor::pos().x() - m_resizePoint.x();
int ydiff = QCursor::pos().y() - m_resizePoint.y();
if (Dock::Top == m_settings->position()) {
@ -859,7 +861,11 @@ void MainWindow::mouseMoveEvent(QMouseEvent *event)
m_settings->m_mainWindowSize.setHeight(qBound(MAINWINDOW_MIN_SIZE, m_size.height() - ydiff, MAINWINDOW_MAX_SIZE));
m_settings->m_mainWindowSize.setWidth(width());
} else if (Dock::Left == m_settings->position()) {
m_settings->m_mainWindowSize.setHeight(height());
m_settings->m_mainWindowSize.setWidth(qBound(MAINWINDOW_MIN_SIZE, m_size.width() + xdiff, MAINWINDOW_MAX_SIZE));
} else {
m_settings->m_mainWindowSize.setHeight(height());
m_settings->m_mainWindowSize.setWidth(qBound(MAINWINDOW_MIN_SIZE, m_size.width() - xdiff, MAINWINDOW_MAX_SIZE));
}
resizeMainWindow();