mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Issue #77 Methods to convert icons to QVariant
Needed so propertyindex methods don't need to depend on CVariant.
This commit is contained in:
@@ -96,4 +96,14 @@ namespace BlackMisc
|
|||||||
Q_ASSERT_X(index >= 0 && index < CIconList::allIcons().size(), "iconForIndex", "wrong index");
|
Q_ASSERT_X(index >= 0 && index < CIconList::allIcons().size(), "iconForIndex", "wrong index");
|
||||||
return CIconList::allIcons()[index];
|
return CIconList::allIcons()[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CIcons methods defined here to circumvent cyclic dependency
|
||||||
|
QVariant CIcons::toVariant(IconIndex icon)
|
||||||
|
{
|
||||||
|
return QVariant::fromValue(CIcon(icon));
|
||||||
|
}
|
||||||
|
QVariant CIcons::toVariantPixmap(IconIndex icon)
|
||||||
|
{
|
||||||
|
return QVariant::fromValue(CIcon(icon).toPixmap());
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -805,6 +805,17 @@ namespace BlackMisc
|
|||||||
//! Rotate by pixmap
|
//! Rotate by pixmap
|
||||||
static QPixmap rotate(int rotateDegrees, const QPixmap &original);
|
static QPixmap rotate(int rotateDegrees, const QPixmap &original);
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// Convert enum to QVariant containing CIcon or QPixmap
|
||||||
|
// (function definitions in icon.cpp)
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
|
//! Variant containing CIcon
|
||||||
|
static QVariant toVariant(IconIndex icon);
|
||||||
|
|
||||||
|
//! Variant containing QPixmap
|
||||||
|
static QVariant toVariantPixmap(IconIndex icon);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! File cache for the loaded files
|
//! File cache for the loaded files
|
||||||
static QMap<QString, QPixmap> &getResourceFileCache();
|
static QMap<QString, QPixmap> &getResourceFileCache();
|
||||||
|
|||||||
Reference in New Issue
Block a user