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

Method setColumns

src/frontend/spreadsheet/BatchEditValueLabelsDialog.cpp:68–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void BatchEditValueLabelsDialog::setColumns(const QList<Column*>& columns) {
69 m_columns = columns;
70
71 if (m_columns.isEmpty())
72 return;
73
74 m_column = m_columns.first();
75
76 // show the available value labels for the first columm
77 if (m_column->valueLabelsInitialized()) {
78 QString text;
79
80 switch (m_column->labelsMode()) {
81 case AbstractColumn::ColumnMode::Double: {
82 const auto* labels = m_column->valueLabels();
83 if (!labels)
84 return;
85 auto it = labels->constBegin();
86 while (it != labels->constEnd()) {
87 if (!text.isEmpty())
88 text += QLatin1Char('\n');
89 text += QString::number(it->value) + QLatin1String(" = ") + it->label;
90 ++it;
91 }
92 break;
93 }
94 case AbstractColumn::ColumnMode::Integer: {
95 const auto* labels = m_column->intValueLabels();
96 if (!labels)
97 return;
98 auto it = labels->constBegin();
99 while (it != labels->constEnd()) {
100 if (!text.isEmpty())
101 text += QLatin1Char('\n');
102 text += QString::number(it->value) + QLatin1String(" = ") + it->label;
103 ++it;
104 }
105 break;
106 }
107 case AbstractColumn::ColumnMode::BigInt: {
108 const auto* labels = m_column->bigIntValueLabels();
109 if (!labels)
110 return;
111 auto it = labels->constBegin();
112 while (it != labels->constEnd()) {
113 if (!text.isEmpty())
114 text += QLatin1Char('\n');
115 text += QString::number(it->value) + QLatin1String(" = ") + it->label;
116 ++it;
117 }
118 break;
119 }
120 case AbstractColumn::ColumnMode::Text: {
121 const auto* labels = m_column->textValueLabels();
122 if (!labels)
123 return;
124 auto it = labels->constBegin();
125 while (it != labels->constEnd()) {

Callers

nothing calls this directly

Calls 13

labelsModeMethod · 0.80
setPlaceholderTextMethod · 0.80
isEmptyMethod · 0.45
valueLabelsMethod · 0.45
intValueLabelsMethod · 0.45
bigIntValueLabelsMethod · 0.45
textValueLabelsMethod · 0.45
dateTimeValueLabelsMethod · 0.45
outputFilterMethod · 0.45
formatMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected