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. QTableView Model data change Error.
QtWS25 Last Chance

QTableView Model data change Error.

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 183 Views
  • 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.
  • P Offline
    P Offline
    Pada_
    wrote on last edited by
    #1

    I use Linux 64Bit for Qt 5.4.

    You want to set the Model in the QTableView.

    We have not set backgroundColorRole in the data function of the model.

    I want to change the background color of the 0,0 index after the model is created and set in the QTableView.

    QModelIndex index = model-> index (0,0);
    model-> setData (index, QColor (Qt :: blue), Qt :: BackgroundColorRole);

    model's setData has not been overridden.
    The color does not change. How do I change it?

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Pada_ said in QTableView Model data change Error.:

      model's setData has not been overridden.

      Then how should it work at all? https://doc.qt.io/qt-5/qabstractitemmodel.html#setData

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      • Login

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