Results 1 to 7 of 7

Thread: QPoint(0,0) is not rendered with QStyledItemDelegate, bug or feature?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Thumbs down QPoint(0,0) is not rendered with QStyledItemDelegate, bug or feature?

    Its basically pretty simple. I need to put QPoints in my QStandardItemModel, and to render them in the QTableView I sub-classed the QStyledItemDelegate and customized the displayText method to:
    Qt Code:
    1. virtual QString displayText(const QVariant & value, const QLocale & locale ) const
    2. {
    3. Q_UNUSED(locale);
    4. return QString("{%1,%2}").arg(value.toPoint().x()).arg(value.toPoint().y());
    5.  
    6. }
    To copy to clipboard, switch view to plain text mode 
    So far so good. It worked perfectly after I setted the Delegate for the specific column containing QPoints:
    Qt Code:
    1. tableView->setItemDelegateForColumn(1, pointDelegate);
    To copy to clipboard, switch view to plain text mode 

    Now, for some weird, weird reason the displayText method is not entering when the model has a point with zero on both coordinates. It does nothing to do with the QVariant or parsing the value cause I can confirm its just not entering the method at all.

    Why is that? Looks like a bug to me.
    Last edited by toglia3d; 4th September 2010 at 05:08.

Similar Threads

  1. SVG rendered to an 8 bits indexed QImage ?
    By lauranger in forum Qt Programming
    Replies: 0
    Last Post: 23rd March 2009, 21:44
  2. changing svg graphic attributes once rendered
    By barrygp in forum Qt Programming
    Replies: 0
    Last Post: 13th December 2008, 02:09
  3. Programmatically Save Image rendered in a QWebPage
    By last2kn0 in forum Qt Programming
    Replies: 1
    Last Post: 24th November 2008, 06:33
  4. Webkit rendered fonts
    By carl in forum Qt Programming
    Replies: 0
    Last Post: 5th September 2008, 16:49
  5. QPoint Limitation
    By archanasubodh in forum Qt Programming
    Replies: 1
    Last Post: 5th August 2008, 10:22

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.