Results 1 to 2 of 2

Thread: Reformat data in cell

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Reformat data in cell

    I tried reformat data in cell (QTableView) with my custom model. But I just get crash. This is my code what I use..

    Qt Code:
    1. QVariant customModel::data(const QModelIndex &index, int role) const
    2. {
    3.  
    4. if (role==Qt::DisplayRole && index.column()==3)
    5. {
    6. return index.model()->data(index, Qt::DisplayRole).toString().append("Rp. ");
    7. }
    8.  
    9. return QSqlQueryModel::data(index, role);
    10. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Reformat data in cell

    you call yourself (in the call to data): recursion, endless loop, stack overflow, crash...

    call the base class's data() function instead.

  3. The following user says thank you to caduel for this useful post:

    wirasto (29th November 2009)

Similar Threads

  1. data rate transfer is decreasing in TCP connection
    By navi1084 in forum Qt Programming
    Replies: 3
    Last Post: 19th June 2009, 17:15
  2. How to tell if QTableView cell is visible ?
    By steviekm3 in forum Qt Programming
    Replies: 0
    Last Post: 2nd March 2009, 11:04
  3. how to get data from cell of QTableview
    By yleesun in forum Qt Programming
    Replies: 2
    Last Post: 9th January 2009, 15:31
  4. Best way to display lots of data fast
    By New2QT in forum Newbie
    Replies: 4
    Last Post: 16th October 2008, 23:46
  5. Problems with QString
    By cyberboy in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2008, 09:18

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.