Results 1 to 2 of 2

Thread: How to conditionaly enable cells dpeneding on other cells data?

  1. #1
    Join Date
    Sep 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Post How to conditionaly enable cells dpeneding on other cells data?

    Hi,

    I'm using QTableView to dispaly data of a QStandardItemModel. The model contains 3 columns. In the QTableView I use a custom delegate to second column, where user can select values from a combo box.

    To select values from the combo box user should enter value to first column's cell. How can I enable/disable second column if it first column empty?

    This basically means user should not able to select any value ( no edit mode ) if left cell is empty.

    combo.png

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to conditionaly enable cells dpeneding on other cells data?

    Make your own model by deriving from QAbstractTableModel. In the flags function, for column 2 check against your datasource or model for column1 data and pass appropriate flag.

Similar Threads

  1. Merging cells in QTableWidget
    By lyucs in forum Newbie
    Replies: 1
    Last Post: 22nd January 2010, 19:15
  2. Non-uniform cells
    By ttvo in forum Qt Programming
    Replies: 2
    Last Post: 22nd April 2009, 19:20
  3. Table and validating cells
    By zorro68 in forum Qt Programming
    Replies: 1
    Last Post: 9th February 2007, 23:22
  4. Editable cells in QTableView
    By TheRonin in forum Qt Programming
    Replies: 1
    Last Post: 29th November 2006, 17:39
  5. table with combobox cells
    By mgurbuz in forum Qt Programming
    Replies: 2
    Last Post: 10th May 2006, 12:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.