swift
|
Distributor list model. More...
Public Types | |
enum | DistributorMode { NotSet , Normal , NormalWithOrder , Minimal , MinimalWithOrder } |
What kind of stations. | |
![]() | |
using | ContainerType = swift::misc::simulation::CDistributorList |
Container type. | |
using | ObjectType = typename T::value_type |
Container element type. | |
using | KeyType = QString |
DB key type. | |
![]() | |
using | ContainerType = T |
Container type. | |
using | ObjectType = typename T::value_type |
Container element type. | |
using | KeyType = K |
DB key type. | |
![]() | |
using | ContainerType = T |
Container type. | |
using | ObjectType = typename T::value_type |
Container element type. | |
Public Member Functions | |
CDistributorListModel (QObject *parent=nullptr) | |
Constructor. | |
virtual | ~CDistributorListModel () |
Destructor. | |
void | setDistributorMode (DistributorMode distributorMode) |
Set mode. | |
DistributorMode | getDistributorMode () const |
Mode. | |
virtual bool | isOrderable () const |
Orderable, normally use a container swift::misc::IOrderableList. More... | |
![]() | |
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. More... | |
virtual void | moveItems (const ContainerType &items, int position) |
Move items to position, normally called from dropMimeData. More... | |
![]() | |
virtual | ~CListModelDbObjects () |
Destructor. | |
void | setHighlightedDbKeys (const QList< KeyType > &keys) |
Keys to be highlighted. | |
void | clearHighlightedDbKeys () |
Clear the highlighted keys. | |
virtual void | clearHighlighting () |
Remove all highlighting. More... | |
virtual bool | hasHighlightedRows () const |
Has highlighted rows? More... | |
void | setHighlightColor (QColor color) |
Set color for highlighting. | |
virtual QVariant | data (const QModelIndex &index, int role) const |
Get data for index and role. | |
KeyType | dbKeyForIndex (const QModelIndex &index) const |
DB key for given index. | |
bool | isHighlightedIndex (const QModelIndex &index) const |
Highlight index. | |
![]() | |
~CListModelBase ()=default | |
Destructor. | |
void | sort () |
Sort by given sort order. More... | |
virtual bool | isValidIndex (const QModelIndex &index) const |
Valid index (in range) | |
const ContainerType & | container () const |
Used container data. | |
const ContainerType & | containerFiltered () const |
Used container data. | |
const ContainerType & | containerOrFilteredContainer (bool *filtered=nullptr) const |
Full container or cached filtered container as approproiate. | |
bool | setInContainer (const QModelIndex &index, const ObjectType &obj) |
Simple set of data in container, using class is responsible for firing signals etc. More... | |
virtual void | update (const QModelIndex &index, const ObjectType &object) |
Update single element. | |
virtual void | update (int rowIndex, const ObjectType &object) |
Update single element. | |
virtual swift::misc::CWorker * | updateAsync (const ContainerType &container, bool sort=true) |
Asynchronous update. | |
virtual void | updateContainerMaybeAsync (const ContainerType &container, bool sort=true) |
Update by new container. | |
virtual const ObjectType & | at (const QModelIndex &index) const |
Object at row position. | |
void | resort () |
Sort by given sort order. More... | |
void | truncate (int maxNumber, bool forceSort=false) |
Truncate to given number. | |
ContainerType | sortContainerByColumn (const ContainerType &container, int column, Qt::SortOrder order) const |
Sort container by given column / order. This is used by sort() but als for asynchronous updates in the views. More... | |
virtual void | push_back (const ObjectType &object) |
Similar to ContainerType::push_back. | |
virtual void | push_back (const ContainerType &container) |
Similar to ContainerType::push_back. | |
virtual void | insert (const ObjectType &object) |
Similar to ContainerType::insert here inserts at first position. | |
virtual void | insert (const ContainerType &container) |
Similar to ContainerType::insert here inserts at first position. | |
virtual void | remove (const ObjectType &object) |
Remove object. | |
int | removeIf (K0 k0, V0 v0, KeysValues... keysValues) |
Remove elements matching some particular key/value pair(s). More... | |
virtual void | clear () |
Clear the list. | |
virtual bool | isEmpty () const |
Empty? | |
bool | hasFilter () const |
Filter available. | |
void | removeFilter () |
Remove filter. | |
void | takeFilterOwnership (std::unique_ptr< IModelFilter< ContainerType >> &filter) |
Set the filter. | |
void | setSelectionModel (swift::gui::models::ISelectionModel< ContainerType > *selectionModel) |
Set the selection model. | |
QVariant | data (const QModelIndex &index, int role) const |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) final |
QMimeData * | mimeData (const QModelIndexList &indexes) const final |
void | sort (int column, Qt::SortOrder order) final |
int | rowCount (const QModelIndex &parentIndex=QModelIndex()) const final |
bool | canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const final |
bool | dropMimeData (const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent) final |
QJsonObject | toJson (bool selectedOnly=false) const |
Convert to JSON. More... | |
QString | toJsonString (QJsonDocument::JsonFormat format=QJsonDocument::Indented, bool selectedOnly=false) const |
Convert to JSON string. More... | |
bool | isOrderable () const |
Orderable, normally use a container swift::misc::IOrderableList. More... | |
![]() | |
~CListModelBaseNonTemplate ()=default | |
Destructor. | |
virtual swift::misc::CPropertyIndex | columnToPropertyIndex (int column) const |
Column to property index. | |
virtual int | propertyIndexToColumn (const swift::misc::CPropertyIndex &propertyIndex) const |
Property index to column number. | |
virtual swift::misc::CPropertyIndex | modelIndexToPropertyIndex (const QModelIndex &index) const |
Index to property index. | |
virtual void | setSortColumn (int column) |
Set sort column. | |
void | setNoSorting () |
Disable sorting. | |
void | sortByPropertyIndex (const swift::misc::CPropertyIndex &propertyIndex, Qt::SortOrder order=Qt::AscendingOrder) |
Sort by index. | |
virtual bool | setSortColumnByPropertyIndex (const swift::misc::CPropertyIndex &propertyIndex) |
Set column for sorting. More... | |
virtual bool | setSorting (const swift::misc::CPropertyIndex &propertyIndex, Qt::SortOrder order=Qt::AscendingOrder) |
Sorting. | |
virtual int | getSortColumn () const |
Get sort column property index. | |
swift::misc::CPropertyIndex | getSortProperty () const |
Sorted by property. | |
virtual bool | hasValidSortColumn () const |
Has valid sort column? | |
virtual Qt::SortOrder | getSortOrder () const |
Get sort order. | |
void | markDestroyed () |
Mark as about to be destroyed, normally marked from view. | |
bool | isModelDestroyed () |
Model about to be destroyed? | |
void | setDropActions (Qt::DropActions dropActions) |
Drop actions. | |
void | emitDataChanged (int startRowIndex, int endRowIndex) |
Send signal that data have been changed. More... | |
const CColumns & | getColumns () const |
The columns. | |
bool | endsWithEmptyColumn () const |
Using void column at the end? | |
int | columnCount (const QModelIndex &modelIndex=QModelIndex()) const final |
QVariant | headerData (int section, Qt::Orientation orientation, int role) const final |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const final |
QModelIndex | parent (const QModelIndex &child) const final |
Qt::ItemFlags | flags (const QModelIndex &index) const final |
Qt::DropActions | supportedDragActions () const final |
Qt::DropActions | supportedDropActions () const final |
QStringList | mimeTypes () const final |
![]() | |
virtual | ~CDropBase () |
Dtor. | |
void | setAcceptedMetaTypeIds (const QList< int > &ids) |
Accepted ids. | |
void | addAcceptedMetaTypeId (int id) |
Accepted ids. | |
virtual bool | isDropAllowed () const |
Drop allowed? | |
virtual bool | isJsonFileDropAllowed () const |
File drop allowed? | |
virtual void | allowDrop (bool allowed) |
Drop allowed. | |
virtual void | allowJsonFileDrop (bool allow) |
Allow JSON file drop. | |
bool | acceptDrop (const QMimeData *mime) const |
Accept drop? | |
swift::misc::CVariant | toCVariant (const QMimeData *mime) const |
Mime data to CVariant (normally encapsulating a value object) | |
Additional Inherited Members | |
![]() | |
void | asyncUpdateFinished () |
Asynchronous update finished. | |
void | modelDataChanged (int count, bool withFilter) |
Data changed. More... | |
void | modelDataChangedDigest (int count, bool withFilter) |
Data changed, digest version. | |
void | changed () |
Model has been changed Triggered with each change, for performance consider using changedDigest. | |
void | changedDigest () |
Model has been changed, digest signal. | |
void | objectChanged (const swift::misc::CVariant &object, const swift::misc::CPropertyIndex &changedIndex) |
Template free information, that object changed. | |
![]() | |
static constexpr int | asyncThreshold = 50 |
Number of elements when to use asynchronous updates. | |
![]() | |
COrderableListModelDbObjects (const QString &translationContext, QObject *parent=nullptr) | |
Constructor. | |
![]() | |
CListModelDbObjects (const QString &translationContext, QObject *parent=nullptr) | |
Constructor. | |
![]() | |
CListModelBase (const QString &translationContext, QObject *parent=nullptr) | |
Constructor. | |
void | updateFilteredContainer () |
Update filtered container. | |
void | emitModelDataChanged () |
Model changed. | |
void | onDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomLeft, const QVector< int > &roles) |
Feedback when QStandardItemModel::dataChanged was called. More... | |
void | onChangedDigest () |
Feedback when QStandardItemModel::dataChanged was called. More... | |
![]() | |
CListModelBaseNonTemplate (const QString &translationContext, QObject *parent=nullptr) | |
Constructor. More... | |
![]() | |
CDropBase () | |
Ctor. | |
![]() | |
ContainerType | m_container |
used container | |
ContainerType | m_containerFiltered |
cache for filtered container data | |
std::unique_ptr< IModelFilter< ContainerType > > | m_filter |
used filter | |
ISelectionModel< ContainerType > * | m_selectionModel |
selection model | |
![]() | |
CColumns | m_columns |
columns metadata | |
int | m_sortColumn |
currently sorted column | |
bool | m_modelDestroyed = false |
Qt::SortOrder | m_sortOrder |
sort order (asc/desc) | |
Qt::DropActions | m_dropActions = Qt::IgnoreAction |
drop actions | |
swift::misc::CPropertyIndexList | m_sortTieBreakers |
how column values are sorted if equal, if no value is given this is random | |
Distributor list model.
Definition at line 22 of file distributorlistmodel.h.
|
inlinevirtual |
Orderable, normally use a container swift::misc::IOrderableList.
Implements swift::gui::models::CListModelBaseNonTemplate.
Definition at line 51 of file distributorlistmodel.h.