23class QStyleOptionViewItem;
87 const QList<QPalette::ColorRole>& roles = { QPalette::ColorRole::Text, QPalette::ColorRole::WindowText });
119 QByteArray infosData;
120 QDataStream ostr { &infosData, QIODevice::WriteOnly };
123 mimeData->setData (name, infosData);
130 constexpr QColor
operator"" _rgb (
const char *str, std::size_t size)
133 throw std::runtime_error {
"invalid color size" };
135 constexpr auto digit = [] (
char digit)
137 if (digit >=
'0' && digit <=
'9')
139 if (digit >=
'a' && digit <=
'f')
140 return digit -
'a' + 0xa;
141 if (digit >=
'A' && digit <=
'F')
142 return digit -
'A' + 0xa;
144 throw std::runtime_error {
"unable to parse" };
147 constexpr auto group = [digit] (
const char *str)
149 return digit (str [0]) * 16 + digit (str [1]);
152 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.
QString ElideProgressBarText(const QString &text, const QStyleOptionViewItem &option)
QPixmap DrawOverlayText(QPixmap px, const QString &text, QFont font, const QPen &pen, const QBrush &brush)
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)