Results 1 to 6 of 6

Thread: How to represent QDateTime data in QTableView in needed format?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo
    Thanked 17 Times in 17 Posts

    Default Re: How to represent QDateTime data in QTableView in needed format?

    Try to keep QDateTime data type while setting the data for editing purpose (Qt::EditRole), and set the data for displaying (Qt::DisplayRole) with converted type (QString).

    Edit: disable smilies
    ~ We are nothing in this universe ~

  2. The following user says thank you to viulskiez for this useful post:

    falconium (15th April 2011)

  3. #2
    Join Date
    May 2010
    Posts
    86
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Default Re: How to represent QDateTime data in QTableView in needed format?

    QVariant QStandardItem::data ( int role = Qt::UserRole + 1 ) const [virtual]
    Returns the item's data for the given role, or an invalid QVariant if there is no data for the role.
    Note: The default implementation treats Qt::EditRole and Qt::DisplayRole as referring to the same data.

    Does it mean QStandardItem must be inherited to a new class that separates edit and display roles?
    How can I do that if it is the case?

    Thank you!

Similar Threads

  1. Qt to Matlab (mat format) export data to Matlab .mat format -v4
    By windsword in forum Qt-based Software
    Replies: 4
    Last Post: 26th February 2013, 20:01
  2. QList custom data format
    By sureshkvl in forum Qt Programming
    Replies: 1
    Last Post: 13th October 2010, 13:26
  3. How can you display binary data in hex format?
    By Cruz in forum Qt Programming
    Replies: 2
    Last Post: 4th February 2009, 14:40
  4. Error format a cell in QTableView
    By estanisgeyer in forum Qt Programming
    Replies: 3
    Last Post: 4th September 2008, 14:22
  5. Defining data format in c++
    By locus in forum General Programming
    Replies: 3
    Last Post: 13th April 2007, 19:40

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.