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 + validation + cell color change behavior
Qt 6.11 is out! See what's new in the release blog

QtableView + validation + cell color change behavior

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

    Hello and thanks for taking the time,
    I have a QTableView that uses a derivative of QItemDelegate to validate the input to the cells. At the same time, the table allows the opening of a context-menu by right clicking on a cell to change its color. Unfortunately however, this combination's behavior is not ideal right now: when I right click a cell and change its color by clicking on an item in the context-menu, the focus is set to the cell (i.e. it is editable as if I left-clicked on it) until I left-click on an adjacent cell, after which the cell is painted properly (and the latest clicked-on cell gets the focus).
    Any idea how to address this would be much appreciated!

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

      In setEditorData you have to manually take care of the editor having the background color that is set on the cell

      "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