diff options
author | Michal Klocek <michal.klocek@digia.com> | 2012-04-02 18:06:06 +0300 |
---|---|---|
committer | Michal Klocek <michal.klocek@digia.com> | 2012-04-03 17:28:30 +0300 |
commit | e561e621da223902346d192b9e4c9a1f2e89da74 (patch) | |
tree | 0507c66fc74e27381cba2cfd4a8ef8af4c40466f /demos | |
parent | 61986556b7f4b69174c0732af2bdaef9890d07f1 (diff) |
Refactor qledgend handling
* rewrite some parts to fix the graphics artefacts
* remove button hadnling
* adds scroller
* adds layout managmnet to presenter
* fix issues of layout
Diffstat (limited to 'demos')
-rw-r--r-- | demos/chartthemes/themewidget.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/demos/chartthemes/themewidget.cpp b/demos/chartthemes/themewidget.cpp index bc3a68e7..90ef4cb3 100644 --- a/demos/chartthemes/themewidget.cpp +++ b/demos/chartthemes/themewidget.cpp @@ -60,6 +60,7 @@ ThemeWidget::ThemeWidget(QWidget* parent) : settingsLayout->addWidget(m_themeComboBox); settingsLayout->addWidget(new QLabel("Animation:")); settingsLayout->addWidget(m_animatedComboBox); + settingsLayout->addWidget(new QLabel("Legend:")); settingsLayout->addWidget(m_legendComboBox); settingsLayout->addWidget(m_antialiasCheckBox); settingsLayout->addStretch(); @@ -98,6 +99,7 @@ ThemeWidget::ThemeWidget(QWidget* parent) : // Set defaults m_antialiasCheckBox->setChecked(true); + updateUI(); } ThemeWidget::~ThemeWidget() @@ -164,7 +166,7 @@ QComboBox* ThemeWidget::createAnimationBox() const QComboBox* ThemeWidget::createLegendBox() const { QComboBox* legendComboBox = new QComboBox(); - legendComboBox->addItem("Legend None", -1); + legendComboBox->addItem("No Legend ", 0); legendComboBox->addItem("Legend Top", QLegend::AlignmentTop); legendComboBox->addItem("Legend Bottom", QLegend::AlignmentBottom); legendComboBox->addItem("Legend Left", QLegend::AlignmentLeft); @@ -355,17 +357,17 @@ void ThemeWidget::updateUI() chartView->chart()->setAnimationOptions(options); } - int alignment(m_legendComboBox->itemData(m_legendComboBox->currentIndex()).toInt()); - if (alignment == -1) { + QLegend::Alignments alignment(m_legendComboBox->itemData(m_legendComboBox->currentIndex()).toInt()); + + if (!alignment) { foreach (QChartView *chartView, m_charts) { - chartView->chart()->legend()->setVisible(false); + chartView->chart()->legend()->hide(); } - } else { - QLegend::Alignments legendAlignment(alignment); + } + else foreach (QChartView *chartView, m_charts) { - chartView->chart()->legend()->setAlignmnent(legendAlignment); - chartView->chart()->legend()->setVisible(true); + chartView->chart()->legend()->setAlignmnent(alignment); + chartView->chart()->legend()->show(); } - } } |