Results 1 to 2 of 2

Thread: setting width of QTreeView branch indicator

  1. #1
    Join Date
    May 2018
    Posts
    1
    Qt products
    Qt4

    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
    Location
    Bremen, Germany
    Posts
    443
    Thanked 60 Times in 56 Posts
    Qt products
    Qt3 Qt4
    Platforms
    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, 17:24
  2. QTreeView branch images won't show up
    By nuliknol in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2015, 10:26
  3. QTreeView::branch gridline-color?
    By chouqud in forum Newbie
    Replies: 2
    Last Post: 21st March 2014, 11:48
  4. Replies: 0
    Last Post: 12th November 2012, 13:12
  5. QTreeView branch indicator bug?
    By ugluk in forum Qt Programming
    Replies: 2
    Last Post: 28th May 2012, 10:55

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.