Verified Commit f89d33d2 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Tweak formatting after clang-format run

parent 1d5fb9b5
......@@ -69,8 +69,9 @@ public:
* 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"};
......@@ -284,11 +285,11 @@ void PlasmaDesktopTheme::syncColors()
if (parentItem) {
if (!parentItem->isEnabled()) {
group = QPalette::Disabled;
} else if (m_window && !m_window->isActive() && m_window->isExposed()) {
// 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;
}
}
......@@ -342,17 +343,17 @@ void PlasmaDesktopTheme::syncColors()
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());
}
......
......@@ -141,10 +141,12 @@ 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,20 +185,18 @@ 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())));
QSizeF size(qMin(iconItem->implicitWidth(), q->availableWidth()), qMin(iconItem->implicitHeight(), q->availableHeight()));
QRectF rect(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight());
q->setIconRect(alignedRect(mirrored, alignment, size, rect));
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())),
QRectF(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight())));
QSizeF size(qMin(labelItem->implicitWidth(), q->availableWidth()), qMin(labelItem->implicitHeight(), q->availableHeight()));
QRectF rect(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight());
q->setLabelRect(alignedRect(mirrored, alignment, size, rect));
labelItem->setSize(labelRect.size());
labelItem->setPosition(labelRect.topLeft()); // Not animating when text only because the text tends to clip outside
}
......@@ -218,10 +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(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight()));
QSizeF size(qMax(iconSize.width(), textSize.width()), iconSize.height() + effectiveSpacing + textSize.height());
QRectF rect(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight());
QRectF combinedRect = alignedRect(mirrored, alignment, size, rect);
q->setIconRect(alignedRect(mirrored, Qt::AlignHCenter | Qt::AlignTop, iconSize, combinedRect));
q->setLabelRect(alignedRect(mirrored, Qt::AlignHCenter | Qt::AlignBottom, textSize, combinedRect));
if (iconItem) {
......@@ -232,11 +231,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,10 +257,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())),
QRectF(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight()));
QSizeF size(iconSize.width() + effectiveSpacing + textSize.width(), qMax(iconSize.height(), textSize.height()));
QRectF rect(mirrored ? rightPadding : leftPadding, topPadding, q->availableWidth(), q->availableHeight());
const QRectF combinedRect = alignedRect(mirrored, alignment, size, rect);
q->setIconRect(alignedRect(mirrored, Qt::AlignLeft | Qt::AlignVCenter, iconSize, combinedRect));
q->setLabelRect(alignedRect(mirrored, Qt::AlignRight | Qt::AlignVCenter, textSize, combinedRect));
if (iconItem) {
......@@ -272,11 +270,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 +289,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)
......
......@@ -27,12 +27,14 @@ public:
qreal remainder = 0.0;
// Normalized points. The range is 0 to 1 and the coordinates are scaled to fit the size of the drawing area.
// clang-format off
QVector<QVector<QPointF>> shapePoints = {
{QPointF(0.0, 0.5), QPointF(1.0 / 3.0, 5.0 / 6.0), QPointF(1.0, 1.0 / 6.0)}, // Checkmark
{QPointF(1.0 / 1.5, 0.0), QPointF(0.25, 0.5), QPointF(1.0 / 1.5, 1.0)}, // LeftArrow
{QPointF(1.0 / 3.0, 0.0), QPointF(0.75, 0.5), QPointF(1.0 / 3.0, 1.0)}, // RightArrow
{QPointF(0.0, 1.0 / 1.5), QPointF(0.5, 0.25), QPointF(1.0, 1.0 / 1.5)}, // UpArrow
{QPointF(0.0, 1.0 / 3.0), QPointF(0.5, 0.75), QPointF(1.0, 1.0 / 3.0)}, // DownArrow
{QPointF(0.0, 0.5), QPointF(1.0/3.0, 5.0/6.0), QPointF(1.0, 1.0/6.0)}, // Checkmark
{QPointF(1.0/1.5, 0.0), QPointF(0.25, 0.5), QPointF(1.0/1.5, 1.0)}, // LeftArrow
{QPointF(1.0/3.0, 0.0), QPointF(0.75, 0.5), QPointF(1.0/3.0, 1.0)}, // RightArrow
{QPointF(0.0, 1.0/1.5), QPointF(0.5, 0.25), QPointF(1.0, 1.0/1.5)}, // UpArrow
{QPointF(0.0, 1.0/3.0), QPointF(0.5, 0.75), QPointF(1.0, 1.0/3.0)}, // DownArrow
};
// clang-format on
};
#endif
......@@ -52,8 +52,12 @@ QQuickIcon &QQuickIcon::operator=(const QQuickIcon &other)
bool QQuickIcon::operator==(const QQuickIcon &other) const
{
return d == other.d
|| (d->name == other.d->name && d->source == other.d->source && d->width == other.d->width && d->height == other.d->height && d->color == other.d->color
return d == other.d //
|| (d->name == other.d->name //
&& d->source == other.d->source //
&& d->width == other.d->width //
&& d->height == other.d->height //
&& d->color == other.d->color //
&& d->cache == other.d->cache);
}
......
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