Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make port value changes trigger modelindex updates #25

Open
mortbopet opened this issue Mar 15, 2019 · 3 comments
Open

Make port value changes trigger modelindex updates #25

mortbopet opened this issue Mar 15, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@mortbopet
Copy link
Owner

mortbopet commented Mar 15, 2019

Currently, the entire Netlist/Register model is updated when the circuit is clocked - this is not scaleable.

model::data() should fetch values directly from their connected ports instead of this data being set during model initialization. Furthermore, a port emitting its updated signal should be connected to the specific treeItem (and QModelIndex) to update that specific index. This should allow us to completely remove the updateNetlistData() methods.

End goal is to remove the NetlistModelBase::invalidate() calls made in Netlist::reloadNetist()

@mortbopet mortbopet added the enhancement New feature or request label Mar 15, 2019
@mortbopet
Copy link
Owner Author

TreeItems shall connect to the Port value changed signal.
Given the stored QModelIndex within a treeItem, a call may be made:
QModelIndex::model()
to retreive the parent model. Then, QAbstractItemModel::dataChanged(index, index, {Qt::DisplayRole}) shall be emitted from the model, prompting the view to update the given index.

@mortbopet
Copy link
Owner Author

Initial investigation shows that QAbstractItemModel::dataChanged shows a significant overhead when it is called multiple times each clock cycle (given that multiple ports have changed), so for now, reloading the visible parts of the model each clock cycle seems to be the most efficient.

@mortbopet
Copy link
Owner Author

The core issue is that within Qt, data should be fully contained in a model, and any modifications to this data should be conducted through the model.
However, in this case, the model hooks into the vsrtl::Design, wherein each time a design is changed, values within the model will be changed implicitly from the clocking action.

So currently, the way to notify this is to tell the view to update all currently visible QModelIndex'es, which will then fetch the updated values from the model. This might be the most "effective" way to hacking around the fact that model data is externally modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant