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

module "SortFilterProxyModel" is not installed #36

Closed
karahman1993 opened this issue Apr 13, 2017 · 3 comments
Closed

module "SortFilterProxyModel" is not installed #36

karahman1993 opened this issue Apr 13, 2017 · 3 comments

Comments

@karahman1993
Copy link

I already download the deposit, and i added include(SortFilterProxyModel/SortFilterProxyModel.pri) in my .pro, but When I put "import SortFilterProxyModel 0.2"

i have this error: qrc:/main.qml:04 module "SortFilterProxyModel" is not installed

so please i need help

@kubark42
Copy link
Contributor

kubark42 commented Aug 1, 2017

This error indicates that you haven't registered the QML type with the engine. In your c++ file (main.cpp?), you will need to add the following line:

qmlRegisterType<qqsfpm::QQmlSortFilterProxyModel>("SortFilterProxyModel", 0, 2, "SortFilterProxyModel");

to somewhere before you load your main QML file. Typically you should be able to add it all the way at the top, just after the int main(int argc, char *argv[]).

Makes sense?

P.S. The README.md leaves out this step, but it's common across all QML plugins. If you find a good link which describes this generically, maybe report it here and the project maintainers can integrate it into the README.md?

@oKcerG
Copy link
Owner

oKcerG commented Aug 2, 2017

Just including the SortFilterProxyModel.pri should be enough. The registering of the type should be taken care of automatically by

void registerQQmlSortFilterProxyModelTypes() {
qmlRegisterType<QQmlSortFilterProxyModel>("SortFilterProxyModel", 0, 2, "SortFilterProxyModel");
}
Q_COREAPP_STARTUP_FUNCTION(registerQQmlSortFilterProxyModelTypes)

@karahman1993 Can you provide an minimal reproducible example of your problem ? Preferably in a Gist with 3 files ( a .pro, main.cpp and main.qml)

@kubark42
Copy link
Contributor

kubark42 commented Aug 2, 2017

@oKcerG, how right you are. I think this might be related to #40. I figured out the registration back before I realized that qpm didn't yield latest results. I just pulled out the qmlRegisterType line and this time, with SortFilterProxyModel 0.2.0 from git, everything worked on its own. Cool stuff!

@oKcerG oKcerG closed this as completed Nov 21, 2017
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

No branches or pull requests

3 participants