Skip to content

Commit

Permalink
Make StandardItemModel::forEachItem() const
Browse files Browse the repository at this point in the history
  • Loading branch information
oblivioncth committed Dec 1, 2024
1 parent 62f9e48 commit b399b6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/widgets/include/qx/widgets/qx-standarditemmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ class QX_WIDGETS_EXPORT StandardItemModel : public QStandardItemModel

//-Constructor-------------------------------------------------------------------------------------------------------
public:
StandardItemModel(int rows, int columns, QObject *parent = nullptr);
StandardItemModel(QObject *parent = nullptr);
StandardItemModel(int rows, int columns, QObject* parent = nullptr);
StandardItemModel(QObject* parent = nullptr);

//-Instance Functions-----------------------------------------------------------------------------------------------
private:
void autoTristateChildren(QStandardItem* changingItem, const QVariant& value, int role);
void autoTristateParents(QStandardItem* changingItem, const QVariant& changingValue);
void autoTristateChildren(QStandardItem* changingItem, const QVariant& value, int role);
void autoTristateParents(QStandardItem* changingItem, const QVariant& changingValue);

public:
virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
bool isAutoTristate();
void setAutoTristate(bool autoTristate);
void forEachItem(std::function<void(QStandardItem*)> const& func, QModelIndex parent = QModelIndex());
void forEachItem(const std::function<void(QStandardItem*)>& func, QModelIndex parent = QModelIndex()) const;

void selectAll();
void selectNone();
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/src/qx-standarditemmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void StandardItemModel::setAutoTristate(bool autoTristate) { mAutoTristate = aut
* @param parent A model index pointing to the item for processing to start at. A null index causes
* processing to start at the root item of the model, thereby calling the routine on all items.
*/
void StandardItemModel::forEachItem(const std::function<void (QStandardItem*)>& func, QModelIndex parent)
void StandardItemModel::forEachItem(const std::function<void (QStandardItem*)>& func, QModelIndex parent) const
{
for(int r = 0; r < rowCount(parent); ++r)
{
Expand Down

0 comments on commit b399b6a

Please sign in to comment.