Merge pull request #134 from MultiMC/feature_groupview
Fix another GroupView bug
This commit is contained in:
commit
737169d1d3
@ -45,6 +45,12 @@ GroupView::~GroupView()
|
||||
m_groups.clear();
|
||||
}
|
||||
|
||||
void GroupView::setModel(QAbstractItemModel *model)
|
||||
{
|
||||
QAbstractItemView::setModel(model);
|
||||
connect(model, &QAbstractItemModel::modelReset, this, &GroupView::modelReset);
|
||||
}
|
||||
|
||||
void GroupView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
|
||||
const QVector<int> &roles)
|
||||
{
|
||||
@ -133,6 +139,12 @@ void GroupView::updateGeometries()
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void GroupView::modelReset()
|
||||
{
|
||||
scheduleDelayedItemsLayout();
|
||||
executeDelayedItemsLayout();
|
||||
}
|
||||
|
||||
bool GroupView::isIndexHidden(const QModelIndex &index) const
|
||||
{
|
||||
Group *cat = category(index);
|
||||
|
@ -24,6 +24,8 @@ public:
|
||||
GroupView(QWidget *parent = 0);
|
||||
~GroupView();
|
||||
|
||||
void setModel(QAbstractItemModel *model) override;
|
||||
|
||||
/// return geometry rectangle occupied by the specified model item
|
||||
QRect geometryRect(const QModelIndex &index) const;
|
||||
/// return visual rectangle occupied by the specified model item
|
||||
@ -69,6 +71,7 @@ slots:
|
||||
virtual void rowsInserted(const QModelIndex &parent, int start, int end) override;
|
||||
virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
|
||||
virtual void updateGeometries() override;
|
||||
void modelReset();
|
||||
|
||||
protected:
|
||||
virtual bool isIndexHidden(const QModelIndex &index) const override;
|
||||
|
Loading…
Reference in New Issue
Block a user