Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-131318

QTreeWidget branches draw with PE_PanelItemViewRow instead of PE_IndicatorBranch when using stylesheets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.8.0
    • GUI: Look'n'Feel
    • None
    • All platforms & hardware.
    • All

    Description

      In qstylesheet.cpp:4764

          case PE_IndicatorBranch:
              if (const QStyleOptionViewItem {*}vopt = qstyleoption_cast<const QStyleOptionViewItem{*}>(opt)) {
                  QRenderRule subRule = renderRule(w, opt, PseudoElement_TreeViewBranch);
                  if (subRule.hasDrawable()) {
                       proxy()->drawPrimitive(PE_PanelItemViewRow, vopt, p, w);
                       subRule.drawRule(p, opt->rect);
                   } else {
                       baseStyle()->drawPrimitive(pe, vopt, p, w);
                   }
              }
      

      Here,

      proxy()->drawPrimitive(PE_PanelItemViewRow...)

      is drawing with the ItemView style. This results in quite odd behavior when using a stylesheet such as:

      QTreeView::item {
        background: grey;
        border: 1px solid black;
        border-radius: 4px;
      }
      
      QTreeView::branch:open:has-children {
        image: url(:/creator/images/controls/light/down-caret-black.svg);
        background-color: transparent;
      }
      

      Because of the above styling, the branch indicator will draw with a grey background and solid black 4px rounded border. Certainly not what the stylesheet author intended!

      This could easily be amended by just removing the

      proxy()->drawPrimitive(PE_PanelItemViewRow...)

      line entirely - or by drawing with

      PE_IndicatorBranch

      instead.

      I've attached a photo with the issue.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            nolo Nolan Kramer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes