MCPcopy Create free account
hub / github.com/KDE/labplot / addDataColumn

Method addDataColumn

src/frontend/dockwidgets/BarPlotDock.cpp:313–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313void 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
342void BarPlotDock::removeDataColumn() {
343 auto* sender = static_cast<QPushButton*>(QObject::sender());

Callers

nothing calls this directly

Calls 5

setTopLevelClassesMethod · 0.80
setModelMethod · 0.45
sizeMethod · 0.45
setIconMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected