1

I am trying to make a simple application with pyqt. What I want to make is a tree view with candlestick bar like the below,

enter image description here

I decided to make it using this sample.

But still, I couldn't find how to draw candlestick bar inside a cell of widget row.

Can you suggest any sample code or guideline for getting cell coordinates and drawing a bar inside column cells ?

Community
  • 1
  • 1
user1913171
  • 283
  • 4
  • 14

1 Answers1

1

It depends on how you're planning to generate the candlestick bar.

If you're able to generate an image using some other library, you can create a QPixmap from the image and put it inside a QLabel, then insert the QLabel in to a specific cell using QTreeWidget.setItemWidget.

If you plan on drawing the candlestick bar yourself, you could use a QItemDelegate and override the paint method to draw the graph yourself based on data you set on each QTreeWidgetItem.

Brendan Abel
  • 35,343
  • 14
  • 88
  • 118