Results 1 to 4 of 4

Thread: Most efficient way to implement data in QML from C++

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Most efficient way to implement data in QML from C++

    Quote Originally Posted by sam_s View Post
    QUESTION: Given the platform and amount of data - what is the best method for populating model in QML that allows for the usage of delegates
    A custom C++ model.

    The delegate part is on the QML side, it doesn't care what kind of model you have. Even a plain number can be treated as a model.

    Quote Originally Posted by sam_s View Post
    The two ways we are currently looking at are:
    a) creating a list model in QML and populating data with javascript (see code example below
    This method is working but we are concerned about performance issues using javascript over c++
    QUESTION: Is this the best method?
    No

    Quote Originally Posted by sam_s View Post
    b) creating a QAbstractTableModel in c++
    new to this concept and am concerned that I will have to create individual get / set functions for each column. We currently have over 50 columns. (I believe these are "roles" within the QAbstractmodel )
    QUESTION: Does QAbstractTableModel allow for the usage of delegates in QML, If using QAbstractmodel is the best approach, then does every column need it's own get set function?
    While you can use QAbstractTableModel, e.g. if you also want to show the data in a widget based QTableView, QtQuick will only treat it as a list model.
    A table model can still work if the model can map the QML roles onto columns, or you just derive from QAbstractListModel.

    Quote Originally Posted by sam_s View Post
    QUESTION: Is there a third option that we are not considering?
    Yes, QAbstractListModel

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    sam_s (4th November 2016)

Similar Threads

  1. Replies: 2
    Last Post: 5th April 2013, 04:58
  2. most efficient way to get a QPixmap from a QImage
    By caduel in forum Qt Programming
    Replies: 3
    Last Post: 11th June 2011, 12:00
  3. Replies: 1
    Last Post: 23rd September 2010, 20:16
  4. How to make efficient apps?
    By Tomasz in forum Qt for Embedded and Mobile
    Replies: 26
    Last Post: 22nd September 2010, 22:58
  5. Efficient way of inserting rows?
    By afflictedd2 in forum Qt Programming
    Replies: 1
    Last Post: 14th July 2008, 20:01

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
  •  
Qt is a trademark of The Qt Company.