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