Results 1 to 7 of 7

Thread: KLed in a list view

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Location
    istanbul, turkey
    Posts
    42
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default Re: KLed in a list view

    it's not as much hard. i'll post you a progress bar within listviewitems.

    you need to subclass listviewitem.
    overriding of paintCell method is enough i thing.

    assume that SomeListViewItem is subclass of QListViewItem
    Qt Code:
    1. void SomeListViewItem::paintCell( QPainter *p, const QColorGroup &cg,
    2. int column, int w, int alignment )
    3. {
    4. QListViewItem::paintCell( p, cg, column, w, alignment );
    5.  
    6. QColor gray(223, 221, 244);
    7. QColor white(255, 255, 255);
    8. QColor textColor(255, 0, 0);
    9.  
    10. double wGray = (double)m_iSinyalSeviyesi * w / 100;
    11. double wWhite = (double)w - wGray;
    12.  
    13. // draw for column number 3 only
    14. // let listview draw for other columns
    15. if (column == 3) {
    16. p->setBrush(gray);
    17. p->drawRect(0, 5, (int)wGray, 32);
    18. p->setBrush(white);
    19. p->drawRect(wGray, 5, (int)wWhite, 32);
    20. p->setPen(textColor);
    21. p->drawText(w/2-10, height()/2+5, QString(s));
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jacek; 9th August 2006 at 13:29. Reason: added code tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: KLed in a list view

    Quote Originally Posted by hayati
    i'll post you a progress bar within listviewitems.
    For a pixmap all you need is QListViewItem::setPixmap().

  3. #3
    Join Date
    Jul 2006
    Location
    Cagliari - Sardinia - Italy
    Posts
    26
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: KLed in a list view

    thanks hayati! You've given me a very good example

    Now I try to do it .

    Thanks a lot!

Similar Threads

  1. Drag and drop items in view to sort order
    By Big Duck in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2006, 19:43
  2. Replies: 1
    Last Post: 2nd May 2006, 21:11
  3. Model - View Programming doubt.
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2006, 13:01
  4. Replies: 6
    Last Post: 20th April 2006, 10:23
  5. Rubberband painting on multiselection in a list view
    By SkripT in forum Qt Programming
    Replies: 10
    Last Post: 19th March 2006, 11:13

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.