6 #ifndef SWIFT_GUI_MODELS_LISTMODELDBOBJECTS_H
7 #define SWIFT_GUI_MODELS_LISTMODELDBOBJECTS_H
23 template <
typename T,
typename K,
bool UseCompare = false>
59 virtual QVariant
data(
const QModelIndex &
index,
int role)
const override;
72 QList<KeyType> m_highlightKeys;
73 QColor m_highlightColor = Qt::green;
77 template <
typename T,
typename K,
bool UseCompare = false>
95 using COrderableListModelDbObjects::CListModelDbObjects::update;
const ContainerType & container() const
Used container data.
void sort()
Sort by given sort order.
T ContainerType
Container type.
typename T::value_type ObjectType
Container element type.
virtual void clearHighlighting()
Remove all highlighting.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const final
QModelIndex parent(const QModelIndex &child) const final
List model for DB objects.
CListModelDbObjects(const QString &translationContext, QObject *parent=nullptr)
Constructor.
virtual void clearHighlighting()
Remove all highlighting.
KeyType dbKeyForIndex(const QModelIndex &index) const
DB key for given index.
virtual bool hasHighlightedRows() const
Has highlighted rows?
void setHighlightColor(QColor color)
Set color for highlighting.
bool isHighlightedIndex(const QModelIndex &index) const
Highlight index.
typename T::value_type ObjectType
Container element type.
void setHighlightedDbKeys(const QList< KeyType > &keys)
Keys to be highlighted.
void clearHighlightedDbKeys()
Clear the highlighted keys.
virtual QVariant data(const QModelIndex &index, int role) const
Get data for index and role.
T ContainerType
Container type.
virtual ~CListModelDbObjects()
Destructor.
List model for DB objects.
T ContainerType
Container type.
virtual ~COrderableListModelDbObjects()
Destructor.
bool setSortColumnToOrder()
Sort order to order property swift::misc::IOrderable::IndexOrder.
virtual int update(const ContainerType &container, bool sort)
Update by new container.
COrderableListModelDbObjects(const QString &translationContext, QObject *parent=nullptr)
Constructor.
virtual void moveItems(const ContainerType &items, int position)
Move items to position, normally called from dropMimeData.
Models to be used with views, mainly QTableView.