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

Method addDataColumn

src/frontend/dockwidgets/LollipopPlotDock.cpp:282–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282void LollipopPlotDock::addDataColumn() {
283 auto* cb = new TreeViewComboBox(this);
284
285 static const QList<AspectType> list{AspectType::Folder,
286 AspectType::Workbook,
287 AspectType::Datapicker,
288 AspectType::DatapickerCurve,
289 AspectType::Spreadsheet,
290 AspectType::LiveDataSource,
291 AspectType::Column,
292 AspectType::Worksheet,
293 AspectType::CartesianPlot,
294 AspectType::XYFitCurve,
295 AspectType::XYSmoothCurve,
296 AspectType::Notebook};
297 cb->setTopLevelClasses(list);
298 cb->setModel(aspectModel());
299 connect(cb, &TreeViewComboBox::currentModelIndexChanged, this, &LollipopPlotDock::dataColumnChanged);
300
301 int index = m_dataComboBoxes.size();
302
303 if (index == 0) {
304 QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
305 sizePolicy1.setHorizontalStretch(0);
306 sizePolicy1.setVerticalStretch(0);
307 sizePolicy1.setHeightForWidth(cb->sizePolicy().hasHeightForWidth());
308 cb->setSizePolicy(sizePolicy1);
309 } else {
310 auto* button = new QPushButton();
311 button->setIcon(QIcon::fromTheme(QStringLiteral("list-remove")));
312 connect(button, &QPushButton::clicked, this, &LollipopPlotDock::removeDataColumn);
313 m_gridLayout->addWidget(button, index, 1, 1, 1);
314 m_removeButtons << button;
315 }
316
317 m_gridLayout->addWidget(cb, index, 0, 1, 1);
318 m_gridLayout->addWidget(m_buttonNew, index + 1, 1, 1, 1);
319
320 m_dataComboBoxes << cb;
321 ui.lDataColumn->setText(i18n("Columns:"));
322}
323
324void LollipopPlotDock::removeDataColumn() {
325 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