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

Method init

src/backend/worksheet/plots/cartesian/Axis.cpp:112–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void Axis::init(Orientation orientation, bool loading) {
113 Q_D(Axis);
114
115 // line
116 d->line = new Line(QStringLiteral("line"));
117 d->line->setHidden(true);
118 d->line->setCreateXmlElement(false); // line properties are written out together with arrow properties in Axis::save()
119 addChild(d->line);
120 connect(d->line, &Line::updatePixmapRequested, [=] {
121 d->update();
122 Q_EMIT changed();
123 });
124 connect(d->line, &Line::updateRequested, [=] {
125 d->recalcShapeAndBoundingRect();
126 });
127
128 // axis title
129 d->title = new TextLabel(this->name(), TextLabel::Type::AxisTitle);
130 d->title->setText(this->name());
131 connect(d->title, &TextLabel::changed, this, &Axis::labelChanged);
132 addChild(d->title);
133 d->title->setHidden(true);
134 d->title->graphicsItem()->setParentItem(d);
135 d->title->graphicsItem()->setFlag(QGraphicsItem::ItemIsMovable, false);
136 d->title->graphicsItem()->setFlag(QGraphicsItem::ItemIsFocusable, false);
137 d->title->graphicsItem()->setAcceptHoverEvents(false);
138
139 // major ticks line
140 d->majorTicksLine = new Line(QStringLiteral("majorTicksLine"));
141 d->majorTicksLine->setHidden(true);
142 d->majorTicksLine->setPrefix(QStringLiteral("MajorTicks"));
143 d->majorTicksLine->setCreateXmlElement(false);
144 addChild(d->majorTicksLine);
145 connect(d->majorTicksLine, &Line::updatePixmapRequested, [=] {
146 d->update();
147 Q_EMIT changed();
148 });
149 connect(d->majorTicksLine, &Line::updateRequested, [=] {
150 d->recalcShapeAndBoundingRect();
151 });
152
153 // minor ticks line
154 d->minorTicksLine = new Line(QStringLiteral("minorTicksLine"));
155 d->minorTicksLine->setHidden(true);
156 d->minorTicksLine->setPrefix(QStringLiteral("MinorTicks"));
157 d->minorTicksLine->setCreateXmlElement(false);
158 addChild(d->minorTicksLine);
159 connect(d->minorTicksLine, &Line::updatePixmapRequested, [=] {
160 d->update();
161 Q_EMIT changed();
162 });
163 connect(d->minorTicksLine, &Line::updateRequested, [=] {
164 d->recalcShapeAndBoundingRect();
165 });
166
167 // major grid line
168 d->majorGridLine = new Line(QStringLiteral("majorGridLine"));
169 d->majorGridLine->setPrefix(QStringLiteral("MajorGrid"));

Callers

nothing calls this directly

Calls 15

setCreateXmlElementMethod · 0.80
setAcceptHoverEventsMethod · 0.80
updateGridMethod · 0.80
retransformMajorGridMethod · 0.80
retransformMinorGridMethod · 0.80
retransformRangeMethod · 0.80
QFontClass · 0.50
QColorClass · 0.50
setHiddenMethod · 0.45
updateMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected