| 311 | } |
| 312 | |
| 313 | void BarPlotDock::addDataColumn() { |
| 314 | auto* cb = new TreeViewComboBox(this); |
| 315 | cb->setTopLevelClasses(TreeViewComboBox::plotColumnTopLevelClasses()); |
| 316 | cb->setModel(aspectModel()); |
| 317 | connect(cb, &TreeViewComboBox::currentModelIndexChanged, this, &BarPlotDock::dataColumnChanged); |
| 318 | |
| 319 | const int index = m_dataComboBoxes.size(); |
| 320 | |
| 321 | if (index == 0) { |
| 322 | QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred); |
| 323 | sizePolicy1.setHorizontalStretch(0); |
| 324 | sizePolicy1.setVerticalStretch(0); |
| 325 | sizePolicy1.setHeightForWidth(cb->sizePolicy().hasHeightForWidth()); |
| 326 | cb->setSizePolicy(sizePolicy1); |
| 327 | } else { |
| 328 | auto* button = new QPushButton(); |
| 329 | button->setIcon(QIcon::fromTheme(QStringLiteral("list-remove"))); |
| 330 | connect(button, &QPushButton::clicked, this, &BarPlotDock::removeDataColumn); |
| 331 | m_gridLayout->addWidget(button, index, 1, 1, 1); |
| 332 | m_removeButtons << button; |
| 333 | } |
| 334 | |
| 335 | m_gridLayout->addWidget(cb, index, 0, 1, 1); |
| 336 | m_gridLayout->addWidget(m_buttonNew, index + 1, 1, 1, 1); |
| 337 | |
| 338 | m_dataComboBoxes << cb; |
| 339 | ui.lDataColumn->setText(i18n("Columns:")); |
| 340 | } |
| 341 | |
| 342 | void BarPlotDock::removeDataColumn() { |
| 343 | auto* sender = static_cast<QPushButton*>(QObject::sender()); |
nothing calls this directly
no test coverage detected