-
Notifications
You must be signed in to change notification settings - Fork 50
Add ChainModel #40
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
Add ChainModel #40
Conversation
ab19cae
to
2d53bd2
Compare
|
||
void ChainModel::fetchMore(const QModelIndex& parent) | ||
{ | ||
auto& chain = Engine::chain(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add qDebug() << Q_FUNC_INFO;
while testing (scrolling the list) to see how lazy loading works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanofsky using interfaces::Chain
here.
2d53bd2
to
3766f18
Compare
src/qml/pages/stub.qml
Outdated
|
||
ListView { | ||
anchors.fill: parent | ||
model: ChainModel { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanofsky this is a dumb example, but the idea is to access block details.
|
||
void ChainModel::fetchMore(const QModelIndex& parent) | ||
{ | ||
auto& chain = Engine::chain(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanofsky using interfaces::Chain
here.
Follow Qt recomendation (1) since the background is a solid color. 1. https://doc.qt.io/qt-5/qml-qtquick-controls2-applicationwindow.html#background-prop
Label implicit height depends on the font size but the font size depends on the label height. This results in a runtime anchor loop warning.
3766f18
to
cb28239
Compare
Concept ACK, we're going to need to expose more than just the nodemodel to qml. One big backend object would be quite a mess. All that's needed is good documentation of what is exposed to qml and why. |
Based on #38. This PR adds and uses the
ChainModel
. This model exposes chain data, like block heights and hashes. Can be used as a source for list views and repeaters. The model uses a lazy load approach, ie, data is fetched frominterfaces::Chain
as needed.