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. customizing a QTreeView
Forum Updated to NodeBB v4.3 + New Features

customizing a QTreeView

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 137 Views
  • 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.
  • gbettegaG Offline
    gbettegaG Offline
    gbettega
    wrote on last edited by
    #1

    Hello,
    this view is a QTreeView, linked to a QStandardItemModel.

    pic00.PNG

    In order to make this view similar to a table view, I built a delegate which removes the QTreeView identation for the items at level 2 (i.e. "Definition" is a level 1, "Name" and "Thermodynamic state" is at level 2), and sets to zero the width of the QRect near to each "title" in bold.

    This is done acting on the QStyleOptionViewItem, input of

    QStyledItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &index)

    This is approach for me is useful, since I can preserve the lateral arrows for expanding and compressing the main items..

    Now:

    (1) When resizing columns by dragging the handle I encountered this problem:

    pic01.PNG

    The view of some "titles" is chop: I cannot understand why, for example the first no, the last no, and the remaining yes.

    (2) when moving the mouse pointer on the bold title cell, which is actually a single full width cell, with a zero width sibling, the highlight effect appears like in the the picture (I added a black thin box for evidencing a sort of double highlight)

    pic03.PNG

    Please, someone of you, can give me an hint?
    Grazie mille
    Giovanni

    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