fix display mode error

Change-Id: I7f99171b76c3095b0bd93b0051b7361320648427
This commit is contained in:
石博文 2016-08-04 10:20:55 +08:00
parent 008a2858d9
commit 2815276f71
Notes: Deepin Code Review 2016-08-04 02:26:08 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Thu, 04 Aug 2016 02:26:07 +0000
Reviewed-on: https://cr.deepin.io/14908
Project: dde/dde-dock
Branch: refs/heads/master
2 changed files with 13 additions and 7 deletions

View File

@ -95,7 +95,7 @@ DockSettings::DockSettings(QWidget *parent)
connect(m_dockInter, &DBusDock::PositionChanged, this, &DockSettings::positionChanged);
connect(m_dockInter, &DBusDock::IconSizeChanged, this, &DockSettings::iconSizeChanged);
connect(m_dockInter, &DBusDock::DisplayModeChanged, this, &DockSettings::displayModeChanged);
connect(m_dockInter, &DBusDock::HideModeChanged, this, &DockSettings::hideModeChanged);
connect(m_dockInter, &DBusDock::HideModeChanged, this, &DockSettings::hideModeChanged, Qt::QueuedConnection);
connect(m_dockInter, &DBusDock::HideStateChanged, this, &DockSettings::hideStateChanegd);
connect(m_dockInter, &DBusDock::ServiceRestarted, this, &DockSettings::resetFrontendGeometry);

View File

@ -129,6 +129,7 @@ void MainWindow::initConnections()
connect(m_settings, &DockSettings::dataChanged, m_positionUpdateTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
connect(m_settings, &DockSettings::windowGeometryChanged, this, &MainWindow::updateGeometry, Qt::DirectConnection);
connect(m_settings, &DockSettings::windowHideModeChanged, this, &MainWindow::setStrutPartial, Qt::QueuedConnection);
connect(m_settings, &DockSettings::windowHideModeChanged, this, &MainWindow::resetPanelEnvironment);
connect(m_settings, &DockSettings::windowVisibleChanegd, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
connect(m_settings, &DockSettings::autoHideChanged, this, &MainWindow::updatePanelVisible);
@ -326,22 +327,27 @@ void MainWindow::resetPanelEnvironment()
const int offsetX = (primaryRect.width() - size.width()) / 2;
const int offsetY = (primaryRect.height() - size.height()) / 2;
QWidget::setFixedSize(size);
m_mainPanel->setFixedSize(size);
m_mainPanel->move(0, 0);
m_mainPanel->setFixedSize(size);
QWidget::setFixedSize(size);
m_sizeChangeAni->setEndValue(size);
QPoint position;
switch (m_settings->position())
{
case Top:
QWidget::move(primaryRect.topLeft().x() + offsetX, 0); break;
position = QPoint(primaryRect.topLeft().x() + offsetX, 0); break;
case Left:
QWidget::move(primaryRect.topLeft().x(), offsetY); break;
position = QPoint(primaryRect.topLeft().x(), offsetY); break;
case Right:
QWidget::move(primaryRect.right() - size.width() + 1, offsetY); break;
position = QPoint(primaryRect.right() - size.width() + 1, offsetY); break;
case Bottom:
QWidget::move(offsetX, primaryRect.bottom() - size.height() + 1); break;
position = QPoint(offsetX, primaryRect.bottom() - size.height() + 1); break;
default:
Q_ASSERT(false);
}
QWidget::move(position);
m_posChangeAni->setEndValue(position);
}
void MainWindow::updatePanelVisible()