fix stretch item is visible on fashion mode

Change-Id: Ie66d6bbae395df07e08d74da1a3f802337d3538a
This commit is contained in:
石博文 2018-01-09 17:03:12 +08:00 committed by Deepin Code Review
parent e4cf250a28
commit 5a0000b18a
Notes: Deepin Code Review 2018-01-09 20:04:36 +08:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Tue, 09 Jan 2018 20:04:36 +0800
Reviewed-on: https://cr.deepin.io/30222
Project: dde/dde-dock
Branch: refs/heads/master
4 changed files with 6 additions and 9 deletions

View File

@ -27,6 +27,7 @@ StretchItem::StretchItem(QWidget *parent)
: DockItem(parent)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setMinimumSize(0, 0);
}
void StretchItem::mousePressEvent(QMouseEvent *e)

View File

@ -417,11 +417,11 @@ void MainPanel::adjustItemSize()
{
case Dock::Top:
case Dock::Bottom:
containsCompletely = totalWidth <= w; break;
containsCompletely = totalWidth <= w; break;
case Dock::Left:
case Dock::Right:
containsCompletely = totalHeight <= h; break;
containsCompletely = totalHeight <= h; break;
default:
Q_ASSERT(false);
@ -436,13 +436,11 @@ void MainPanel::adjustItemSize()
int base;
if (m_position == Dock::Top || m_position == Dock::Bottom)
{
// qDebug() << "width: " << totalWidth << width();
overflow = totalWidth;
base = w;
}
else
{
// qDebug() << "height: " << totalHeight << height();
overflow = totalHeight;
base = h;
}
@ -482,8 +480,6 @@ void MainPanel::adjustItemSize()
// ensure all extra space assigned
Q_ASSERT(extraDecrease == 0);
update();
}
///

View File

@ -35,7 +35,7 @@
#define xstr(s) str(s)
#define str(s) #s
#define PANEL_BORDER 0
#define PANEL_PADDING 6
#define PANEL_PADDING 0
#define WINDOW_OVERFLOW 5
DWIDGET_USE_NAMESPACE

View File

@ -521,8 +521,8 @@ void DockSettings::calculateWindowConfig()
}
}
const int perfectWidth = visibleItemCount * defaultWidth + PANEL_BORDER * 2 + PANEL_PADDING * 2 + WINDOW_OVERFLOW;
const int perfectHeight = visibleItemCount * defaultHeight + PANEL_BORDER * 2 + PANEL_PADDING * 2 + WINDOW_OVERFLOW;
const int perfectWidth = visibleItemCount * defaultWidth + PANEL_BORDER * 2 + PANEL_PADDING * 2;
const int perfectHeight = visibleItemCount * defaultHeight + PANEL_BORDER * 2 + PANEL_PADDING * 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)