consider shadow size for currentThickness

--this solves an issue concerning configuration window
placement when changing locations
pull/1/head
Michail Vourlakos 8 years ago
parent f844f91ac2
commit a74fe28c18

@ -110,11 +110,11 @@ void DockConfigView::syncGeometry()
if (location == Plasma::Types::TopEdge) {
setPosition(sGeometry.center().x() - size.width() / 2
, m_dockView->currentThickness() + 1);
, m_dockView->currentThickness());
} else if (location == Plasma::Types::BottomEdge) {
setPosition(sGeometry.center().x() - size.width() / 2
, sGeometry.height() - m_dockView->currentThickness() - size.height() - 1);
, sGeometry.height() - m_dockView->currentThickness() - size.height());
}
}
@ -128,10 +128,10 @@ void DockConfigView::syncGeometry()
if (location == Plasma::Types::LeftEdge) {
setPosition(m_dockView->currentThickness()
, sGeometry.center().y() - size.height() / 2 + 1);
, sGeometry.center().y() - size.height() / 2);
} else if (location == Plasma::Types::RightEdge) {
setPosition(sGeometry.width() - m_dockView->currentThickness() - size.width() - 1
setPosition(sGeometry.width() - m_dockView->currentThickness() - size.width()
, sGeometry.center().y() - size.height() / 2);
}

@ -329,9 +329,9 @@ inline void DockView::syncGeometry()
int DockView::currentThickness() const
{
if (formFactor() == Plasma::Types::Vertical) {
return m_maskArea.isNull() ? width() : m_maskArea.width();
return m_maskArea.isNull() ? width() : m_maskArea.width() - m_shadow;
} else {
return m_maskArea.isNull() ? height() : m_maskArea.height();
return m_maskArea.isNull() ? height() : m_maskArea.height() - m_shadow;
}
}
@ -445,6 +445,22 @@ void DockView::setMaskArea(QRect area)
emit maskAreaChanged();
}
int DockView::shadow() const
{
return m_shadow;
}
void DockView::setShadow(int shadow)
{
if (m_shadow == shadow) {
return;
}
m_shadow = shadow;
emit shadowChanged();
}
bool DockView::tasksPresent()
{
foreach (Plasma::Applet *applet, containment()->applets()) {

@ -51,6 +51,7 @@ class DockView : public PlasmaQuick::ContainmentView {
Q_PROPERTY(int length READ length WRITE setLength NOTIFY lengthChanged)
Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength NOTIFY maxLengthChanged)
Q_PROPERTY(int maxThickness READ maxThickness WRITE setMaxThickness NOTIFY maxThicknessChanged)
Q_PROPERTY(int shadow READ shadow WRITE setShadow NOTIFY shadowChanged)
Q_PROPERTY(QRect maskArea READ maskArea WRITE setMaskArea NOTIFY maskAreaChanged)
Q_PROPERTY(VisibilityManager *visibility READ visibility NOTIFY visibilityChanged)
@ -80,7 +81,10 @@ public:
int maxThickness() const;
void setMaxThickness(int thickness);
int shadow() const;
void setShadow(int shadow);
QRect maskArea() const;
void setMaskArea(QRect area);
@ -125,6 +129,7 @@ signals:
void maxThicknessChanged();
void visibilityChanged();
void maskAreaChanged();
void shadowChanged();
void localDockGeometryChanged();
@ -145,6 +150,7 @@ private:
int m_length{0};
int m_maxLength{INT_MAX};
int m_maxThickness{24};
int m_shadow{0};
QRect m_localDockGeometry;
QRect m_maskArea;

@ -54,7 +54,15 @@ Image{
onLocationChanged: initializeEditPosition();
}
function initializeNormalPosition() {
onEditAnimationEndedChanged: {
if (editAnimationEnded) {
dock.shadow = shadowSize;
} else {
dock.shadow = 0;
}
}
function initializeNormalPosition() {
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
x = 0;
y = rootThickness;

Loading…
Cancel
Save