| 91 | } |
| 92 | |
| 93 | void MainWindow::initAddLegendDialog(DerivedAddLegendDialog &conf, |
| 94 | Qt::Alignment alignment) const |
| 95 | { |
| 96 | conf.titleTextED->setFocus(); |
| 97 | |
| 98 | // Note: Legend position can be Floating but it can not be Center |
| 99 | const QStringList labels = KDChart::Position::printableNames(KDChart::Position::IncludeFloating); |
| 100 | const QList<QByteArray> names = KDChart::Position::names(KDChart::Position::IncludeFloating); |
| 101 | |
| 102 | for (int i = 0, end = qMin(labels.size(), names.size()); i != end; ++i) |
| 103 | conf.positionCO->addItem(labels[i], names[i]); |
| 104 | |
| 105 | QMap<Qt::Alignment, QString>::const_iterator it = alignmentMap.constBegin(); |
| 106 | while (it != alignmentMap.constEnd()) { |
| 107 | conf.alignmentCO->addItem(it.value()); |
| 108 | ++it; |
| 109 | } |
| 110 | const int idx = conf.alignmentCO->findText(alignmentMap[alignment]); |
| 111 | if (idx > -1) |
| 112 | conf.alignmentCO->setCurrentIndex(idx); |
| 113 | } |
| 114 | |
| 115 | void MainWindow::on_addLegendPB_clicked() |
| 116 | { |