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

Models #215

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Models #215

wants to merge 1 commit into from

Conversation

pontaoski
Copy link

@pontaoski pontaoski commented Aug 3, 2020

This PR implements the minimum recommended APIs necessary to implement read-only models in C# that can interop with QML, handling 90% of usecases for models.

Depends on qmlnet/qmlnet-native#1.

@pontaoski pontaoski marked this pull request as ready for review August 16, 2020 03:24
@pontaoski pontaoski changed the title WIP Models Models Aug 16, 2020
@pontaoski
Copy link
Author

Ping?

@pauldotknopf
Copy link
Member

Oh, sorry, I didn't realize this was ready for review. I will try to get to it this week, this weekend at the latest.

@pauldotknopf
Copy link
Member

It's not required on your part, but if you have time, I'd like to see some unit tests that both test and demonstrate what you've done.

By the way, good work!

@pauldotknopf
Copy link
Member

It looks like the native code is failing a build on Windows.

@pauldotknopf
Copy link
Member

NetAbstractItemModelRoleNames.cpp
..\QmlNet\QmlNet\qml\NetAbstractItemModelRoleNames.cpp(3): error C7555: use of designated initializers requires at least '/std:c++latest'
..\QmlNet\QmlNet\qml\NetQModelIndex.cpp(7): error C7555: use of designated initializers requires at least '/std:c++latest'
..\QmlNet\QmlNet\qml\NetQModelIndex.cpp(12): error C7555: use of designated initializers requires at least '/std:c++latest'
NetAbstractItemModel.cpp
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(87): warning C4100: 'idx': unreferenced formal parameter
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(94): warning C4100: 'idx': unreferenced formal parameter
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(7): error C7555: use of designated initializers requires at least '/std:c++latest'
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(43): warning C4190: 'net_abstract_item_model_get_flags' has C-linkage specified, but returns UDT 'std::function<int (ModelIdx)>' which is incompatible with C
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(13): note: see declaration of 'std::function<int (ModelIdx)>'
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(44): warning C4190: 'net_abstract_item_model_get_data' has C-linkage specified, but returns UDT 'std::function<Variant (ModelIdx,int)>' which is incompatible with C
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(16): note: see declaration of 'std::function<Variant (ModelIdx,int)>'
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(45): warning C4190: 'net_abstract_item_model_get_header_data' has C-linkage specified, but returns UDT 'std::function<Variant (int,int,int)>' which is incompatible with C
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(19): note: see declaration of 'std::function<Variant (int,int,int)>'
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(46): warning C4190: 'net_abstract_item_model_get_row_count' has C-linkage specified, but returns UDT 'std::function<int (ModelIdx)>' which is incompatible with C
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(13): note: see declaration of 'std::function<int (ModelIdx)>'
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(47): warning C4190: 'net_abstract_item_model_get_column_count' has C-linkage specified, but returns UDT 'std::function<int (ModelIdx)>' which is incompatible with C
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(13): note: see declaration of 'std::function<int (ModelIdx)>'
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(48): warning C4190: 'net_abstract_item_model_get_index' has C-linkage specified, but returns UDT 'std::function<ModelIdx (int,int,ModelIdx)>' which is incompatible with C
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(28): note: see declaration of 'std::function<ModelIdx (int,int,ModelIdx)>'
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(49): warning C4190: 'net_abstract_item_model_get_parent' has C-linkage specified, but returns UDT 'std::function<ModelIdx (ModelIdx)>' which is incompatible with C
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(31): note: see declaration of 'std::function<ModelIdx (ModelIdx)>'
..\QmlNet\QmlNet\qml\NetAbstractItemModel.cpp(50): warning C4190: 'net_abstract_item_model_get_role_names' has C-linkage specified, but returns UDT 'std::function<NetHashTypeContainer *(void)>' which is incompatible with C
C:\projects\qmlnet\src\native\QmlNet\QmlNet\qml\NetAbstractItemModel.h(34): note: see declaration of 'std::function<NetHashTypeContainer *(void)>'
Generating Code...
jom: C:\projects\qmlnet\src\native\build\Makefile.Release [release\NetQModelIndex.obj] Error 2
jom: C:\projects\qmlnet\src\native\build\Makefile.Release [release\NetAbstractItemModelRoleNames.obj] Error 2
jom: C:\projects\qmlnet\src\native\build\Makefile [release-install] Error 2

@pontaoski
Copy link
Author

qmlnet/qmlnet-native#2.

@pauldotknopf
Copy link
Member

Merged.

@pontaoski
Copy link
Author

looks like this builds now

@vadi2
Copy link
Contributor

vadi2 commented Feb 26, 2021

How does this change the API of working with models?

@pontaoski
Copy link
Author

How does this change the API of working with models?

This exposes the usual slew of Qt model classes, which allows them to be used from C#. I would recommend reading Qt docs: https://doc.qt.io/qt-5/model-view-programming.html

@vadi2
Copy link
Contributor

vadi2 commented Mar 6, 2021

I've been using those for a decade so I'm pretty familiar, but there is no documentation here - add examples how it would look?

@pontaoski pontaoski force-pushed the work/cblack/qmodels branch 2 times, most recently from 585f8d9 to 841ad96 Compare October 7, 2021 08:24
@pontaoski
Copy link
Author

I've been using those for a decade so I'm pretty familiar, but there is no documentation here - add examples how it would look?

doc comments added

@vadi2
Copy link
Contributor

vadi2 commented Oct 7, 2021

thank you

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

Successfully merging this pull request may close these issues.

None yet

3 participants