QFile is used for accessing a text file where the non-continuous data is kept. The CandlestickDataReader is an auxiliary class for reading the text file and finding the open, high, low, close, and timestamp values from the data. The CandlestickDataReader is explained in more detail later. The method readCandlestickSet() reads the values and sets them to the QCandlestickSet item which the method returns for the caller. The returned QCandlestickSet item is added to the series. We are also saving custom categories list for later use.

Here, we ask the chart to create default axes for our presentation. Then, we set custom categories for the horizontal axis by querying the pointer for the axis from the chart, and then setting the categories from previously saved custom categories list. We also set the range for the vertical axis by querying the pointer for the axis from the chart, and then setting the min and max values for that axis.