8#include "helperqttypes.h"
9#include <QtCore/qsharedpointer.h>
12#include <qcontainerfwd.h>
13#include <qcoreapplication.h>
18#include <qmetaobject.h>
22#include <qstringliteral.h>
44void drawQWidgetStyleSheetAware(
QWidget *widget);
48std::optional<ColorSchemeType> guessColorSchemeTypeFromWidget(
QWidget *widget);
61template<
typename First,
typename... T>
62bool isIn(First &&first, T &&...t)
65 return ((first == t) || ...);
68[[nodiscard]] qreal standardWheelStepCount(
QWheelEvent *event);
70[[nodiscard]]
QImage transparencyBackground(qreal devicePixelRatioF);
94 Array2D(QListSizeType iCount, QListSizeType jCount)
104 const auto elementCount = m_iCount * m_jCount;
106 for (QListSizeType i = 0; i < elementCount; ++i) {
117 Array2D(QListSizeType iCount, QListSizeType jCount,
QList<T> init)
127 const auto elementCount = m_iCount * m_jCount;
129 for (QListSizeType i = 0; i < elementCount; ++i) {
130 if (i <
init.count()) {
142 Array2D &operator=(
const Array2D &other) =
default;
148 Array2D &operator=(Array2D &&other) =
default;
151 Array2D(
const Array2D &other) =
default;
154 Array2D(Array2D &&other) =
default;
161 bool operator==(
const Array2D &other)
const
164 (m_data == other.m_data)
165 && (m_iCount == other.m_iCount)
166 && (m_jCount == other.m_jCount)
175 bool operator!=(
const Array2D &other)
const
177 return !(*
this == other);
185 void setValue(QListSizeType i, QListSizeType j,
const T &value)
187 if (isInRange<QListSizeType>(0, i, m_iCount - 1)
188 && isInRange<QListSizeType>(0, j, m_jCount - 1)
190 m_data[i + m_iCount * j] = value;
200 T value(QListSizeType i, QListSizeType j)
const
202 if (isInRange<QListSizeType>(0, i, m_iCount - 1)
203 && isInRange<QListSizeType>(0, j, m_jCount - 1)
205 return m_data[i + m_iCount * j];
213 QListSizeType iCount()
const
221 QListSizeType jCount()
const
230 QListSizeType m_iCount;
232 QListSizeType m_jCount;
265template<
typename T =
void>
266void delayedEventProcessing(
unsigned long msecWaitInitially = 50,
unsigned long msecWaitBetweenEventLoopPasses = 50,
int numberEventLoopPasses = 3)
270 msecWaitInitially = qMax<unsigned long>(
273 msecWaitBetweenEventLoopPasses =
274 qMax<unsigned long>(msecWaitBetweenEventLoopPasses, 15);
278 for (
int i = 0; i < numberEventLoopPasses; ++i) {
289[[nodiscard]] QPair<QString, QString> getPrefixSuffix(
const QString &formatString);
307 return QStringLiteral(
"%1::%2").arg(scope, name);
333 const auto value =
static_cast<int>(enumerator);
342 if (!myMeta.valueToKey(value)) {
349 return QStringLiteral(
"%1::%2::%3(%4)").arg(scope, name, keys).arg(value);
375 const auto value =
static_cast<int>(enumerator);
384 if (!myMeta.valueToKey(value)) {
389 return QStringLiteral(
"%1(%2)").arg(keys).arg(value);
void init(KXmlGuiWindow *window, KGameDifficulty *difficulty=nullptr)
The namespace of this library.
QString enumerationToFullString()
The full-qualified C++ identifier as QString.
Array2D< QColor > Swatches
Swatches organized in a grid.
QString enumeratorToString(const T &enumerator)
The C++ identifier as QString.
QString enumeratorToFullString(const T &enumerator)
The full-qualified C++ identifier as QString.
ColorSchemeType
Represents the appearance of a theme.
Swatches wcsBasicColors(const QSharedPointer< PerceptualColor::RgbColorSpace > &colorSpace)
Swatch grid derived from the basic colors as by WCS (World color survey).
void processEvents(QEventLoop::ProcessEventsFlags flags)
void append(QList< T > &&value)
void reserve(qsizetype size)
QString fromUtf8(QByteArrayView str)
void msleep(unsigned long msecs)