Commit 1d5fb9b5 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Run clang-format

If you want git blame to ignore formatting revisions run:
git config blame.ignoreRevsFile .git-blame-ignore-revs
parent 367ee350
......@@ -25,6 +25,4 @@ public:
Kirigami::PlatformTheme *createPlatformTheme(QObject *parent) override;
};
#endif // KIRIGAMIPLASMAFACTORY_H
......@@ -6,18 +6,18 @@
*/
#include "plasmadesktoptheme.h"
#include <QQmlEngine>
#include <QQmlContext>
#include <QGuiApplication>
#include <QQuickRenderControl>
#include <QPalette>
#include <QDebug>
#include <QQuickWindow>
#include <KIconLoader>
#include <KColorUtils>
#include <KColorScheme>
#include <KColorUtils>
#include <KConfigGroup>
#include <KIconLoader>
#include <QDBusConnection>
#include <QDebug>
#include <QGuiApplication>
#include <QPalette>
#include <QQmlContext>
#include <QQmlEngine>
#include <QQuickRenderControl>
#include <QQuickWindow>
class IconLoaderSingleton
{
......@@ -44,32 +44,33 @@ public:
: QObject()
, buttonScheme(QPalette::Active, KColorScheme::ColorSet::Button)
{
connect(qGuiApp, &QGuiApplication::paletteChanged,
this, &StyleSingleton::refresh);
connect(qGuiApp, &QGuiApplication::paletteChanged, this, &StyleSingleton::refresh);
// Use DBus in order to listen for kdeglobals changes directly, as the
// QApplication doesn't expose the font variants we're looking for,
// namely smallFont.
QDBusConnection::sessionBus().connect( QString(),
QStringLiteral( "/KGlobalSettings" ),
QStringLiteral( "org.kde.KGlobalSettings" ),
QStringLiteral( "notifyChange" ), this, SLOT(notifyWatchersConfigurationChange()));
QDBusConnection::sessionBus().connect(QString(),
QStringLiteral("/KGlobalSettings"),
QStringLiteral("org.kde.KGlobalSettings"),
QStringLiteral("notifyChange"),
this,
SLOT(notifyWatchersConfigurationChange()));
connect(qGuiApp, &QGuiApplication::fontDatabaseChanged, this, &StyleSingleton::notifyWatchersConfigurationChange);
/* QtTextRendering uses less memory, so use it in low power mode.
*
* For scale factors greater than 2, native rendering doesn't actually do much.
* Does native rendering even work when scaleFactor >= 2?
*
* NativeTextRendering is still distorted sometimes with fractional scale
* factors, despite https://bugreports.qt.io/browse/QTBUG-67007 being closed.
* 1.5x scaling looks generally OK, but there are occasional and difficult to
* reproduce issues with all fractional scale factors.
*/
*
* For scale factors greater than 2, native rendering doesn't actually do much.
* Does native rendering even work when scaleFactor >= 2?
*
* NativeTextRendering is still distorted sometimes with fractional scale
* factors, despite https://bugreports.qt.io/browse/QTBUG-67007 being closed.
* 1.5x scaling looks generally OK, but there are occasional and difficult to
* reproduce issues with all fractional scale factors.
*/
qreal devicePixelRatio = qGuiApp->devicePixelRatio();
QQuickWindow::TextRenderType defaultTextRenderType = int(devicePixelRatio) == devicePixelRatio ?
QQuickWindow::NativeTextRendering : QQuickWindow::QtTextRendering;
QQuickWindow::TextRenderType defaultTextRenderType =
int(devicePixelRatio) == devicePixelRatio ? QQuickWindow::NativeTextRendering : QQuickWindow::QtTextRendering;
// Allow setting the text rendering type with an environment variable
QByteArrayList validInputs = {"qttextrendering", "qtrendering", "nativetextrendering", "nativerendering"};
......@@ -134,7 +135,7 @@ public:
Colors ret = {{}, KColorScheme(selectionGroup, KColorScheme::ColorSet::Selection), KColorScheme(group, set)};
QPalette pal;
for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) {
for (auto state : {QPalette::Active, QPalette::Inactive, QPalette::Disabled}) {
pal.setBrush(state, QPalette::WindowText, ret.scheme.foreground());
pal.setBrush(state, QPalette::Window, ret.scheme.background());
pal.setBrush(state, QPalette::Base, ret.scheme.background());
......@@ -150,16 +151,18 @@ public:
pal.setColor(state, QPalette::Midlight, ret.scheme.shade(KColorScheme::MidlightShade));
pal.setColor(state, QPalette::Mid, ret.scheme.shade(KColorScheme::MidShade));
pal.setColor(state, QPalette::Dark, ret.scheme.shade(KColorScheme::DarkShade));
pal.setColor(state, QPalette::Shadow, QColor(0,0,0,51 /* 20% */));//ret.scheme.shade(KColorScheme::ShadowShade));
pal.setColor(state, QPalette::Shadow, QColor(0, 0, 0, 51 /* 20% */)); // ret.scheme.shade(KColorScheme::ShadowShade));
pal.setBrush(state, QPalette::AlternateBase, ret.scheme.background(KColorScheme::AlternateBackground));
pal.setBrush(state, QPalette::Link, ret.scheme.foreground(KColorScheme::LinkText));
pal.setBrush(state, QPalette::LinkVisited, ret.scheme.foreground(KColorScheme::VisitedText));
pal.setBrush(state, QPalette::PlaceholderText, ret.scheme.foreground(KColorScheme::InactiveText));
pal.setBrush(state, QPalette::BrightText, KColorUtils::hcyColor(
KColorUtils::hue(pal.buttonText().color()),KColorUtils::chroma(pal.buttonText().color()), 1 - KColorUtils::luma(pal.buttonText().color())
));
pal.setBrush(state,
QPalette::BrightText,
KColorUtils::hcyColor(KColorUtils::hue(pal.buttonText().color()),
KColorUtils::chroma(pal.buttonText().color()),
1 - KColorUtils::luma(pal.buttonText().color())));
}
ret.palette = pal;
m_cache.insert(key, ret);
......@@ -192,7 +195,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QScopedPointer<StyleSingleton>, s_style, (new StyleSin
PlasmaDesktopTheme::PlasmaDesktopTheme(QObject *parent)
: PlatformTheme(parent)
{
//TODO: MOVE THIS SOMEWHERE ELSE
// TODO: MOVE THIS SOMEWHERE ELSE
m_lowPowerHardware = QByteArrayList{"1", "true"}.contains(qgetenv("KIRIGAMI_LOWPOWER_HARDWARE").toLower());
setSupportsIconColoring(true);
......@@ -218,8 +221,7 @@ PlasmaDesktopTheme::~PlasmaDesktopTheme()
void PlasmaDesktopTheme::syncWindow()
{
if (m_window) {
disconnect(m_window.data(), &QWindow::activeChanged,
this, &PlasmaDesktopTheme::syncColors);
disconnect(m_window.data(), &QWindow::activeChanged, this, &PlasmaDesktopTheme::syncColors);
}
QWindow *window = nullptr;
......@@ -233,15 +235,13 @@ void PlasmaDesktopTheme::syncWindow()
window = qw;
}
if (qw) {
connect(qw, &QQuickWindow::sceneGraphInitialized,
this, &PlasmaDesktopTheme::syncWindow);
connect(qw, &QQuickWindow::sceneGraphInitialized, this, &PlasmaDesktopTheme::syncWindow);
}
}
m_window = window;
if (window) {
connect(m_window.data(), &QWindow::activeChanged,
this, &PlasmaDesktopTheme::syncColors);
connect(m_window.data(), &QWindow::activeChanged, this, &PlasmaDesktopTheme::syncColors);
syncColors();
}
}
......@@ -249,13 +249,13 @@ void PlasmaDesktopTheme::syncWindow()
void PlasmaDesktopTheme::syncFont()
{
KSharedConfigPtr ptr = KSharedConfig::openConfig();
KConfigGroup general( ptr->group("general") );
KConfigGroup general(ptr->group("general"));
setSmallFont(general.readEntry("smallestReadableFont", []() {
auto smallFont = qApp->font();
if (smallFont.pixelSize() != -1) {
smallFont.setPixelSize(smallFont.pixelSize()-2);
smallFont.setPixelSize(smallFont.pixelSize() - 2);
} else {
smallFont.setPointSize(smallFont.pointSize()-2);
smallFont.setPointSize(smallFont.pointSize() - 2);
}
return smallFont;
}()));
......@@ -267,7 +267,7 @@ QIcon PlasmaDesktopTheme::iconFromTheme(const QString &name, const QColor &custo
{
QPalette pal = palette();
if (customColor != Qt::transparent) {
for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) {
for (auto state : {QPalette::Active, QPalette::Inactive, QPalette::Disabled}) {
pal.setBrush(state, QPalette::WindowText, customColor);
}
}
......@@ -280,14 +280,14 @@ QIcon PlasmaDesktopTheme::iconFromTheme(const QString &name, const QColor &custo
void PlasmaDesktopTheme::syncColors()
{
QPalette::ColorGroup group = (QPalette::ColorGroup)colorGroup();
auto parentItem = qobject_cast<QQuickItem*>(parent());
auto parentItem = qobject_cast<QQuickItem *>(parent());
if (parentItem) {
if (!parentItem->isEnabled()) {
group = QPalette::Disabled;
//Why also checking the window is exposed?
//in the case of QQuickWidget the window() will never be active
//and the widgets will always have the inactive palette.
// better to always show it active than always show it inactive
// Why also checking the window is exposed?
// in the case of QQuickWidget the window() will never be active
// and the widgets will always have the inactive palette.
// better to always show it active than always show it inactive
} else if (m_window && !m_window->isActive() && m_window->isExposed()) {
group = QPalette::Inactive;
}
......@@ -295,7 +295,7 @@ void PlasmaDesktopTheme::syncColors()
const auto colors = (*s_style)->loadColors(colorSet(), group);
//foreground
// foreground
setTextColor(colors.scheme.foreground(KColorScheme::NormalText).color());
setDisabledTextColor(colors.scheme.foreground(KColorScheme::InactiveText).color());
setHighlightedTextColor(colors.selectionScheme.foreground(KColorScheme::NormalText).color());
......@@ -306,7 +306,7 @@ void PlasmaDesktopTheme::syncColors()
setNeutralTextColor(colors.scheme.foreground(KColorScheme::NeutralText).color());
setPositiveTextColor(colors.scheme.foreground(KColorScheme::PositiveText).color());
//background
// background
setHighlightColor(colors.selectionScheme.background(KColorScheme::NormalBackground).color());
setBackgroundColor(colors.scheme.background(KColorScheme::NormalBackground).color());
......@@ -328,7 +328,7 @@ void PlasmaDesktopTheme::syncColors()
setNeutralBackgroundColor(colors.scheme.background(KColorScheme::NeutralBackground).color());
setPositiveBackgroundColor(colors.scheme.background(KColorScheme::PositiveBackground).color());
//decoration
// decoration
setHoverColor(colors.scheme.decoration(KColorScheme::HoverColor).color());
setFocusColor(colors.scheme.decoration(KColorScheme::FocusColor).color());
......@@ -336,29 +336,29 @@ void PlasmaDesktopTheme::syncColors()
const QColor &buttonTextColor = (*s_style)->buttonScheme.foreground(KColorScheme::NormalText).color();
const QColor &buttonBackgroundColor = (*s_style)->buttonScheme.background(KColorScheme::NormalBackground).color();
auto separatorColor = [](const QColor &bg, const QColor &fg, const qreal baseRatio = 0.2) {
return KColorUtils::luma(bg) > 0.5 ? KColorUtils::mix(bg, fg, baseRatio) : KColorUtils::mix(bg, fg, baseRatio/2);
return KColorUtils::luma(bg) > 0.5 ? KColorUtils::mix(bg, fg, baseRatio) : KColorUtils::mix(bg, fg, baseRatio / 2);
};
m_buttonSeparatorColor = separatorColor(buttonBackgroundColor, buttonTextColor, 0.3);
switch (colorSet()) {
// case ColorSet::View:
// case ColorSet::Window:
// case ColorSet::View:
// case ColorSet::Window:
case ColorSet::Button:
m_separatorColor = m_buttonSeparatorColor;
break;
case ColorSet::Selection:
m_separatorColor = focusColor();
break;
// case ColorSet::Tooltip:
// case ColorSet::Complementary:
// case ColorSet::Header:
// case ColorSet::Tooltip:
// case ColorSet::Complementary:
// case ColorSet::Header:
default:
m_separatorColor = separatorColor(backgroundColor(), textColor());
}
}
bool PlasmaDesktopTheme::event(QEvent* event)
bool PlasmaDesktopTheme::event(QEvent *event)
{
if (event->type() == Kirigami::PlatformThemeEvents::DataChangedEvent::type) {
syncFont();
......@@ -376,7 +376,6 @@ bool PlasmaDesktopTheme::event(QEvent* event)
return PlatformTheme::event(event);
}
// Breeze QQC2 style colors
QColor PlasmaDesktopTheme::separatorColor() const
{
......
......@@ -9,11 +9,11 @@
#define KIRIGAMIPLASMATHEME_H
#include <Kirigami2/PlatformTheme>
#include <QObject>
#include <QQuickItem>
#include <QColor>
#include <QPointer>
#include <QIcon>
#include <QObject>
#include <QPointer>
#include <QQuickItem>
class PlasmaDesktopTheme;
class KIconLoader;
......
......@@ -8,8 +8,8 @@
#include <QGuiApplication>
#include <unordered_map>
#include <cmath>
#include <unordered_map>
bool IconLabelLayoutPrivate::createIconItem()
{
......@@ -17,7 +17,7 @@ bool IconLabelLayoutPrivate::createIconItem()
if (iconItem)
return false;
iconItem = qobject_cast<QQuickItem*>(iconComponent->create());
iconItem = qobject_cast<QQuickItem *>(iconComponent->create());
iconItem->setParentItem(q);
iconItem->setObjectName(QStringLiteral("iconItem"));
iconItem->setProperty("source", icon.nameOrSource());
......@@ -77,7 +77,7 @@ bool IconLabelLayoutPrivate::createLabelItem()
if (labelItem)
return false;
labelItem = qobject_cast<QQuickItem*>(labelComponent->create());
labelItem = qobject_cast<QQuickItem *>(labelComponent->create());
labelItem->setParentItem(q);
labelItem->setObjectName(QStringLiteral("labelItem"));
labelItem->setProperty("text", text);
......@@ -141,10 +141,10 @@ void IconLabelLayoutPrivate::updateImplicitSize()
const qreal labelImplicitWidth = showLabel ? std::ceil(labelItem->implicitWidth()) : 0;
const qreal labelImplicitHeight = showLabel ? std::ceil(labelItem->implicitHeight()) : 0;
const qreal effectiveSpacing = showLabel && showIcon && iconItem->implicitWidth() > 0 ? spacing : 0;
contentWidth = display == IconLabelLayout::TextBesideIcon ?
iconImplicitWidth + labelImplicitWidth + effectiveSpacing : qMax(iconImplicitWidth, labelImplicitWidth);
contentHeight = display == IconLabelLayout::TextUnderIcon ?
iconImplicitHeight + labelImplicitHeight + effectiveSpacing : qMax(iconImplicitHeight, labelImplicitHeight);
contentWidth =
display == IconLabelLayout::TextBesideIcon ? iconImplicitWidth + labelImplicitWidth + effectiveSpacing : qMax(iconImplicitWidth, labelImplicitWidth);
contentHeight =
display == IconLabelLayout::TextUnderIcon ? iconImplicitHeight + labelImplicitHeight + effectiveSpacing : qMax(iconImplicitHeight, labelImplicitHeight);
q->setImplicitSize(contentWidth + leftPadding + rightPadding, contentHeight + topPadding + bottomPadding);
q->setAvailableWidth();
q->setAvailableHeight();
......@@ -183,19 +183,19 @@ void IconLabelLayoutPrivate::layout()
case IconLabelLayout::IconOnly:
if (iconItem) {
// Icons should always be pixel aligned, so convert to QRect
q->setIconRect(alignedRect(mirrored, alignment,
QSizeF(qMin(iconItem->implicitWidth(), q->availableWidth()),
qMin(iconItem->implicitHeight(), q->availableHeight())),
QRectF(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight())));
q->setIconRect(alignedRect(mirrored,
alignment,
QSizeF(qMin(iconItem->implicitWidth(), q->availableWidth()), qMin(iconItem->implicitHeight(), q->availableHeight())),
QRectF(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight())));
iconItem->setSize(iconRect.size());
iconItem->setPosition(iconRect.topLeft()); // Not animating icon positions because it tends to look wrong
}
break;
case IconLabelLayout::TextOnly:
if (labelItem) {
q->setLabelRect(alignedRect(mirrored, alignment,
QSizeF(qMin(labelItem->implicitWidth(), q->availableWidth()),
qMin(labelItem->implicitHeight(), q->availableHeight())),
q->setLabelRect(alignedRect(mirrored,
alignment,
QSizeF(qMin(labelItem->implicitWidth(), q->availableWidth()), qMin(labelItem->implicitHeight(), q->availableHeight())),
QRectF(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight())));
labelItem->setSize(labelRect.size());
labelItem->setPosition(labelRect.topLeft()); // Not animating when text only because the text tends to clip outside
......@@ -218,9 +218,9 @@ void IconLabelLayoutPrivate::layout()
textSize.setHeight(qMin(labelItem->implicitHeight(), q->availableHeight() - iconSize.height() - effectiveSpacing));
}
QRectF combinedRect = alignedRect(mirrored, alignment,
QSizeF(qMax(iconSize.width(), textSize.width()),
iconSize.height() + effectiveSpacing + textSize.height()),
QRectF combinedRect = alignedRect(mirrored,
alignment,
QSizeF(qMax(iconSize.width(), textSize.width()), iconSize.height() + effectiveSpacing + textSize.height()),
QRectF(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight()));
q->setIconRect(alignedRect(mirrored, Qt::AlignHCenter | Qt::AlignTop, iconSize, combinedRect));
q->setLabelRect(alignedRect(mirrored, Qt::AlignHCenter | Qt::AlignBottom, textSize, combinedRect));
......@@ -232,11 +232,11 @@ void IconLabelLayoutPrivate::layout()
labelItem->setSize(labelRect.size());
labelItem->setPosition(labelRect.topLeft());
// NOTE: experimental animations when changing display types
// labelItem->setOpacity(0); // Reset opacity before OpacityAnimator is activated
// labelItem->setY(iconRect.y() + iconRect.height());
// labelItem->setProperty("opacity", 1); // Activate OpacityAnimator
// labelItem->setX(labelRect.x()); // Not animating X so that the text will only slide vertically
// labelItem->setProperty("y", labelRect.y());
// labelItem->setOpacity(0); // Reset opacity before OpacityAnimator is activated
// labelItem->setY(iconRect.y() + iconRect.height());
// labelItem->setProperty("opacity", 1); // Activate OpacityAnimator
// labelItem->setX(labelRect.x()); // Not animating X so that the text will only slide vertically
// labelItem->setProperty("y", labelRect.y());
}
break;
}
......@@ -258,9 +258,9 @@ void IconLabelLayoutPrivate::layout()
textSize.setHeight(qMin(labelItem->implicitHeight(), q->availableHeight()));
}
const QRectF combinedRect = alignedRect(mirrored, alignment,
QSizeF(iconSize.width() + effectiveSpacing + textSize.width(),
qMax(iconSize.height(), textSize.height())),
const QRectF combinedRect = alignedRect(mirrored,
alignment,
QSizeF(iconSize.width() + effectiveSpacing + textSize.width(), qMax(iconSize.height(), textSize.height())),
QRectF(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight()));
q->setIconRect(alignedRect(mirrored, Qt::AlignLeft | Qt::AlignVCenter, iconSize, combinedRect));
q->setLabelRect(alignedRect(mirrored, Qt::AlignRight | Qt::AlignVCenter, textSize, combinedRect));
......@@ -272,11 +272,11 @@ void IconLabelLayoutPrivate::layout()
labelItem->setSize(labelRect.size());
labelItem->setPosition(labelRect.topLeft());
// NOTE: experimental animations when changing display types
// labelItem->setOpacity(0); // Reset opacity before OpacityAnimator is activated
// labelItem->setX(iconRect.x() + (mirrored ? -labelRect.width() : iconRect.width()));
// labelItem->setProperty("opacity", 1); // Activate OpacityAnimator
// labelItem->setProperty("x", labelRect.x());
// labelItem->setY(labelRect.y()); // Not animating Y so that the text will only slide horizontally
// labelItem->setOpacity(0); // Reset opacity before OpacityAnimator is activated
// labelItem->setX(iconRect.x() + (mirrored ? -labelRect.width() : iconRect.width()));
// labelItem->setProperty("opacity", 1); // Activate OpacityAnimator
// labelItem->setProperty("x", labelRect.x());
// labelItem->setY(labelRect.y()); // Not animating Y so that the text will only slide horizontally
}
break;
}
......@@ -291,8 +291,8 @@ void IconLabelLayoutPrivate::layout()
labelItem->setProperty("firstLayoutCompleted", true);
}
}
// qDebug() << q << "d->layout()" << layoutCount;
// layoutCount += 1;
// qDebug() << q << "d->layout()" << layoutCount;
// layoutCount += 1;
}
IconLabelLayout::IconLabelLayout(QQuickItem *parent)
......@@ -659,7 +659,6 @@ void IconLabelLayout::setAlignment(Qt::Alignment alignment)
if (d->labelItem) {
d->labelItem->setProperty("horizontalAlignment", halign);
d->labelItem->setProperty("verticalAlignment", valign);
}
emit alignmentChanged();
if (isComponentComplete()) {
......@@ -741,7 +740,7 @@ void IconLabelLayout::componentComplete()
relayout();
}
void IconLabelLayout::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
void IconLabelLayout::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
if (newGeometry != oldGeometry) {
setAvailableWidth();
......
......@@ -7,24 +7,24 @@
#define ICONLABELLAYOUT_H
#include "qquickicon_p.h"
#include <memory>
#include <QQuickItem>
#include <memory>
class IconLabelLayoutPrivate;
/**
* An item that is meant to show, hide and position an icon item and a label item based on an AbstractButton's display property.
*
*
* You can also set the alignment of the icon and label as a group.
*
*
* For example, this aligns the icon and label to the left side and vertical center of this item.
*
*
* ```qml
* alignment: Qt.AlignLeft | Qt.AlignVCenter
* ```
*
*
* The result will look like this if there is enough availableWidth and the display type is TextUnderIcon:
*
*
* ```
* +-----------------+
* | |
......@@ -33,9 +33,9 @@ class IconLabelLayoutPrivate;
* | |
* +-----------------+
* ```
*
*
* The default alignment is Qt.AlignCenter and the default display type is TextBesideIcon, which looks like this:
*
*
* ```
* +-----------------+
* | |
......@@ -43,10 +43,10 @@ class IconLabelLayoutPrivate;
* | |
* +-----------------+
* ```
*
*
* You cannot separate the icon and label from each other.
* They will always move together in the orientation specified by the display property.
*
*
* @note: This class was adapted from QtQuick.Control.impl IconLabel
*/
class IconLabelLayout : public QQuickItem
......
......@@ -14,7 +14,10 @@ class IconLabelLayoutPrivate : public QObject
Q_DISABLE_COPY(IconLabelLayoutPrivate)
public:
IconLabelLayoutPrivate(IconLabelLayout *qq) : q_ptr(qq) {}
IconLabelLayoutPrivate(IconLabelLayout *qq)
: q_ptr(qq)
{
}
bool createIconItem();
bool destroyIconItem();
......@@ -31,7 +34,7 @@ public:
void updateImplicitSize();
void layout();
IconLabelLayout * const q_ptr;
IconLabelLayout *const q_ptr;
QPointer<QQmlComponent> iconComponent;
QPointer<QQmlComponent> labelComponent;
......@@ -60,8 +63,8 @@ public:
Qt::Alignment alignment = Qt::AlignCenter;
IconLabelLayout::Display display = IconLabelLayout::TextBesideIcon;
QRectF iconRect = QRectF(0,0,0,0);
QRectF labelRect = QRectF(0,0,0,0);
QRectF iconRect = QRectF(0, 0, 0, 0);
QRectF labelRect = QRectF(0, 0, 0, 0);
qreal contentWidth = 0.0;
qreal contentHeight = 0.0;
......
......@@ -5,26 +5,27 @@
#include "kcolorutilssingleton.h"
#include <KColorUtils>
KColorUtilsSingleton::KColorUtilsSingleton(QObject* parent) : QObject(parent)
KColorUtilsSingleton::KColorUtilsSingleton(QObject *parent)
: QObject(parent)
{
}
qreal KColorUtilsSingleton::hue(const QColor& color)
qreal KColorUtilsSingleton::hue(const QColor &color)
{
return KColorUtils::hue(color);
}
qreal KColorUtilsSingleton::chroma(const QColor& color)
qreal KColorUtilsSingleton::chroma(const QColor &color)
{
return KColorUtils::chroma(color);
}
qreal KColorUtilsSingleton::luma(const QColor& color)
qreal KColorUtilsSingleton::luma(const QColor &color)
{
return KColorUtils::luma(color);
}
qreal KColorUtilsSingleton::contrastRatio(const QColor& color1, const QColor& color2)
qreal KColorUtilsSingleton::contrastRatio(const QColor &color1, const QColor &color2)
{
return KColorUtils::contrastRatio(color1, color2);
}
......@@ -34,27 +35,27 @@ QColor KColorUtilsSingleton::hcyColor(qreal hue, qreal chroma, qreal luma, qreal
return KColorUtils::hcyColor(hue, chroma, luma, alpha);
}
QColor KColorUtilsSingleton::lighten(const QColor& color, qreal amount, qreal chromaInverseGain)
QColor KColorUtilsSingleton::lighten(const QColor &color, qreal amount, qreal chromaInverseGain)
{
return KColorUtils::lighten(color, amount, chromaInverseGain);
}
QColor KColorUtilsSingleton::darken(const QColor& color, qreal amount, qreal chromaGain)
QColor KColorUtilsSingleton::darken(const QColor &color, qreal amount, qreal chromaGain)
{
return KColorUtils::darken(color, amount, chromaGain);
}
QColor KColorUtilsSingleton::shade(const QColor& color, qreal lumaAmount, qreal chromaAmount)
QColor KColorUtilsSingleton::shade(const QColor &color, qreal lumaAmount, qreal chromaAmount)
{
return KColorUtils::shade(color, lumaAmount, chromaAmount);
}
QColor KColorUtilsSingleton::tint(const QColor& base, const QColor& color, qreal amount)
QColor KColorUtilsSingleton::tint(const QColor &base, const QColor &color, qreal amount)
{
return KColorUtils::tint(base, color, amount);
}
QColor KColorUtilsSingleton::mix(const QColor& color1, const QColor& color2, qreal bias)
QColor KColorUtilsSingleton::mix(const QColor &color1, const QColor &color2, qreal bias)
{
return KColorUtils::mix(color1, color2, bias);
}