Skip to content

Commit

Permalink
fix: margin of window mode
Browse files Browse the repository at this point in the history
Change-Id: I0cc7de15f4cb462e866ab732ed5b2f958556ea5e
  • Loading branch information
Iceyer committed Dec 11, 2017
1 parent 6b56868 commit 982940f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/widgets/darrowrectangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,12 @@ QSize DArrowRectangle::getFixedSize()
switch (d->m_arrowDirection) {
case ArrowLeft:
case ArrowRight:
return QSize(d->m_content->width() + delta * 2 + d->m_arrowHeight, d->m_content->height() + delta * 1);
return QSize(d->m_content->width() + delta * 2 + d->m_arrowHeight - ((d->floatMode == FloatWidget) ? delta : 0),
d->m_content->height() + delta * 2);
case ArrowTop:
case ArrowBottom:
return QSize(d->m_content->width() + delta * 2, d->m_content->height() + delta * 1 + d->m_arrowHeight);
return QSize(d->m_content->width() + delta * 2,
d->m_content->height() + delta * 2 + d->m_arrowHeight - ((d->floatMode == FloatWidget) ? delta : 0));
}
}

Expand Down Expand Up @@ -542,7 +544,7 @@ QPainterPath DArrowRectanglePrivate::getLeftCornerPath()
if (!m_handle) {
qreal delta = q->shadowBlurRadius() + m_shadowDistance;

rect = rect.marginsRemoved(QMargins(0, delta, delta, delta));
rect = rect.marginsRemoved(QMargins((DArrowRectangle::FloatWidget == floatMode) ? 0 : delta, delta, delta, delta));
}

QPoint cornerPoint(rect.x(), rect.y() + (m_arrowY > 0 ? m_arrowY : (rect.height() / 2)));
Expand Down Expand Up @@ -581,7 +583,7 @@ QPainterPath DArrowRectanglePrivate::getRightCornerPath()
if (!m_handle) {
qreal delta = q->shadowBlurRadius() + m_shadowDistance;

rect = rect.marginsRemoved(QMargins(delta, delta, 0, delta));
rect = rect.marginsRemoved(QMargins(delta, delta, (DArrowRectangle::FloatWidget == floatMode) ? 0 : delta, delta));
}

QPoint cornerPoint(rect.x() + rect.width(), rect.y() + (m_arrowY > 0 ? m_arrowY : rect.height() / 2));
Expand Down Expand Up @@ -619,7 +621,7 @@ QPainterPath DArrowRectanglePrivate::getTopCornerPath()

if (!m_handle) {
qreal delta = q->shadowBlurRadius() + m_shadowDistance;
rect = rect.marginsRemoved(QMargins(delta, 0, delta, delta));
rect = rect.marginsRemoved(QMargins(delta, (DArrowRectangle::FloatWidget == floatMode) ? 0 : delta, delta, delta));
}

QPoint cornerPoint(rect.x() + (m_arrowX > 0 ? m_arrowX : rect.width() / 2), rect.y());
Expand Down Expand Up @@ -658,7 +660,7 @@ QPainterPath DArrowRectanglePrivate::getBottomCornerPath()
if (!m_handle) {
qreal delta = q->shadowBlurRadius() + m_shadowDistance;

rect = rect.marginsRemoved(QMargins(delta, delta, delta, 0));
rect = rect.marginsRemoved(QMargins(delta, delta, delta, (DArrowRectangle::FloatWidget == floatMode) ? 0 : delta));
}

QPoint cornerPoint(rect.x() + (m_arrowX > 0 ? m_arrowX : qRound(double(rect.width()) / 2)), rect.y() + rect.height());
Expand Down Expand Up @@ -888,13 +890,13 @@ void DArrowRectanglePrivate::setContent(QWidget *content)

switch (m_arrowDirection) {
case DArrowRectangle::ArrowLeft:
m_content->move(m_arrowHeight + delta, delta);
m_content->move(m_arrowHeight + ((DArrowRectangle::FloatWidget == floatMode) ? 0 : delta), delta);
break;
case DArrowRectangle::ArrowRight:
m_content->move(delta, delta);
break;
case DArrowRectangle::ArrowTop:
m_content->move(delta, 0 + m_arrowHeight);
m_content->move(delta, ((DArrowRectangle::FloatWidget == floatMode) ? 0 : delta) + m_arrowHeight);
break;
case DArrowRectangle::ArrowBottom:
m_content->move(delta, delta);
Expand Down

0 comments on commit 982940f

Please sign in to comment.