title: showing gridlines with QTreeView
body: <p>I am using a QTreeView with a custom delegate and i subclassed QAbstractItemModel.
  I would like to see gridlines for items without children.</p>
  
  <p>At first display, everything’s looks fine but whenever the mouse hovers over an item, the bottom or top line dissappears and reappears when hovering back to the item. </p>
  
  <p>since this is my first post, it seems that i cannot post some images to show the unwanted effect.</p>
  
  <p>But i guess something's wrong with my custom delegate or my stylesheet for the QTreeView :</p>
  
  <pre><code>void ProjetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
  {
      if (index.column() &gt; 0 &amp;&amp; !index.model()-&gt;hasChildren(index))
      {        
          QPen pen;
          pen.setColor(QColor(Qt::lightGray));
          pen.setWidth(1);
          painter-&gt;setPen(pen);
          painter-&gt;drawRect(option.rect);
          QStyledItemDelegate::paint(painter,option,index);
      }
      else QStyledItemDelegate::paint(painter,option,index);
  }
  </code></pre>
  
  <p>The stylesheet used is :</p>
  
  <pre><code>QString treeViewStyle =
      "QTreeView { show-decoration-selected: 1; }"
      "QTreeView::item:hover { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 lightgray, stop: 1 white); }"
      "QTreeView::item:selected:active { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 lightgray, stop: 1 lightgray); color: black; }"
      "QTreeView::item:selected:!active { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 lightgray, stop: 1 lightgray); color: black;}" ;
  </code></pre>
  
  <p>Has anyone an idea of how to get rid of this dynamic behavior and keep the initial correct view at first display ?</p>
  
  <p>Thanks.</p>