hello everyone!
few days i spend to figure out how connect SQlite and QML GridView?
can u help me
main.cpp
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("database.db");
ui = new QDeclarativeView;
ui->setSource(QUrl("qrc:/myqml.qml");
ui->rootContext()->setContextProperty("addressBook", model1);
QML **********
GridView {
id: fruitsView
interactive: false
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.HorizontalFlick
anchors.fill: parent
cellWidth: 65
cellHeight: 72
model: addressBook
delegate: LaunchDelegate{
}
}
Bookmarks