Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Paint issue with QTableView and QAbstractTableModel
Forum Updated to NodeBB v4.3 + New Features

Paint issue with QTableView and QAbstractTableModel

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brunomar
    wrote on last edited by
    #1

    Hello,
    I have created a custom data model for a QTableview. I use the function below to append lines in the model (it is a logger widget). When I do several subsequent calls to that function, the widget appears to paint the wrong content for some cells. It even occured one time that a cell was half paint with a content and half with another content. According to the test with "isGuiThread", every call is done on the gui thread. Is there something I'm doing wrong when I insert and remove lines?

    Thanks.

    @void DataModel::appendLog(LogEventPtr event)
    {
    {
    const bool isGuiThread =
    QThread::currentThread() == QCoreApplication::instance()->thread();
    if(!isGuiThread)
    event->Message += QString::fromLatin1(" [Bad thread]");

    beginInsertRows(QModelIndex(), static_cast<int>(mMessageQueue.size()),
        static_cast<int>(mMessageQueue.size()));
    mMessageQueue.push_back(event);
    endInsertRows();
    if(mMaxLogLength)
    {
      int lRowToRemove = static_cast<int>(mMessageQueue.size()) - mMaxLogLength;
      if(lRowToRemove > 0)
      {
        beginRemoveRows(QModelIndex(), 0, lRowToRemove - 1);
        mDroppedEntriesCount += lRowToRemove;
        for(int i = 0; i < lRowToRemove; ++i)
        {
          mMessageQueue.pop_front();
        }
        endRemoveRows();
      }
    }
    

    }
    }@
    !http://alphonse.dyndns.org:8000/Qt/logger.png(paint_issue)!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved