Results 1 to 2 of 2

Thread: QSqlTableModel + QTableView + rich text in Headers

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSqlTableModel + QTableView + rich text in Headers

    I have a QSqlTableModel with a QTableView I use to display the model's item.
    I set the header of the table view with:
    Qt Code:
    1. model->setHeaderData(1, Qt::Horizontal, tr("Marca"),Qt:: DisplayRole);
    To copy to clipboard, switch view to plain text mode 

    Now, suppose I wanna put some fancy things in the header, for example a greek symbol.
    I know that in html I can do "γ", but this does not work if I put, let's say,
    Qt Code:
    1. model->setHeaderData(1, Qt::Horizontal, tr("<p>&gamma;</p>"),Qt:: DisplayRole);
    To copy to clipboard, switch view to plain text mode 
    How can I do it?
    regards

  2. #2
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt4

    Default Re: QSqlTableModel + QTableView + rich text in Headers

    try
    Qt Code:
    1. #ifdef _UNICODE
    2. #define _T(x) L ## x
    3. #else /* _UNICODE */
    4. #define _T(x) x
    5. #endif /* _UNICODE */
    6.  
    7.  
    8. QString::fromStdWString(_T("ΓΞΦ"))
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 7
    Last Post: 13th May 2009, 00:26
  2. Rich Text in QTableWidgetItem
    By joshuajcarson in forum Qt Programming
    Replies: 9
    Last Post: 2nd September 2008, 15:49
  3. Rich text with QPainter?
    By sarefo in forum Qt Programming
    Replies: 3
    Last Post: 7th April 2008, 14:40
  4. QTextEdit + paste rich text as plain text only
    By Yong in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2008, 16:45
  5. Painting Rich Text
    By xanthine in forum Qt Programming
    Replies: 7
    Last Post: 15th April 2006, 23:35

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.