How to access chartview in chat
-
@IknowQT
LikeQGraphicsScene
/QGraphicsView
, and other Qt model-views likeQAbstractTableModel
/QTableView
, the view is attached to, and can see, the backing model/scene/chart, but that does not have access to any view(s) (might be multiple) which might be attached to it.The first question to ask yourself is: why does the chart need any access to a view? It is not supposed to, and may indicate a bad approach.
If you do want that for whatever reason, subclass the
QChart
and add a member variable which you set to the singleQChartView
you want it to be able to access. -
@JonB said in How to access chartview in chat:
스스로에게 묻는 첫 번째 질문은 다음과 같습니다. 차트에 보기에 대한 액세스 권한이 필요한 이유는 무엇입니까? 그
I wanted to get the geometry value of the chart view, so I made a set function manually to get the value.
A sudden thought occurred to me that the parent could be called from the chart because there is a chart under the chart view. -
@IknowQT said in How to access chartview in chat:
I wanted to get the geometry value of the chart view, so I made a set function manually to get the value.
Why would your
QChart
code want to know or care about what the geometry of some particularQChartView
is? It should not.