compute editThickness in View c++ level

pull/18/head
Michail Vourlakos 5 years ago
parent 941ece36fb
commit 7fd56aebfb

@ -251,6 +251,9 @@ void View::init(Plasma::Containment *plasma_containment)
connect(this, &QQuickWindow::heightChanged, this, &View::heightChanged);
connect(this, &QQuickWindow::heightChanged, this, &View::updateAbsoluteGeometry);
connect(this, &View::fontPixelSizeChanged, this, &View::editThicknessChanged);
connect(this, &View::normalHighestThicknessChanged, this, &View::editThicknessChanged);
connect(this, &View::activitiesChanged, this, &View::applyActivitiesToWindows);
connect(this, &View::localGeometryChanged, this, [&]() {
@ -703,6 +706,21 @@ void View::setNormalThickness(int thickness)
emit normalThicknessChanged();
}
int View::normalHighestThickness() const
{
return m_normalHighestThickness;
}
void View::setNormalHighestThickness(int thickness)
{
if (m_normalHighestThickness == thickness) {
return;
}
m_normalHighestThickness = thickness;
emit normalHighestThicknessChanged();
}
int View::headThicknessGap() const
{
return m_headThicknessGap;
@ -865,18 +883,11 @@ void View::setMaxLength(float length)
int View::editThickness() const
{
return m_editThickness;
}
void View::setEditThickness(int thickness)
{
if (m_editThickness == thickness) {
return;
}
m_editThickness = thickness;
int smallspacing = 4;
int ruler_height{m_fontPixelSize};
int header_height{m_fontPixelSize + 2*smallspacing};
emit editThicknessChanged();
return m_normalHighestThickness + ruler_height + header_height + 6*smallspacing;
}
int View::maxThickness() const

@ -107,9 +107,10 @@ class View : public PlasmaQuick::ContainmentView
Q_PROPERTY(int y READ y NOTIFY yChanged)
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
Q_PROPERTY(int editThickness READ editThickness WRITE setEditThickness NOTIFY editThicknessChanged)
Q_PROPERTY(int editThickness READ editThickness NOTIFY editThicknessChanged)
Q_PROPERTY(int maxThickness READ maxThickness WRITE setMaxThickness NOTIFY maxThicknessChanged)
Q_PROPERTY(int normalThickness READ normalThickness WRITE setNormalThickness NOTIFY normalThicknessChanged)
Q_PROPERTY(int normalHighestThickness READ normalHighestThickness WRITE setNormalHighestThickness NOTIFY normalHighestThicknessChanged)
Q_PROPERTY(int headThicknessGap READ headThicknessGap WRITE setHeadThicknessGap NOTIFY headThicknessGapChanged)
Q_PROPERTY(int screenEdgeMargin READ screenEdgeMargin WRITE setScreenEdgeMargin NOTIFY screenEdgeMarginChanged)
@ -184,7 +185,6 @@ public:
void setFontPixelSize(int size);
int editThickness() const;
void setEditThickness(int thickness);
int maxThickness() const;
void setMaxThickness(int thickness);
@ -192,6 +192,9 @@ public:
int normalThickness() const;
void setNormalThickness(int thickness);
int normalHighestThickness() const;
void setNormalHighestThickness(int thickness);
int headThicknessGap() const;
void setHeadThicknessGap(int thickness);
@ -309,6 +312,7 @@ signals:
void maxLengthChanged();
void maxThicknessChanged();
void normalThicknessChanged();
void normalHighestThicknessChanged();
void offsetChanged();
void onPrimaryChanged();
void positionerChanged();
@ -379,9 +383,9 @@ private:
bool m_isTouchingTopViewAndIsBusy{false};
int m_fontPixelSize{ -1};
int m_editThickness{24};
int m_maxThickness{24};
int m_normalThickness{24};
int m_normalHighestThickness{24};
int m_headThicknessGap{0};
int m_screenEdgeMargin{-1};
float m_maxLength{1};

@ -156,9 +156,9 @@ Item{
Binding{
target: latteView
property:"editThickness"
when: latteView
value: thicknessEditMode
property:"normalHighestThickness"
when: latteView && inPublishingState
value: thicknessNormalOriginalValue
}
Binding {

Loading…
Cancel
Save