##// END OF EJS Templates
Added option for disabling legend in chart theme demo
Tero Ahola -
r848:b8cca1720539
parent child
Show More
@@ -166,6 +166,7 QComboBox* ThemeWidget::createAnimationBox() const
166 QComboBox* ThemeWidget::createLegendBox() const
166 QComboBox* ThemeWidget::createLegendBox() const
167 {
167 {
168 QComboBox* legendComboBox = new QComboBox();
168 QComboBox* legendComboBox = new QComboBox();
169 legendComboBox->addItem("Legend None", -1);
169 legendComboBox->addItem("Legend Top", QLegend::AlignmentTop);
170 legendComboBox->addItem("Legend Top", QLegend::AlignmentTop);
170 legendComboBox->addItem("Legend Bottom", QLegend::AlignmentBottom);
171 legendComboBox->addItem("Legend Bottom", QLegend::AlignmentBottom);
171 legendComboBox->addItem("Legend Left", QLegend::AlignmentLeft);
172 legendComboBox->addItem("Legend Left", QLegend::AlignmentLeft);
@@ -356,9 +357,17 void ThemeWidget::updateUI()
356 chartView->chart()->setAnimationOptions(options);
357 chartView->chart()->setAnimationOptions(options);
357 }
358 }
358
359
359 QLegend::Alignments alignment(m_legendComboBox->itemData(m_legendComboBox->currentIndex()).toInt());
360 int alignment(m_legendComboBox->itemData(m_legendComboBox->currentIndex()).toInt());
360 foreach (QChartView *chartView, m_charts) {
361 if (alignment == -1) {
361 chartView->chart()->legend()->setAlignmnent(alignment);
362 foreach (QChartView *chartView, m_charts) {
363 chartView->chart()->legend()->setVisible(false);
364 }
365 } else {
366 QLegend::Alignments legendAlignment(alignment);
367 foreach (QChartView *chartView, m_charts) {
368 chartView->chart()->legend()->setAlignmnent(legendAlignment);
369 chartView->chart()->legend()->setVisible(true);
370 }
362 }
371 }
363 }
372 }
364
373
General Comments 0
You need to be logged in to leave comments. Login now