Results 1 to 2 of 2

Thread: Using qStyledItemDelegate to draw QTreeWidget items as QLabels

  1. #1

    Default Using qStyledItemDelegate to draw QTreeWidget items as QLabels

    I've been pouring over examples of using qStyledItemDelegate for hours and I still haven't been able to find what I'm looking for. I just need a simple way to use QLabels for my items in QTreeWidget. Should I be using qStyledItemDelegate:: paint or the qTreeWidget::setItemWidget method? Can anybody point me in the right direction? Thanks

  2. #2

    Default Re: Using qStyledItemDelegate to draw QTreeWidget items as QLabels

    I think I could get it if I could figure out how to access the treeWidget from inside the paint function. That way I could just do a
    QLabel *label = new QLabel();
    label->setText("whatever");
    ui->treeWidget->setItemWidget(item,0,label);

    How would I do this? thanks in advance

Similar Threads

  1. Replies: 0
    Last Post: 30th August 2010, 19:08
  2. Use delegate to draw different type of items
    By nifei in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2009, 13:16
  3. amount of items in QTreeWidget
    By supergillis in forum Qt Programming
    Replies: 4
    Last Post: 1st August 2008, 22:38
  4. Replies: 4
    Last Post: 9th May 2008, 21:56
  5. Replies: 5
    Last Post: 30th March 2008, 16:53

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.