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

Method setType

src/backend/worksheet/plots/cartesian/CartesianPlot.cpp:190–402  ·  view source on GitHub ↗

! initializes all children of \c CartesianPlot and setups a default plot of type \c type with a plot title. */

Source from the content-addressed store, hash-verified

188 setups a default plot of type \c type with a plot title.
189*/
190void CartesianPlot::setType(Type type) {
191 Q_D(CartesianPlot);
192
193 d->type = type;
194
195 switch (type) {
196 case Type::FourAxes: {
197 // Axes
198
199 // x1
200 Axis* axis = new Axis(QLatin1String("x"), Axis::Orientation::Horizontal);
201 axis->setDefault(true);
202 axis->setSuppressRetransform(true);
203 addChild(axis);
204 axis->setPosition(Axis::Position::Bottom);
205 axis->setRange(0., 1.);
206 axis->setMajorTicksDirection(Axis::ticksIn);
207 axis->setMinorTicksDirection(Axis::ticksIn);
208 axis->setMinorTicksNumber(1);
209 axis->minorGridLine()->setStyle(Qt::NoPen);
210 axis->setSuppressRetransform(false);
211
212 // x2
213 axis = new Axis(QLatin1String("x2"), Axis::Orientation::Horizontal);
214 axis->title()->setText(QString());
215 axis->setDefault(true);
216 axis->setSuppressRetransform(true);
217 addChild(axis);
218 axis->setPosition(Axis::Position::Top);
219 axis->setRange(0., 1.);
220 axis->setMajorTicksDirection(Axis::noTicks);
221 axis->setMinorTicksDirection(Axis::noTicks);
222 axis->setMinorTicksNumber(1);
223 axis->majorGridLine()->setStyle(Qt::NoPen);
224 axis->minorGridLine()->setStyle(Qt::NoPen);
225 axis->setLabelsPosition(Axis::LabelsPosition::NoLabels);
226 axis->setSuppressRetransform(false);
227
228 // y1
229 axis = new Axis(QLatin1String("y"), Axis::Orientation::Vertical);
230 axis->setDefault(true);
231 axis->setSuppressRetransform(true);
232 addChild(axis);
233 axis->setPosition(Axis::Position::Left);
234 axis->setRange(0., 1.);
235 axis->setMajorTicksDirection(Axis::ticksIn);
236 axis->setMinorTicksDirection(Axis::ticksIn);
237 axis->setMinorTicksNumber(1);
238 axis->minorGridLine()->setStyle(Qt::NoPen);
239 axis->setSuppressRetransform(false);
240
241 // y2
242 axis = new Axis(QLatin1String("y2"), Axis::Orientation::Vertical);
243 axis->title()->setText(QString());
244 axis->setDefault(true);
245 axis->setSuppressRetransform(true);
246 addChild(axis);
247 axis->setPosition(Axis::Position::Right);

Callers

nothing calls this directly

Calls 15

QRectFClass · 0.85
setDefaultMethod · 0.80
setMinorTicksNumberMethod · 0.80
minorGridLineMethod · 0.80
majorGridLineMethod · 0.80
setLabelsPositionMethod · 0.80
setArrowTypeMethod · 0.80
setLogicalPositionMethod · 0.80
QStringClass · 0.50

Tested by

no test coverage detected