-
Notifications
You must be signed in to change notification settings - Fork 11
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 VisibleItemModel #1845
base: main
Are you sure you want to change the base?
Add VisibleItemModel #1845
Conversation
2792465
to
3bc5d92
Compare
} | ||
} | ||
*/ | ||
class VisibleItemModel : public QQmlInstanceModel |
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.
Just checking - what's the general policy of using private APIs? e.g. when we bump from Qt 6.6.3 > Qt 6.8 what source compatibility are we relying on?
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.
Generally we want to use the more established kind of private APIs, so that the instability is kept to a minimum, and only using them where absolutely necessary.
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.
Is there a reason why we can't use a public qt base model? eg. QAbstractItemModel
This allows items with preferredVisible=false to be filtered out from the model for a ListView. Otherwise, the view creates unused delegates, which are redundant and also will be problematic when key navigation is added as the user should not navigate through non-visible items. Part of #1732
VisibleItemModel automatically filters out non-visible items so that they are not part of any view that uses the model. This means that: - views won't need to create unnecessary delegates - when key navigation is added, it won't try to focus non-visible delegates VisibleItemModel does not currently support dynamic insertion/removal so it cannot be used in cases like SwipePageModel or NotificationLayer. Part of #1732
3bc5d92
to
88d7521
Compare
Q_OBJECT | ||
Q_DECLARE_PRIVATE(VisibleItemModel) | ||
|
||
Q_PROPERTY(QQmlListProperty<QObject> sourceModel READ sourceModel NOTIFY sourceModelChanged DESIGNABLE false FINAL) |
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.
Does 'design mode' work for you? As long as I can remember, the 'design mode' button has been greyed out for me
} | ||
} | ||
*/ | ||
class VisibleItemModel : public QQmlInstanceModel |
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.
Is there a reason why we can't use a public qt base model? eg. QAbstractItemModel
No description provided.