Results 1 to 1 of 1

Thread: QML GridView load model from C++ SQLite

  1. #1
    Join Date
    Aug 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Smile QML GridView load model from C++ SQLite

    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{

    }
    }
    Last edited by olegdim; 21st August 2012 at 20:16.

Similar Threads

  1. Load a new Sqlite database problem
    By beware in forum Qt Programming
    Replies: 15
    Last Post: 24th January 2011, 09:05
  2. Custom model for QTreeView with SQLite data source
    By emanuel in forum Qt Programming
    Replies: 0
    Last Post: 19th January 2011, 00:53
  3. Usage of QTableView as gridview
    By ada10 in forum Newbie
    Replies: 7
    Last Post: 9th August 2010, 23:13
  4. Cannot load SQLITE driver on clean target
    By ForestDweller in forum Installation and Deployment
    Replies: 1
    Last Post: 15th December 2008, 00:49
  5. Replies: 1
    Last Post: 14th October 2007, 10:09

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.