-
Notifications
You must be signed in to change notification settings - Fork 33
Add support for accessing ListView/TreeView itemDelegate #15
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
Conversation
7663a23
to
d181cfe
Compare
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.
In general an interesting change, however without any delegate to instantiate I am wondering a bit what the use case is that you have in mind
src/declarativetreeviewextension_p.h
Outdated
|
||
public: | ||
explicit DeclarativeTreeViewExtension(QObject *parent = 0); | ||
explicit DeclarativeTreeViewExtension(QObject *parent = Q_NULLPTR); |
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.
In general a valid change, but not related to support for delegates.
Such a cleanup should be in a separate commit and probably across classes.
src/declarativewidgets_plugin.cpp
Outdated
#include <QToolBar> | ||
#include <QToolButton> | ||
#include <QTreeView> | ||
#include <QAbstractItemDelegate> |
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.
I think includes are usually in alphabetical order
// uncreatable core | ||
qmlRegisterType<QAbstractItemModel>(); | ||
qmlRegisterType<QItemSelectionModel>(); | ||
qmlRegisterType<QAbstractItemDelegate>(); |
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.
QAbstractItemDelegate can not be constructed in C++, since it is abstract.
So this would need to be registered with qmlRegisterUncreatableType()
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.
I beg to differ. It's using the qmlRegisterType overload without parameters, only to make the type known to QML.
Same thing can be seen 2 lines above for QAbstractItemModel.
Should this really be handled with qmlRegisterUncreatableType?
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.
Hmm, good point.
I guess we should change that to uncreatable type registration, in a future clean up commit, and for the other uncreatables as well
My use case for this is simply instantiating a custom delegate in QML and assigning it to a ListView/TreeView as delegate. |
A cool. We should probably add an example like that :-) |
* Add support for accessing ListView/TreeView itemDelegate
This commit adds support for getting/setting itemDelegate for ListView and TreeView