lemirep / simple_qml_list_model_example Goto Github PK
View Code? Open in Web Editor NEWSimple Qt Qml example demonstrating the use of a C++ model from Qml
Simple Qt Qml example demonstrating the use of a C++ model from Qml
the crash breakpoint is at ListModel.cpp:Models::
ListModel::data(const QModelIndex &index, int role) const
{
return this->items.at(index.row())->data(role);
}
this->items.at(index.row()) will crash sometimes.
I copy your code into my project, and it does work as it should be . But when I change to the Qt4.8.7, and i change somewhere like this: import QtQuick 1.0(in main.qml); QDeclarativeEngine::setObjectOwnership(this, QDeclarativeEngine::CppOwnership); // QQmlEngine
(in ListModel.cpp), and finally I debug this project with Qt 4.8.7 MinGW, pretty well, no error.
But , What confused me is that why the listView show nothing (no data showing).
It will be appreciated very much, if you could give me a reply.
thanks anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.