Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTreeWidget border radius toggles visibility during scrolling when set alternating row colors
Forum Updated to NodeBB v4.3 + New Features

QTreeWidget border radius toggles visibility during scrolling when set alternating row colors

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 820 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cupidvogel
    wrote on last edited by
    #1

    I am trying to design a QTreeWidget with border-radius. The problem sets in when I assign alternate row colors to it. When I don't, it works fine, and the border-radius around the widget is always visible during scrolling. However, when I scroll with the alternate row colors set, during even numbered rows being at the top and bottom, the border-radius remains as expected, while during odd numbered ones, they are eclipsed, with the look and feel of a widget with no border-radius. Here's what it looks like when the grey colored rows are at the top and bottom:

    !http://i.stack.imgur.com/rhQVA.png(Image with border-radius)!

    And after you scroll one unit, or odd number of units, so that the white colored rows are at the ends, this is what it looks like:

    !http://i.stack.imgur.com/jhvwJ.png(Image without border radius)!

    How do I fix this? And in Windows, because the scrollbars are differently styled, the right side will always have the border radius eclipsed due to the scroll pane. Is there a way to make it behave just like the Mac scrollbar?

    My style sheet is pretty minimal:

    @#myTreeWidget {background-color: #C2C7CB; border-radius: 8px; }@

    I set the width of the rows through a delegate:

    @
    class ItemDelegate : public QItemDelegate
    {
    public:
    ItemDelegate()
    {}
    QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
    {
    return QSize(240,25);
    }
    };

    ItemDelegate *delegate = new ItemDelegate();

    myTreeWidget = new QTreeWidget(this);
    myTreeWidget->setObjectName(QString::fromUtf8("myTreeWidget"));
    myTreeWidget->setAttribute(Qt::WA_MacShowFocusRect,false);
    myTreeWidget->setGeometry(QRect(20, 10, 240, 375));
    myTreeWidget->headerItem()->setHidden(true);
    myTreeWidget->setItemDelegate(delegate);
    myTreeWidget->setAlternatingRowColors(true);
    @

    I just observed a weird thing. If I remove the background color from the widget, the border radius completely disappears. Not visible under any circumstance!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Looks like it could be a bug. You should check the "bug report system":http://bugreports.qt.io to see if it's something known

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved