Results 1 to 2 of 2

Thread: Best practice for dynamic update of QTabelView

  1. #1
    Join Date
    Mar 2020
    Qt products

    Default Best practice for dynamic update of QTabelView

    I have an application(QT 5.11.2, linux) with 200 cells. The text in 20 … 40 cells change every second. Now I us the dataChanged signal for update the QTabelView. I use one signal per cell.
    If I send a dataChanged with more than one cell, always the whole table was updated.

    Is QTableView the right widget or is QTableWidget better?

    Is there a better way to update the cells?

    Code samples
    class Xdatamodel : public QAbstractTableModel
    void Xdatamodel::setModelData(int rowindex, int dataitem, QString value)
    dataMatrix[rowindex].operator [](dataitem) = value;
    emit(dataChanged(index(rowindex,dataitem), index(rowindex,dataitem),

    QVariant Xdatamodel::data(const QModelIndex &index, int role) const
    if (role == Qt:isplayRole || role == Qt::EditRole)
    return dataMatrix[index.row()].at(index.column());

  2. #2
    Join Date
    Jan 2006
    Bremen, Germany
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Unix/X11 Windows

    Default Re: Best practice for dynamic update of QTabelView

    Since you're already using a custom model you have to use QTableView. One signal per cell is fine.

  3. The following user says thank you to ChristianEhrlicher for this useful post:

    regenwo62 (23rd March 2020)

Similar Threads

  1. Remove row button in QTabelview
    By guidupas in forum Qt Programming
    Replies: 2
    Last Post: 10th March 2014, 14:31
  2. Update QGraphicsScene - Best Practice
    By vinaykusta in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2011, 04:52
  3. Special delegate for QTabelView
    By kunashir in forum Qt-based Software
    Replies: 0
    Last Post: 17th March 2011, 13:22
  4. dynamic QLabel update
    By satanowicz in forum Newbie
    Replies: 8
    Last Post: 25th May 2010, 23:20
  5. Change database data in the QTabelView
    By sophister in forum Qt Programming
    Replies: 3
    Last Post: 9th April 2009, 16:40

Tags for this Thread


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.