23class QStyleOptionViewItem;
24class QAbstractItemView;
104 const QList<QPalette::ColorRole>& roles = { QPalette::ColorRole::Text, QPalette::ColorRole::WindowText });
135 const QString& one,
const QString& few,
const QString& many);
154 QByteArray infosData;
155 QDataStream ostr { &infosData, QIODevice::WriteOnly };
158 mimeData->setData (name, infosData);
164 consteval QColor
operator""_rgb (
const char *str, std::size_t size)
167 throw std::runtime_error {
"invalid color size" };
169 constexpr auto digit = [] (
char digit)
171 if (digit >=
'0' && digit <=
'9')
173 if (digit >=
'a' && digit <=
'f')
174 return digit -
'a' + 0xa;
175 if (digit >=
'A' && digit <=
'F')
176 return digit -
'A' + 0xa;
178 throw std::runtime_error {
"unable to parse" };
181 constexpr auto group = [digit] (
const char *str)
183 return digit (str [0]) * 16 + digit (str [1]);
186 return QColor { group (str + 1), group (str + 3), group (str + 5) };
QLabel * ShowPixmapLabel(const QPixmap &srcPx, const QPoint ¢erPos)
Shows a pixmap at the given pos.
QColor TintColors(const QColor &c1, const QColor &c2, double alpha)
Mixes two colors with the given weights.
void TintPalette(QWidget *widget, const QColor &color, double alpha, const QList< QPalette::ColorRole > &roles)
Mixes some of the widget's palette roles with the given color.
void SetCurrentRow(QAbstractItemView &view, const QModelIndex &index)
Makes the given row current and the only selected one.
QString ElideProgressBarText(const QString &text, const QStyleOptionViewItem &option)
QPixmap DrawOverlayText(QPixmap px, const QString &text, QFont font, const QPen &pen, const QBrush &brush)
QString FormatHumanReadableList(QStringList items)
Joins items for use in a sentence.
QString MakeFileDialogFilter(std::initializer_list< FileDialogFilterEntry > entries)
QIcon FixupTrayIcon(const QIcon &icon)
QString FormatName(const QString &name)
HTML-formats the name to let the user know it is not a part of the fixed dialog text.
void Save2MimeData(QMimeData *mimeData, const QString &name, const T &t)