Commit cc4b50f0 authored by Vlad Rakhmanin's avatar Vlad Rakhmanin
Browse files

Connected fontSize to UI.

Amended the font size setter, added fontSize as a Q_PROPERTY and added a dummy UI display to ensure that the connection works.
parent 3182e4f8
/**
* SPDX-FileCopyrightText: (C) 2020 Carl Schwan <carl@carlschwan.eu>
*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-LicenseRef: GPL-3.0-or-later
*/
import QtQuick 2.1
......@@ -44,6 +44,15 @@ Kirigami.ScrollablePage {
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
Kirigami.Heading {
level: 1
font.bold: true
text: i18n("Font size: %1", Kontrast.fontSize)
color: Kontrast.textColor
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
Kirigami.Heading {
level: 3
font.bold: true
......
......@@ -120,7 +120,11 @@ int Kontrast::fontSize() const
void Kontrast::setFontSize(int fontSize)
{
if (m_fontSize == fontSize) {
return;
}
m_fontSize = fontSize;
Q_EMIT fontSizeChanged();
}
QColor Kontrast::backgroundColor() const
......
......@@ -26,6 +26,8 @@ class Kontrast : public QObject
Q_PROPERTY(int textLightness READ textLightness WRITE setTextLightness NOTIFY textColorChanged)
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
Q_PROPERTY(int backgroundHue READ backgroundHue WRITE setBackgroundHue NOTIFY backgroundColorChanged)
......@@ -100,12 +102,13 @@ Q_SIGNALS:
void backgroundColorChanged();
void contrastChanged();
void grabbedColorChanged();
void fontSizeChanged();
private:
QColor m_textColor;
QColor m_backgroundColor;
QColor m_grabbedColor;
int m_fontSize;
int m_fontSize = 24;
KAboutData m_about;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment