PDA

View Full Version : QVBarModelMapper update chart on model change



Oliverleo
2nd November 2016, 12:04
Hi,

I am using QVBarModelMapper to show a BarChart. I provided my own implementation of QAbstractTableModel.
But the BarChart does not update, when the data in the TableModel changes and dataChanged() is emitted.
What do I have to do to automatically update the BarChart, when the model changes?

anda_skoa
2nd November 2016, 13:20
Could be a bug in the mapper class.
I assume you have verfied that the model works correctly? E.g. using a QTableView?

Cheers,
_

Oliverleo
2nd November 2016, 14:00
Yes, i use a TableView to show the data, and it gets updated properly

anda_skoa
2nd November 2016, 14:45
Hmm, you probably need to debug this then.

From the code it looks like the dataChanged signal is properly connected
https://code.woboq.org/qt5/qtcharts/src/charts/barchart/qbarmodelmapper.cpp.html#_ZN8QtCharts15QBarModelMa pper8setModelEP18QAbstractItemModel

Cheers,
_

Oliverleo
2nd November 2016, 15:36
It works now. I called emitted the dataChanged method on the wrong part of the data set. However, the table was updated correctly so I dont know why that worked.
Thanks for your help!