mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
Formatting, icon utility function, icon size
This commit is contained in:
committed by
Mathew Sutcliffe
parent
371ee82f1b
commit
6a96d14baa
@@ -58,3 +58,11 @@ bool BlackMisc::pngHexStringToPixmapRef(const QString &hexString, QPixmap &pixma
|
||||
QByteArray ba(byteArrayFromHexString(hexString));
|
||||
return pngByteArrayToPixmapRef(ba, pixmap);
|
||||
}
|
||||
|
||||
QPixmap BlackMisc::iconToPixmap(const QIcon &icon)
|
||||
{
|
||||
if (icon.isNull()) { return QPixmap(); }
|
||||
const QList<QSize> sizes = icon.availableSizes();
|
||||
if (!sizes.isEmpty()) { return icon.pixmap(sizes.first()); }
|
||||
return icon.pixmap(16, 16);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
|
||||
//! Free functions in BlackMisc
|
||||
namespace BlackMisc
|
||||
@@ -39,6 +40,8 @@ namespace BlackMisc
|
||||
//! Hex encoded pixmap string to Pixmap
|
||||
BLACKMISC_EXPORT bool pngHexStringToPixmapRef(const QString &hexString, QPixmap &pixmap);
|
||||
|
||||
//! Icon to pixmap
|
||||
BLACKMISC_EXPORT QPixmap iconToPixmap(const QIcon &icon);
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user