33 if (section < 0 || section >=
m_columns.size())
40 return {
m_columns.at(section).getColumnName() };
44 return {
m_columns.at(section).getColumnToolTip() };
63 return m_columns.columnToPropertyIndex(column);
68 return m_columns.propertyIndexToColumn(propertyIndex);
79 this->
sort(column, order);
84 const int column =
m_columns.propertyIndexToColumn(propertyIndex);
104 return changedColumn || changedOrder;
128 if (!
index.isValid())
139 f = formatter->
flags(f, editable);
156 static const QStringList mimes({
"application/swift.container.json" });
177 SWIFT_VERIFY_X(startRowIndex <= endRowIndex, Q_FUNC_INFO,
"check rows");
178 SWIFT_VERIFY_X(startRowIndex >= 0 && endRowIndex >= 0, Q_FUNC_INFO,
"check rows");
186 startRowIndex = std::max(startRowIndex, 0);
187 if (endRowIndex >= rows)
189 endRowIndex = rows - 1;
Qt::DropActions m_dropActions
drop actions
Qt::DropActions supportedDragActions() const final
QStringList mimeTypes() const final
virtual bool hasHighlightedRows() const
Has highlighted rows?
Qt::ItemFlags flags(const QModelIndex &index) const final
virtual void clearHighlighting()
Remove all highlighting.
virtual void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)=0
Feedback when QStandardItemModel::dataChanged was called.
virtual bool setSorting(const swift::misc::CPropertyIndex &propertyIndex, Qt::SortOrder order=Qt::AscendingOrder)
Sorting.
virtual bool setSortColumnByPropertyIndex(const swift::misc::CPropertyIndex &propertyIndex)
Set column for sorting.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const final
QModelIndex parent(const QModelIndex &child) const final
virtual swift::misc::CPropertyIndex columnToPropertyIndex(int column) const
Column to property index.
void markDestroyed()
Mark as about to be destroyed, normally marked from view.
CListModelBaseNonTemplate(const QString &translationContext, QObject *parent=nullptr)
Constructor.
QVariant headerData(int section, Qt::Orientation orientation, int role) const final
int m_sortColumn
currently sorted column
void setNoSorting()
Disable sorting.
bool isModelDestroyed()
Model about to be destroyed?
Qt::DropActions supportedDropActions() const final
swift::misc::CPropertyIndex getSortProperty() const
Sorted by property.
CColumns m_columns
columns metadata
virtual bool isOrderable() const =0
Orderable, normally use a container swift::misc::IOrderableList.
void sortByPropertyIndex(const swift::misc::CPropertyIndex &propertyIndex, Qt::SortOrder order=Qt::AscendingOrder)
Sort by index.
void emitDataChanged(int startRowIndex, int endRowIndex)
Send signal that data have been changed.
virtual swift::misc::CPropertyIndex modelIndexToPropertyIndex(const QModelIndex &index) const
Index to property index.
Qt::SortOrder m_sortOrder
sort order (asc/desc)
virtual int propertyIndexToColumn(const swift::misc::CPropertyIndex &propertyIndex) const
Property index to column number.
virtual bool hasValidSortColumn() const
Has valid sort column?
int columnCount(const QModelIndex &modelIndex=QModelIndex()) const final
bool isEmpty() const
Empty?
static const CPropertyIndex & empty()
an empty property index
Models to be used with views, mainly QTableView.
Free functions in swift::misc.
QModelIndex createIndex(int row, int column, const void *ptr) const const
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
void setObjectName(QAnyStringView name)
QStandardItemModel(QObject *parent)
virtual Qt::ItemFlags flags(const QModelIndex &index) const const override
virtual int rowCount(const QModelIndex &parent) const const override
virtual void sort(int column, Qt::SortOrder order) override
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.