#pragma once #include "FractoriumPch.h" /// /// PaletteTableWidgetItem class. /// /// /// A thin derivation of QTableWidgetItem which keeps a pointer to a palette object. /// The lifetime of the palette object must be greater than or equal to /// the lifetime of this object. /// class PaletteTableWidgetItemBase : public QTableWidgetItem { public: PaletteTableWidgetItemBase() { } virtual size_t Index() const { return 0; } }; template class PaletteTableWidgetItem : public PaletteTableWidgetItemBase { public: PaletteTableWidgetItem(Palette* palette) : m_Palette(palette) { } virtual size_t Index() const override { return m_Palette->m_Index; } Palette* GetPalette() const { return m_Palette; } private: Palette* m_Palette; };