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 cell validation (specific validator for a column)
Forum Updated to NodeBB v4.3 + New Features

QTableView cell validation (specific validator for a column)

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 3.6k 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.
  • thompsonxT Offline
    thompsonxT Offline
    thompsonx
    wrote on last edited by
    #1

    Hi,
    I am now working on GUI where I have standard QTableView with QStandardItemModel. This table contains 3 columns. I want to validate first two columns with one single validator. The third one should be without validation. Is it possible to do it in Qt?
    I found a solution with a delegate but this checks whole table instead of specific columns (https://stackoverflow.com/questions/26614678/validating-user-input-in-a-qtableview)
    I can always perform a "manual" validation after a form with the table is submitted but I would prefer a solution with QValidator.

    VRoninV 1 Reply Last reply
    0
    • thompsonxT thompsonx

      Hi,
      I am now working on GUI where I have standard QTableView with QStandardItemModel. This table contains 3 columns. I want to validate first two columns with one single validator. The third one should be without validation. Is it possible to do it in Qt?
      I found a solution with a delegate but this checks whole table instead of specific columns (https://stackoverflow.com/questions/26614678/validating-user-input-in-a-qtableview)
      I can always perform a "manual" validation after a form with the table is submitted but I would prefer a solution with QValidator.

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @thompsonx said in QTableView cell validation (specific validator for a column):

      I found a solution with a delegate but this checks whole table instead of specific columns

      QTableView has setItemDelegateForColumn to apply to a single column. you can apply the same delegate (i mean same instance) to multiple columns as long as the view is the same

      "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

      thompsonxT 1 Reply Last reply
      2
      • VRoninV VRonin

        @thompsonx said in QTableView cell validation (specific validator for a column):

        I found a solution with a delegate but this checks whole table instead of specific columns

        QTableView has setItemDelegateForColumn to apply to a single column. you can apply the same delegate (i mean same instance) to multiple columns as long as the view is the same

        thompsonxT Offline
        thompsonxT Offline
        thompsonx
        wrote on last edited by
        #3

        @VRonin

        Perfect. Thanks.

        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