Results 1 to 2 of 2

Thread: Change value inside QTableView or QSqlQuery

  1. #1
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Change value inside QTableView or QSqlQuery

    Hi,

    one of the fields of my database return an integer, but I'd like to display the info as a String (for instance, if the integer is 0 then I'd like to show "Novice", if it's 10 then "Expert" and so on).

    There is any way to edit the data inside a QTableView or a DataSet?

    thanks!

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Change value inside QTableView or QSqlQuery

    try to write your own item delegate, which will recognize numbers and set in a model using Qt:: DisplayRole needed strings.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. How can I change row heigth in QTableView?
    By Tamara in forum Qt Programming
    Replies: 8
    Last Post: 18th August 2011, 20:41
  2. QTableView 2 rows inside every row
    By skuda in forum Qt Programming
    Replies: 3
    Last Post: 22nd April 2009, 09:23
  3. How to change columns order in a QTableView...
    By cydside in forum Qt Programming
    Replies: 1
    Last Post: 20th April 2009, 10:42
  4. QTableView change color of current Cell
    By raphaelf in forum Qt Programming
    Replies: 4
    Last Post: 4th March 2006, 11:22

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.