-1

I have pre-existing code which has a tree view like appearance but doesn't actually use QTreeView (uses QListWidget with custom paint).

I am tasked to add the indentation between the parent and child objects, but I can't able to find how to get the style default indentation width from QStyle. The program has to run on a variety of os and allow to use custom stylesheets. So it's important to get this option from QStyle.

Regards.

unknown.prince
  • 710
  • 6
  • 19

1 Answers1

0

found this in qt sources

have to use QStyle::pixelMetric with QStyle::PM_TreeViewIndentation
inside your widget's procedure

ident = style()->pixelMetric(QStyle::PM_TreeViewIndentation)

unknown.prince
  • 710
  • 6
  • 19
  • 1
    The provided answer was flagged for review as a Low Quality Post. Here are some guidelines for [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer). This provided answer may be correct, but it could benefit from an explanation. Code only answers are not considered "good" answers. From [review](https://stackoverflow.com/review). – Trenton McKinney Sep 22 '19 at 08:23