##// END OF EJS Templates
Fix setting the axis title...
Titta Heikkala -
r2608:001bc2f70487
parent child
Show More
@@ -59,20 +59,21 void CartesianChartAxis::createItems(int count)
59 }
59 }
60 }
60 }
61
61
62 QGraphicsTextItem *title = titleItem();
63 title->setFont(axis()->titleFont());
64 title->setDefaultTextColor(axis()->titleBrush().color());
65 title->setHtml(axis()->titleText());
66
62 for (int i = 0; i < count; ++i) {
67 for (int i = 0; i < count; ++i) {
63 QGraphicsLineItem *arrow = new QGraphicsLineItem(this);
68 QGraphicsLineItem *arrow = new QGraphicsLineItem(this);
64 QGraphicsLineItem *grid = new QGraphicsLineItem(this);
69 QGraphicsLineItem *grid = new QGraphicsLineItem(this);
65 QGraphicsTextItem *label = new QGraphicsTextItem(this);
70 QGraphicsTextItem *label = new QGraphicsTextItem(this);
66 label->document()->setDocumentMargin(ChartPresenter::textMargin());
71 label->document()->setDocumentMargin(ChartPresenter::textMargin());
67 QGraphicsTextItem *title = titleItem();
68 arrow->setPen(axis()->linePen());
72 arrow->setPen(axis()->linePen());
69 grid->setPen(axis()->gridLinePen());
73 grid->setPen(axis()->gridLinePen());
70 label->setFont(axis()->labelsFont());
74 label->setFont(axis()->labelsFont());
71 label->setDefaultTextColor(axis()->labelsBrush().color());
75 label->setDefaultTextColor(axis()->labelsBrush().color());
72 label->setRotation(axis()->labelsAngle());
76 label->setRotation(axis()->labelsAngle());
73 title->setFont(axis()->titleFont());
74 title->setDefaultTextColor(axis()->titleBrush().color());
75 title->setHtml(axis()->titleText());
76 arrowGroup()->addToGroup(arrow);
77 arrowGroup()->addToGroup(arrow);
77 gridGroup()->addToGroup(grid);
78 gridGroup()->addToGroup(grid);
78 labelGroup()->addToGroup(label);
79 labelGroup()->addToGroup(label);
@@ -152,6 +152,7 void ChartAxisElement::handleTitleTextChanged(const QString &title)
152 {
152 {
153 QGraphicsLayoutItem::updateGeometry();
153 QGraphicsLayoutItem::updateGeometry();
154 presenter()->layout()->invalidate();
154 presenter()->layout()->invalidate();
155 if (title.isEmpty() || !m_title->isVisible())
155 m_title->setHtml(title);
156 m_title->setHtml(title);
156 }
157 }
157
158
@@ -253,20 +253,21 void PolarChartAxisAngular::createItems(int count)
253 arrowGroup()->addToGroup(arrow);
253 arrowGroup()->addToGroup(arrow);
254 }
254 }
255
255
256 QGraphicsTextItem *title = titleItem();
257 title->setFont(axis()->titleFont());
258 title->setDefaultTextColor(axis()->titleBrush().color());
259 title->setHtml(axis()->titleText());
260
256 for (int i = 0; i < count; ++i) {
261 for (int i = 0; i < count; ++i) {
257 QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
262 QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
258 QGraphicsLineItem *grid = new QGraphicsLineItem(presenter()->rootItem());
263 QGraphicsLineItem *grid = new QGraphicsLineItem(presenter()->rootItem());
259 QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
264 QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
260 label->document()->setDocumentMargin(ChartPresenter::textMargin());
265 label->document()->setDocumentMargin(ChartPresenter::textMargin());
261 QGraphicsTextItem *title = titleItem();
262 arrow->setPen(axis()->linePen());
266 arrow->setPen(axis()->linePen());
263 grid->setPen(axis()->gridLinePen());
267 grid->setPen(axis()->gridLinePen());
264 label->setFont(axis()->labelsFont());
268 label->setFont(axis()->labelsFont());
265 label->setDefaultTextColor(axis()->labelsBrush().color());
269 label->setDefaultTextColor(axis()->labelsBrush().color());
266 label->setRotation(axis()->labelsAngle());
270 label->setRotation(axis()->labelsAngle());
267 title->setFont(axis()->titleFont());
268 title->setDefaultTextColor(axis()->titleBrush().color());
269 title->setHtml(axis()->titleText());
270 arrowGroup()->addToGroup(arrow);
271 arrowGroup()->addToGroup(arrow);
271 gridGroup()->addToGroup(grid);
272 gridGroup()->addToGroup(grid);
272 labelGroup()->addToGroup(label);
273 labelGroup()->addToGroup(label);
@@ -238,20 +238,21 void PolarChartAxisRadial::createItems(int count)
238 arrowGroup()->addToGroup(arrow);
238 arrowGroup()->addToGroup(arrow);
239 }
239 }
240
240
241 QGraphicsTextItem *title = titleItem();
242 title->setFont(axis()->titleFont());
243 title->setDefaultTextColor(axis()->titleBrush().color());
244 title->setHtml(axis()->titleText());
245
241 for (int i = 0; i < count; ++i) {
246 for (int i = 0; i < count; ++i) {
242 QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
247 QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
243 QGraphicsEllipseItem *grid = new QGraphicsEllipseItem(presenter()->rootItem());
248 QGraphicsEllipseItem *grid = new QGraphicsEllipseItem(presenter()->rootItem());
244 QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
249 QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
245 label->document()->setDocumentMargin(ChartPresenter::textMargin());
250 label->document()->setDocumentMargin(ChartPresenter::textMargin());
246 QGraphicsTextItem *title = titleItem();
247 arrow->setPen(axis()->linePen());
251 arrow->setPen(axis()->linePen());
248 grid->setPen(axis()->gridLinePen());
252 grid->setPen(axis()->gridLinePen());
249 label->setFont(axis()->labelsFont());
253 label->setFont(axis()->labelsFont());
250 label->setDefaultTextColor(axis()->labelsBrush().color());
254 label->setDefaultTextColor(axis()->labelsBrush().color());
251 label->setRotation(axis()->labelsAngle());
255 label->setRotation(axis()->labelsAngle());
252 title->setFont(axis()->titleFont());
253 title->setDefaultTextColor(axis()->titleBrush().color());
254 title->setHtml(axis()->titleText());
255 arrowGroup()->addToGroup(arrow);
256 arrowGroup()->addToGroup(arrow);
256 gridGroup()->addToGroup(grid);
257 gridGroup()->addToGroup(grid);
257 labelGroup()->addToGroup(label);
258 labelGroup()->addToGroup(label);
General Comments 0
You need to be logged in to leave comments. Login now