Results 1 to 2 of 2

Thread: setting width of QTreeView branch indicator

  1. #1
    Join Date
    May 2018
    Qt products

    Default setting width of QTreeView branch indicator

    Hi folks!

    I need to change width of branch indicator of QTreeView, but i cannot find corresponding parameter in QStyle class.

    I've tried to reimplement all virtual methods in QCommonStyle class which return int, QSize or QRect but the width of branch indicator is always 20.

    Qt Code:
    1. void drawPrimitive(PrimitiveElement elem, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const
    2. {
    3. if (elem == PE_IndicatorBranch)
    4. if (option->state & State_Children) {
    5. const int width = option->rect.width(); // width is always 20
    6. painter->setPen(QPen(Qt::red));
    7. painter->drawRect(option->rect);
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 

    I know that it seems to be possible to do using stylesheets, but i need to do that in styles, no stylesheets.
    How could i resize this indicator?

  2. #2
    Join Date
    Jan 2006
    Bremen, Germany
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Unix/X11 Windows

    Default Re: setting width of QTreeView branch indicator

Similar Threads

  1. QTreeView branch indicator changing icon randomly?
    By jonathan_MVE in forum Qt Programming
    Replies: 0
    Last Post: 4th August 2016, 18:24
  2. QTreeView branch images won't show up
    By nuliknol in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2015, 11:26
  3. QTreeView::branch gridline-color?
    By chouqud in forum Newbie
    Replies: 2
    Last Post: 21st March 2014, 12:48
  4. Replies: 0
    Last Post: 12th November 2012, 14:12
  5. QTreeView branch indicator bug?
    By ugluk in forum Qt Programming
    Replies: 2
    Last Post: 28th May 2012, 11:55

Tags for this Thread


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.