use same font metrics for qml and c++ code

pull/2/head
Michail Vourlakos 7 years ago
parent 14fa05745f
commit 1a3cb13094

@ -128,8 +128,6 @@ void DockConfigView::init()
QByteArray tempFilePath = "lattedockconfigurationui";
m_largeSpacing = QFontMetrics(QGuiApplication::font()).boundingRect(QStringLiteral("M")).height();
updateEnabledBorders();
auto source = QUrl::fromLocalFile(m_dockView->containment()->corona()->kPackage().filePath(tempFilePath));
@ -202,7 +200,7 @@ void DockConfigView::syncGeometry()
const auto location = m_dockView->containment()->location();
const auto sGeometry = screen()->geometry();
int clearThickness = m_dockView->normalThickness() + m_largeSpacing;
int clearThickness = m_dockView->normalThickness() + m_dockView->fontPixelSize();
QPoint position{0, 0};

@ -113,8 +113,6 @@ private:
bool m_inReverse{false}; //! it is used by the borders
bool m_showInlineProperties{false};
int m_largeSpacing;
QPointer<DockView> m_dockView;
QPointer<DockSecConfigView> m_secConfigView;
QTimer m_screenSyncTimer;

@ -118,8 +118,6 @@ void DockSecConfigView::init()
QByteArray tempFilePath = "lattedocksecondaryconfigurationui";
m_largeSpacing = QFontMetrics(QGuiApplication::font()).boundingRect(QStringLiteral("M")).height();
updateEnabledBorders();
auto source = QUrl::fromLocalFile(m_dockView->containment()->corona()->kPackage().filePath(tempFilePath));
@ -149,9 +147,9 @@ void DockSecConfigView::syncGeometry()
const auto location = m_dockView->containment()->location();
const auto sGeometry = screen()->geometry();
int clearThickness = m_dockView->normalThickness() + m_largeSpacing;
int clearThickness = m_dockView->normalThickness() + m_dockView->fontPixelSize();
int secondaryConfigSpacing = 2 * m_largeSpacing;
int secondaryConfigSpacing = 2 * m_dockView->fontPixelSize();
QPoint position{0, 0};

@ -82,8 +82,6 @@ private slots:
private:
void setupWaylandIntegration();
int m_largeSpacing;
QPointer<DockView> m_dockView;
QPointer<QWindow> m_parent;
QTimer m_screenSyncTimer;

@ -1324,6 +1324,22 @@ void DockView::setShadow(int shadow)
emit shadowChanged();
}
int DockView::fontPixelSize() const
{
return m_fontPixelSize;
}
void DockView::setFontPixelSize(int size)
{
if (m_fontPixelSize == size) {
return;
}
m_fontPixelSize = size;
emit fontPixelSizeChanged();
}
void DockView::applyActivitiesToWindows()
{
if (m_visibility) {

@ -74,6 +74,7 @@ class DockView : public PlasmaQuick::ContainmentView {
Q_PROPERTY(int alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
Q_PROPERTY(int docksCount READ docksCount NOTIFY docksCountChanged)
Q_PROPERTY(int dockTransparency READ dockTransparency WRITE setDockTransparency NOTIFY dockTransparencyChanged)
Q_PROPERTY(int fontPixelSize READ fontPixelSize WRITE setFontPixelSize NOTIFY fontPixelSizeChanged)
Q_PROPERTY(int totalDocksCount READ totalDocksCount NOTIFY totalDocksCountChanged)
Q_PROPERTY(int x READ x NOTIFY xChanged)
Q_PROPERTY(int y READ y NOTIFY yChanged)
@ -147,6 +148,9 @@ public:
int dockTransparency() const;
void setDockTransparency(int transparency);
int fontPixelSize() const;
void setFontPixelSize(int size);
int maxThickness() const;
void setMaxThickness(int thickness);
@ -266,6 +270,7 @@ signals:
void drawEffectsChanged();
void effectsAreaChanged();
void enabledBordersChanged();
void fontPixelSizeChanged();
void widthChanged();
void heightChanged();
void inEditModeChanged();
@ -321,6 +326,7 @@ private:
bool m_inEditMode{false};
bool m_onPrimary{true};
int m_dockTransparency{100};
int m_fontPixelSize{-1};
int m_maxThickness{24};
int m_normalThickness{24};
int m_offset{0};

@ -117,6 +117,13 @@ Item{
&& (!root.inStartup || inForceHiding || inTempHiding)
}
Binding{
target: dock
property: "fontPixelSize"
when: theme
value: theme.defaultFont.pixelSize
}
Binding{
target: dock
property:"inEditMode"

Loading…
Cancel
Save