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. remove display role in a tableview

remove display role in a tableview

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 338 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.
  • Y Offline
    Y Offline
    Yue JIN
    wrote on last edited by
    #1

    Hi,everybody. Is it possible to remove the display role of a cell in tableview, while keeping the checkbox and the decoration role.

    JonBJ 1 Reply Last reply
    0
    • Y Yue JIN

      Hi,everybody. Is it possible to remove the display role of a cell in tableview, while keeping the checkbox and the decoration role.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Yue-JIN
      What does "remove the display role" mean? You can't stop e.g. Qt view code from asking for it from the model's data() method. Though you can return whatever you wish from there (e.g. ""?) if that's what floats your boat (and it doesn't have any unforeseen side-effects)....

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        Setting a null variant does the trick
        view->model()->setData(view->model()->index(row,column),QVariant(),Qt::DisplayRole);

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        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