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

Method typeChanged

src/frontend/widgets/BackgroundWidget.cpp:178–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void BackgroundWidget::typeChanged(int index) {
179 if (index == -1)
180 return;
181
182 auto type = (Background::Type)index;
183
184 if (type == Background::Type::Color) {
185 ui.lColorStyle->show();
186 ui.cbColorStyle->show();
187 ui.lImageStyle->hide();
188 ui.cbImageStyle->hide();
189 ui.lBrushStyle->hide();
190 ui.cbBrushStyle->hide();
191
192 ui.lFileName->hide();
193 ui.leFileName->hide();
194 ui.bOpen->hide();
195
196 ui.lFirstColor->show();
197 ui.kcbFirstColor->show();
198
199 auto style = (Background::ColorStyle)ui.cbColorStyle->currentIndex();
200 if (style == Background::ColorStyle::SingleColor) {
201 ui.lFirstColor->setText(i18n("Color:"));
202 ui.lSecondColor->hide();
203 ui.kcbSecondColor->hide();
204 } else {
205 ui.lFirstColor->setText(i18n("First color:"));
206 ui.lSecondColor->show();
207 ui.kcbSecondColor->show();
208 }
209 } else if (type == Background::Type::Image) {
210 ui.lFirstColor->hide();
211 ui.kcbFirstColor->hide();
212 ui.lSecondColor->hide();
213 ui.kcbSecondColor->hide();
214
215 ui.lColorStyle->hide();
216 ui.cbColorStyle->hide();
217 ui.lImageStyle->show();
218 ui.cbImageStyle->show();
219 ui.lBrushStyle->hide();
220 ui.cbBrushStyle->hide();
221 ui.lFileName->show();
222 ui.leFileName->show();
223 ui.bOpen->show();
224 } else if (type == Background::Type::Pattern) {
225 ui.lFirstColor->setText(i18n("Color:"));
226 ui.lFirstColor->show();
227 ui.kcbFirstColor->show();
228 ui.lSecondColor->hide();
229 ui.kcbSecondColor->hide();
230
231 ui.lColorStyle->hide();
232 ui.cbColorStyle->hide();
233 ui.lImageStyle->hide();
234 ui.cbImageStyle->hide();
235 ui.lBrushStyle->show();

Callers

nothing calls this directly

Calls 4

showMethod · 0.80
currentIndexMethod · 0.45
setTextMethod · 0.45
setTypeMethod · 0.45

Tested by

no test coverage detected