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,
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 ?
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
.