Skip to content

Commit

Permalink
Fix instance hash name.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBColton committed May 4, 2020
1 parent a824c40 commit 874eaa1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Widgets/RoomView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RoomView::RoomView(AssetScrollAreaBackground* parent) : AssetView(parent), _mode
void RoomView::SetResourceModel(MessageModel* model) {
this->_model = model;

instanceHash.clear();
_instanceHash.clear();

if (model != nullptr) {
this->_sortedInstances->setSourceModel(model->GetSubModel<RepeatedMessageModel*>(Room::kInstancesFieldNumber));
Expand All @@ -41,19 +41,19 @@ void RoomView::SetResourceModel(MessageModel* model) {
this->_sortedTiles->sort(Room::Tile::kDepthFieldNumber);

for (int row = 0; row < _sortedInstances->rowCount(); row++) {
instanceHash.addRectangle(InstanceProxy(_sortedInstances, row));
_instanceHash.addRectangle(InstanceProxy(_sortedInstances, row));
}
connect(_sortedInstances, &QAbstractItemModel::modelReset, [&]() {
instanceHash.clear();
_instanceHash.clear();
});
connect(_sortedInstances, &QAbstractItemModel::rowsInserted, [&](const QModelIndex &/*parent*/, int first, int last) {
for (int row = first; row <= last; row++) {
instanceHash.addRectangle(InstanceProxy(_sortedInstances, row));
_instanceHash.addRectangle(InstanceProxy(_sortedInstances, row));
}
});
connect(_sortedInstances, &QAbstractItemModel::rowsAboutToBeRemoved, [&](const QModelIndex &/*parent*/, int first, int last) {
for (int row = first; row <= last; row++) {
instanceHash.removeProxy(InstanceProxy(_sortedInstances, row));
_instanceHash.removeProxy(InstanceProxy(_sortedInstances, row));
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion Widgets/RoomView.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class RoomView : public AssetView {
InstanceSortFilterProxyModel *_sortedInstances;
QSortFilterProxyModel *_sortedTiles;
QPixmap _transparentPixmap;
SpatialHash<InstanceProxy> instanceHash;
SpatialHash<InstanceProxy> _instanceHash;

void paintTiles(QPainter &painter);
void paintBackgrounds(QPainter &painter, bool foregrounds = false);
Expand Down

0 comments on commit 874eaa1

Please sign in to comment.