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

Method strip

src/frontend/widgets/NumberSpinBox.cpp:231–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231QString NumberSpinBox::strip(const QString& t) const {
232 // Copied from QAbstractSpinBox.cpp
233 QStringView text(t);
234
235 int size = text.size();
236 const QString p = prefix();
237 const QString s = suffix();
238 bool changed = false;
239 int from = 0;
240 if (p.size() && text.startsWith(p)) {
241 from += p.size();
242 size -= from;
243 changed = true;
244 }
245 if (s.size() && text.endsWith(s)) {
246 size -= s.size();
247 changed = true;
248 }
249 if (changed)
250 text = text.mid(from, size);
251 text = text.trimmed();
252 return text.toString();
253}
254
255QString NumberSpinBox::textFromValue(double value) const {
256 Q_UNUSED(value);

Callers 1

rawreadFunction · 0.80

Calls 2

sizeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected