Results 1 to 20 of 70

Thread: How to show progess in a QTreeView item ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    And one more question I'd like to ask. I don't know if this is the right topic so don't blame me too much

    The problem is when I click on a row in my table widget it becomes highlighted but when I use delegates it is not. I've tried to do like this
    Qt Code:
    1. if (table->currentRow() == index.row())
    2. {
    3. painter->setBrush(QBrush(QColor("#444444")));
    4. painter->drawRect(opt.rect);
    5. }
    To copy to clipboard, switch view to plain text mode 
    but it didn't work the way I thought. Also I've tried to use setBackground with QPainter and that didn't work either
    C++ & AMD forever

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to show progess in a QTreeView item ?

    The QStyleOptionViewItem parameter contains all required information.
    Qt Code:
    1. if (opt.state & QStyle::State_Selected)
    2. ...
    3.  
    4. if (opt.state & QStyle::State_HasFocus)
    5. ...
    To copy to clipboard, switch view to plain text mode 
    etc.
    J-P Nurmi

  3. #3
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    Quote Originally Posted by jpn View Post
    The QStyleOptionViewItem parameter contains all required information.
    Qt Code:
    1. if (opt.state & QStyle::State_Selected)
    2. ...
    3.  
    4. if (opt.state & QStyle::State_HasFocus)
    5. ...
    To copy to clipboard, switch view to plain text mode 
    etc.
    And what after ???
    I've tried like
    Qt Code:
    1. if (opt.state & QStyle::State_Selected)
    2. {
    3. painter->setBrush(QBrush(QColor("#444444")));
    4. painter->drawRect(opt.rect);
    5. }
    To copy to clipboard, switch view to plain text mode 
    Result -
    Attached Images Attached Images
    • File Type: jpg 1.jpg (6.3 KB, 36 views)
    C++ & AMD forever

  4. #4
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to show progess in a QTreeView item ?

    Sorry it was something with my brushes now it works fine
    C++ & AMD forever

Similar Threads

  1. Replies: 4
    Last Post: 26th September 2011, 12:02
  2. QTreeView and item editing
    By roxton in forum Qt Programming
    Replies: 3
    Last Post: 25th July 2008, 18:56
  3. QTreeView, QSortFilterProxyModel and item expansions
    By benacler in forum Qt Programming
    Replies: 3
    Last Post: 21st May 2008, 20:30
  4. QTreeView: selection behavior upon selected item removal
    By Pieter from Belgium in forum Qt Programming
    Replies: 6
    Last Post: 11th July 2007, 16:00
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 14:24

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.