adjust panel margin

Change-Id: Idad5892fb36d4a30eb5c99c0ac4b162b514af4c5
This commit is contained in:
石博文 2018-03-15 11:14:24 +08:00
parent ca1c5acd12
commit 9485d5a4db
Notes: gerrit 2018-03-15 03:19:35 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Thu, 15 Mar 2018 03:19:34 +0000
Reviewed-on: https://cr.deepin.io/32642
Project: dde/dde-dock
Branch: refs/heads/master
4 changed files with 14 additions and 6 deletions

View File

@ -103,9 +103,15 @@ void MainPanel::updateDockPosition(const Position dockPosition)
switch (m_position)
{
case Position::Top:
case Position::Bottom: m_itemLayout->setDirection(QBoxLayout::LeftToRight); break;
case Position::Bottom:
m_itemLayout->setDirection(QBoxLayout::LeftToRight);
m_itemLayout->setContentsMargins(1, 0, 1, 0);
break;
case Position::Left:
case Position::Right: m_itemLayout->setDirection(QBoxLayout::TopToBottom); break;
case Position::Right:
m_itemLayout->setDirection(QBoxLayout::TopToBottom);
m_itemLayout->setContentsMargins(0, 1, 0, 1);
break;
}
m_itemAdjustTimer->start();
@ -420,8 +426,8 @@ void MainPanel::adjustItemSize()
}
}
const int w = width() - PANEL_BORDER * 2 - PANEL_PADDING * 2;
const int h = height() - PANEL_BORDER * 2 - PANEL_PADDING * 2;
const int w = width() - PANEL_BORDER * 2 - PANEL_PADDING * 2 - PANEL_MARGIN * 2;
const int h = height() - PANEL_BORDER * 2 - PANEL_PADDING * 2 - PANEL_MARGIN * 2;
// test if panel can display all items completely
bool containsCompletely = false;

View File

@ -36,6 +36,7 @@
#define str(s) #s
#define PANEL_BORDER 0
#define PANEL_PADDING 0
#define PANEL_MARGIN 1
#define WINDOW_OVERFLOW 5
DWIDGET_USE_NAMESPACE

View File

@ -531,8 +531,8 @@ void DockSettings::calculateWindowConfig()
}
}
const int perfectWidth = visibleItemCount * defaultWidth + PANEL_BORDER * 2 + PANEL_PADDING * 2;
const int perfectHeight = visibleItemCount * defaultHeight + PANEL_BORDER * 2 + PANEL_PADDING * 2;
const int perfectWidth = visibleItemCount * defaultWidth + PANEL_BORDER * 2 + PANEL_PADDING * 2 + PANEL_MARGIN * 2;
const int perfectHeight = visibleItemCount * defaultHeight + PANEL_BORDER * 2 + PANEL_PADDING * 2 + PANEL_MARGIN * 2;
const int calcWidth = qMin(m_primaryRect.width() - FASHION_MODE_PADDING * 2, perfectWidth);
const int calcHeight = qMin(m_primaryRect.height() - FASHION_MODE_PADDING * 2, perfectHeight);
switch (m_position)

View File

@ -95,6 +95,7 @@ MainWindow::MainWindow(QWidget *parent)
setAttribute(Qt::WA_TranslucentBackground);
setAcceptDrops(true);
DPlatformWindowHandle::enableDXcbForWindow(this, true);
m_platformWindowHandle.setEnableBlurWindow(false);
m_platformWindowHandle.setTranslucentBackground(true);
m_platformWindowHandle.setWindowRadius(0);