mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Issue #77 toIcon returns a simple enum instead of a full object
This commit is contained in:
@@ -31,10 +31,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! As icon, not implemented by all classes
|
||||
CIcon toIcon() const { return CIcon::iconByIndex(IconIndex); }
|
||||
|
||||
//! As pixmap, required for most GUI views
|
||||
QPixmap toPixmap() const { return derived()->toIcon().toPixmap(); }
|
||||
CIcons::IconIndex toIcon() const { return IconIndex; }
|
||||
|
||||
private:
|
||||
const Derived *derived() const { return static_cast<const Derived *>(this); }
|
||||
@@ -46,8 +43,7 @@ namespace BlackMisc
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_ICON(DERIVED) \
|
||||
using ::BlackMisc::Mixin::Icon<DERIVED>::toIcon; \
|
||||
using ::BlackMisc::Mixin::Icon<DERIVED>::toPixmap;
|
||||
using ::BlackMisc::Mixin::Icon<DERIVED>::toIcon;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -155,8 +155,8 @@ namespace BlackMisc
|
||||
const auto i = index.frontCasted<ColumnIndex>(); // keep that "auto", otherwise I won's compile
|
||||
switch (i)
|
||||
{
|
||||
case IndexIcon: return CVariant::from(derived()->toIcon());
|
||||
case IndexPixmap: return CVariant::from(derived()->toPixmap());
|
||||
case IndexIcon: return CVariant::from(CIcon(derived()->toIcon()));
|
||||
case IndexPixmap: return CVariant::from(CIcon(derived()->toIcon()).toPixmap());
|
||||
case IndexString: return CVariant(derived()->toQString());
|
||||
default: return basePropertyByIndex(static_cast<const TIndexBaseOfT<Derived> *>(derived()), index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user