Results 1 to 3 of 3

Thread: styling controls inside QTreeView

  1. #1
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Question styling controls inside QTreeView

    In my application I use QTreeView that contains progressbar items inside its cells. Progressbar controls are drawn inside QStyledItemDelegate::paint procedure in the following way:
    Qt Code:
    1. QStyleOptionViewItemV4 optionV4 = option;
    2. initStyleOption(&optionV4, index);
    3. QStyle * style = optionV4.widget->style();
    4. //....
    5. progressOpt.orientation = Qt::Horizontal;
    6. //....
    7. style->drawControl(QStyle::CE_ProgressBar, &progressOpt, painter);
    To copy to clipboard, switch view to plain text mode 

    Is it possible to change the style of such progressbar controls with qss?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: styling controls inside QTreeView

    No, I don't think so. There is no qss selector that would allow to reach widgets inside itemview cells. It might work if you set a global stylesheet for ALL progress bars but there are no guarantees.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2011
    Location
    Ann Arbor, MI USA
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: styling controls inside QTreeView

    I need the exact same thing. I tried setting a global style sheet for all progress bars, but the progress bars in the QTreeWidget are unchanged. I attached a sample project that shows what I tried (progressTest.zip).

    It seems like there should be a way to do this. Are we really out of luck?
    Attached Files Attached Files

Similar Threads

  1. Replies: 0
    Last Post: 16th January 2011, 02:35
  2. Replies: 2
    Last Post: 3rd April 2010, 15:18
  3. Problem refreshing QTreeView inside QTabWidget
    By laugusti in forum Qt Programming
    Replies: 3
    Last Post: 16th December 2009, 09:05
  4. Replies: 2
    Last Post: 2nd November 2009, 13:24
  5. Hiding controls changes spacing of other controls
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2007, 20:47

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.