Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How write inside a pie chart
A Former User last edited by A Former User
I tried to draw a pie chart but I want write inside..How Can I?
this is my code of the class
Pie::Pie(QWidget *parent) : QWidget(parent)
void Pie::paintEvent(QPaintEvent *)
QRectF size = QRectF(10,10,this->width()-10, this->width()-10);
There is an example already present in the examples directory. Can you look at it.
@dheerendra yes but in the example they use qCharts
but I want write inside
So, your code is not doing what you want? Does it write text outside the pie?
You really should explain better what the problem is.
@jsulm I want a text outside the pie
@vale88 then draw it outside the pie. I'm not sure what the problem is.
@jsulm yes but I don't know how I can do it
@vale88 I guess your problem is that you do not know at which position to draw your text, so it does not cover the pie, is that correct? You need to calculate that. You know where your pie is and how big it is. You would somehow need to know how much space your text is going to occupy (bounding box). Then you can calculate the position for the text.