File indexing completed on 2024-05-26 04:25:02
0001 /* This file is part of the KDE libraries 0002 * Initial implementation: 0003 * Copyright (c) 1997 Patrick Dowler <dowler@morgul.fsh.uvic.ca> 0004 * Rewritten and maintained by: 0005 * Copyright (c) 2000 Dirk Mueller <mueller@kde.org> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 */ 0022 0023 #include "kpNumInput.h" 0024 0025 #include <cmath> 0026 0027 #include <QApplication> 0028 #include <QDebug> 0029 #include <QLabel> 0030 #include <QResizeEvent> 0031 #include <QSlider> 0032 #include <QStyle> 0033 0034 #include <KLocalizedString> 0035 0036 static inline int calcDiffByTen(int x, int y) 0037 { 0038 // calculate ( x - y ) / 10 without overflowing ints: 0039 return (x / 10) - (y / 10) + (x % 10 - y % 10) / 10; 0040 } 0041 0042 // ---------------------------------------------------------------------------- 0043 0044 class kpNumInputPrivate 0045 { 0046 public: 0047 explicit kpNumInputPrivate(kpNumInput *q) : 0048 q(q), 0049 column1Width(0), 0050 column2Width(0), 0051 label(nullptr), 0052 slider(nullptr), 0053 labelAlignment() 0054 { 0055 } 0056 0057 static kpNumInputPrivate *get(const kpNumInput *i) 0058 { 0059 return i->d; 0060 } 0061 0062 kpNumInput *q; 0063 int column1Width, column2Width; 0064 0065 QLabel *label; 0066 QSlider *slider; 0067 QSize sliderSize, labelSize; 0068 0069 Qt::Alignment labelAlignment; 0070 }; 0071 0072 #define K_USING_kpNumInput_P(_d) kpNumInputPrivate *_d = kpNumInputPrivate::get(this) 0073 0074 kpNumInput::kpNumInput(QWidget *parent) 0075 : QWidget(parent), d(new kpNumInputPrivate(this)) 0076 { 0077 setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); 0078 setFocusPolicy(Qt::StrongFocus); 0079 } 0080 0081 kpNumInput::~kpNumInput() 0082 { 0083 delete d; 0084 } 0085 0086 QSlider *kpNumInput::slider() const 0087 { 0088 return d->slider; 0089 } 0090 0091 bool kpNumInput::showSlider() const 0092 { 0093 return d->slider; 0094 } 0095 0096 void kpNumInput::setLabel(const QString &label, Qt::Alignment a) 0097 { 0098 if (label.isEmpty()) { 0099 delete d->label; 0100 d->label = nullptr; 0101 d->labelAlignment = {}; 0102 } else { 0103 if (!d->label) { 0104 d->label = new QLabel(this); 0105 } 0106 d->label->setText(label); 0107 d->label->setObjectName(QStringLiteral("kpNumInput::QLabel")); 0108 d->label->setAlignment(a); 0109 // if no vertical alignment set, use Top alignment 0110 if (!(a & (Qt::AlignTop | Qt::AlignBottom | Qt::AlignVCenter))) { 0111 a |= Qt::AlignTop; 0112 } 0113 d->labelAlignment = a; 0114 } 0115 0116 layout(); 0117 } 0118 0119 QString kpNumInput::label() const 0120 { 0121 return d->label ? d->label->text() : QString(); 0122 } 0123 0124 void kpNumInput::layout() 0125 { 0126 // label sizeHint 0127 d->labelSize = (d->label ? d->label->sizeHint() : QSize(0, 0)); 0128 0129 if (d->label && (d->labelAlignment & Qt::AlignVCenter)) { 0130 d->column1Width = d->labelSize.width() + 4; 0131 } else { 0132 d->column1Width = 0; 0133 } 0134 0135 // slider sizeHint 0136 d->sliderSize = (d->slider ? d->slider->sizeHint() : QSize(0, 0)); 0137 0138 doLayout(); 0139 0140 } 0141 0142 QSize kpNumInput::sizeHint() const 0143 { 0144 return minimumSizeHint(); 0145 } 0146 0147 void kpNumInput::setSteps(int minor, int major) 0148 { 0149 if (d->slider) { 0150 d->slider->setSingleStep(minor); 0151 d->slider->setPageStep(major); 0152 } 0153 } 0154 0155 // ---------------------------------------------------------------------------- 0156 0157 class kpIntNumInput::kpIntNumInputPrivate 0158 { 0159 public: 0160 kpIntNumInput *q; 0161 QSpinBox *intSpinBox; 0162 QSize intSpinBoxSize; 0163 0164 explicit kpIntNumInputPrivate(kpIntNumInput *q) 0165 : q(q) {} 0166 }; 0167 0168 kpIntNumInput::kpIntNumInput(QWidget *parent) 0169 : kpNumInput(parent) 0170 , d(new kpIntNumInputPrivate(this)) 0171 { 0172 initWidget(0); 0173 } 0174 0175 kpIntNumInput::kpIntNumInput(int val, QWidget *parent) 0176 : kpNumInput(parent) 0177 , d(new kpIntNumInputPrivate(this)) 0178 { 0179 initWidget(val); 0180 } 0181 0182 QSpinBox *kpIntNumInput::spinBox() const 0183 { 0184 return d->intSpinBox; 0185 } 0186 0187 void kpIntNumInput::initWidget(int val) 0188 { 0189 d->intSpinBox = new QSpinBox(this); 0190 d->intSpinBox->setRange(INT_MIN, INT_MAX); 0191 d->intSpinBox->setSingleStep(1); 0192 d->intSpinBox->setValue(val); 0193 d->intSpinBox->setObjectName(QStringLiteral("kpIntNumInput::QSpinBox")); 0194 0195 connect(d->intSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &kpIntNumInput::spinValueChanged); 0196 0197 setFocusProxy(d->intSpinBox); 0198 layout(); 0199 } 0200 0201 void kpIntNumInput::spinValueChanged(int val) 0202 { 0203 K_USING_kpNumInput_P(priv); 0204 0205 if (priv->slider) { 0206 priv->slider->setValue(val); 0207 } 0208 0209 Q_EMIT valueChanged(val); 0210 } 0211 0212 void kpIntNumInput::setRange(int lower, int upper, int singleStep) 0213 { 0214 if (upper < lower || singleStep <= 0) { 0215 qDebug() << "WARNING: kpIntNumInput::setRange() called with bad arguments. Ignoring call..."; 0216 return; 0217 } 0218 0219 d->intSpinBox->setMinimum(lower); 0220 d->intSpinBox->setMaximum(upper); 0221 d->intSpinBox->setSingleStep(singleStep); 0222 0223 singleStep = d->intSpinBox->singleStep(); // maybe QRangeControl didn't like our lineStep? 0224 0225 layout(); 0226 0227 // update slider information 0228 K_USING_kpNumInput_P(priv); 0229 if (!priv->slider) { 0230 priv->slider = new QSlider(Qt::Horizontal, this); 0231 connect(priv->slider, &QSlider::valueChanged, 0232 d->intSpinBox, &QSpinBox::setValue); 0233 priv->slider->setTickPosition(QSlider::TicksBelow); 0234 layout(); 0235 } 0236 0237 const int value = d->intSpinBox->value(); 0238 priv->slider->setRange(d->intSpinBox->minimum(), d->intSpinBox->maximum()); 0239 priv->slider->setPageStep(d->intSpinBox->singleStep()); 0240 priv->slider->setValue(value); 0241 // calculate (upper-lower)/10 without overflowing int's: 0242 const int major = calcDiffByTen(d->intSpinBox->maximum(), d->intSpinBox->minimum()); 0243 0244 priv->slider->setSingleStep(d->intSpinBox->singleStep()); 0245 priv->slider->setPageStep(qMax(1, major)); 0246 priv->slider->setTickInterval(major); 0247 } 0248 0249 void kpIntNumInput::setMinimum(int min) 0250 { 0251 setRange(min, d->intSpinBox->maximum(), d->intSpinBox->singleStep()); 0252 } 0253 0254 int kpIntNumInput::minimum() const 0255 { 0256 return d->intSpinBox->minimum(); 0257 } 0258 0259 void kpIntNumInput::setMaximum(int max) 0260 { 0261 setRange(d->intSpinBox->minimum(), max, d->intSpinBox->singleStep()); 0262 } 0263 0264 int kpIntNumInput::maximum() const 0265 { 0266 return d->intSpinBox->maximum(); 0267 } 0268 0269 int kpIntNumInput::singleStep() const 0270 { 0271 return d->intSpinBox->singleStep(); 0272 } 0273 0274 void kpIntNumInput::setSingleStep(int singleStep) 0275 { 0276 d->intSpinBox->setSingleStep(singleStep); 0277 } 0278 0279 void kpIntNumInput::setSuffix(const QString &suffix) 0280 { 0281 d->intSpinBox->setSuffix(suffix); 0282 0283 layout(); 0284 } 0285 0286 QString kpIntNumInput::suffix() const 0287 { 0288 return d->intSpinBox->suffix(); 0289 } 0290 0291 void kpIntNumInput::setEditFocus(bool mark) 0292 { 0293 if (mark) 0294 { 0295 d->intSpinBox->setFocus(); 0296 } 0297 } 0298 0299 QSize kpIntNumInput::minimumSizeHint() const 0300 { 0301 K_USING_kpNumInput_P(priv); 0302 ensurePolished(); 0303 0304 int w; 0305 int h; 0306 0307 h = qMax(d->intSpinBoxSize.height(), priv->sliderSize.height()); 0308 0309 // if in extra row, then count it here 0310 if (priv->label && (priv->labelAlignment & (Qt::AlignBottom | Qt::AlignTop))) { 0311 h += 4 + priv->labelSize.height(); 0312 } else { 0313 // label is in the same row as the other widgets 0314 h = qMax(h, priv->labelSize.height() + 2); 0315 } 0316 0317 w = priv->slider ? priv->slider->sizeHint().width() : 0; 0318 w += priv->column1Width + priv->column2Width; 0319 0320 if (priv->labelAlignment & (Qt::AlignTop | Qt::AlignBottom)) { 0321 w = qMax(w, priv->labelSize.width() + 4); 0322 } 0323 0324 return {w, h}; 0325 } 0326 0327 void kpIntNumInput::doLayout() 0328 { 0329 K_USING_kpNumInput_P(priv); 0330 0331 d->intSpinBoxSize = d->intSpinBox->sizeHint(); 0332 priv->column2Width = d->intSpinBoxSize.width(); 0333 0334 if (priv->label) { 0335 priv->label->setBuddy(d->intSpinBox); 0336 } 0337 } 0338 0339 void kpIntNumInput::resizeEvent(QResizeEvent *e) 0340 { 0341 K_USING_kpNumInput_P(priv); 0342 0343 int w = priv->column1Width; 0344 int h = 0; 0345 const int spacingHint = 0;//style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); 0346 0347 if (priv->label && (priv->labelAlignment & Qt::AlignTop)) { 0348 priv->label->setGeometry(0, 0, e->size().width(), priv->labelSize.height()); 0349 h += priv->labelSize.height() + spacingHint; 0350 } 0351 0352 if (priv->label && (priv->labelAlignment & Qt::AlignVCenter)) { 0353 priv->label->setGeometry(0, 0, w, d->intSpinBoxSize.height()); 0354 } 0355 0356 if (qApp->layoutDirection() == Qt::RightToLeft) { 0357 d->intSpinBox->setGeometry(w, h, priv->slider ? priv->column2Width : qMax(priv->column2Width, e->size().width() - w), d->intSpinBoxSize.height()); 0358 w += priv->column2Width + spacingHint; 0359 0360 if (priv->slider) { 0361 priv->slider->setGeometry(w, h, e->size().width() - w, d->intSpinBoxSize.height() + spacingHint); 0362 } 0363 } else if (priv->slider) { 0364 priv->slider->setGeometry(w, h, e->size().width() - (w + priv->column2Width + spacingHint), d->intSpinBoxSize.height() + spacingHint); 0365 d->intSpinBox->setGeometry(w + priv->slider->size().width() + spacingHint, h, priv->column2Width, d->intSpinBoxSize.height()); 0366 } else { 0367 d->intSpinBox->setGeometry(w, h, qMax(priv->column2Width, e->size().width() - w), d->intSpinBoxSize.height()); 0368 } 0369 0370 h += d->intSpinBoxSize.height() + 2; 0371 0372 if (priv->label && (priv->labelAlignment & Qt::AlignBottom)) { 0373 priv->label->setGeometry(0, h, priv->labelSize.width(), priv->labelSize.height()); 0374 } 0375 } 0376 0377 kpIntNumInput::~kpIntNumInput() 0378 { 0379 delete d; 0380 } 0381 0382 void kpIntNumInput::setValue(int val) 0383 { 0384 d->intSpinBox->setValue(val); 0385 // slider value is changed by spinValueChanged 0386 } 0387 0388 int kpIntNumInput::value() const 0389 { 0390 return d->intSpinBox->value(); 0391 } 0392 0393 void kpIntNumInput::setSpecialValueText(const QString &text) 0394 { 0395 d->intSpinBox->setSpecialValueText(text); 0396 layout(); 0397 } 0398 0399 QString kpIntNumInput::specialValueText() const 0400 { 0401 return d->intSpinBox->specialValueText(); 0402 } 0403 0404 void kpIntNumInput::setLabel(const QString &label, Qt::Alignment a) 0405 { 0406 K_USING_kpNumInput_P(priv); 0407 0408 kpNumInput::setLabel(label, a); 0409 0410 if (priv->label) { 0411 priv->label->setBuddy(d->intSpinBox); 0412 } 0413 } 0414 0415 // ---------------------------------------------------------------------------- 0416 0417 class kpDoubleNumInput::kpDoubleNumInputPrivate 0418 { 0419 public: 0420 kpDoubleNumInputPrivate() 0421 : spin(nullptr) {} 0422 QDoubleSpinBox *spin; 0423 QSize editSize; 0424 QString specialValue; 0425 }; 0426 0427 kpDoubleNumInput::kpDoubleNumInput(QWidget *parent) 0428 : kpNumInput(parent) 0429 , d(new kpDoubleNumInputPrivate()) 0430 0431 { 0432 initWidget(0.0, 0.0, 9999.0, 0.01, 2); 0433 } 0434 0435 kpDoubleNumInput::kpDoubleNumInput(double lower, double upper, double value, QWidget *parent, 0436 double singleStep, int precision) 0437 : kpNumInput(parent) 0438 , d(new kpDoubleNumInputPrivate()) 0439 { 0440 initWidget(value, lower, upper, singleStep, precision); 0441 } 0442 0443 kpDoubleNumInput::~kpDoubleNumInput() 0444 { 0445 delete d; 0446 } 0447 0448 QString kpDoubleNumInput::specialValueText() const 0449 { 0450 return d->specialValue; 0451 } 0452 0453 void kpDoubleNumInput::initWidget(double value, double lower, double upper, 0454 double singleStep, int precision) 0455 { 0456 d->spin = new QDoubleSpinBox(this); 0457 d->spin->setRange(lower, upper); 0458 d->spin->setSingleStep(singleStep); 0459 d->spin->setValue(value); 0460 d->spin->setDecimals(precision); 0461 0462 d->spin->setObjectName(QStringLiteral("kpDoubleNumInput::QDoubleSpinBox")); 0463 setFocusProxy(d->spin); 0464 connect(d->spin, QOverload<double>::of(&QDoubleSpinBox::valueChanged), 0465 this, &kpDoubleNumInput::valueChanged); 0466 0467 layout(); 0468 } 0469 0470 double kpDoubleNumInput::mapSliderToSpin(int val) const 0471 { 0472 K_USING_kpNumInput_P(priv); 0473 0474 // map [slidemin,slidemax] to [spinmin,spinmax] 0475 const double spinmin = d->spin->minimum(); 0476 const double spinmax = d->spin->maximum(); 0477 const double slidemin = priv->slider->minimum(); // cast int to double to avoid 0478 const double slidemax = priv->slider->maximum(); // overflow in rel denominator 0479 const double rel = (double(val) - slidemin) / (slidemax - slidemin); 0480 return spinmin + rel * (spinmax - spinmin); 0481 } 0482 0483 void kpDoubleNumInput::sliderMoved(int val) 0484 { 0485 d->spin->setValue(mapSliderToSpin(val)); 0486 } 0487 0488 void kpDoubleNumInput::spinBoxChanged(double val) 0489 { 0490 K_USING_kpNumInput_P(priv); 0491 0492 const double spinmin = d->spin->minimum(); 0493 const double spinmax = d->spin->maximum(); 0494 const double slidemin = priv->slider->minimum(); // cast int to double to avoid 0495 const double slidemax = priv->slider->maximum(); // overflow in rel denominator 0496 0497 const double rel = (val - spinmin) / (spinmax - spinmin); 0498 0499 if (priv->slider) { 0500 priv->slider->blockSignals(true); 0501 priv->slider->setValue(qRound(slidemin + rel * (slidemax - slidemin))); 0502 priv->slider->blockSignals(false); 0503 } 0504 } 0505 0506 QSize kpDoubleNumInput::minimumSizeHint() const 0507 { 0508 K_USING_kpNumInput_P(priv); 0509 0510 ensurePolished(); 0511 0512 int w; 0513 int h; 0514 0515 h = qMax(d->editSize.height(), priv->sliderSize.height()); 0516 0517 // if in extra row, then count it here 0518 if (priv->label && (priv->labelAlignment & (Qt::AlignBottom | Qt::AlignTop))) { 0519 h += 4 + priv->labelSize.height(); 0520 } else { 0521 // label is in the same row as the other widgets 0522 h = qMax(h, priv->labelSize.height() + 2); 0523 } 0524 0525 const int spacingHint = 0;//style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); 0526 w = priv->slider ? priv->slider->sizeHint().width() + spacingHint : 0; 0527 w += priv->column1Width + priv->column2Width; 0528 0529 if (priv->labelAlignment & (Qt::AlignTop | Qt::AlignBottom)) { 0530 w = qMax(w, priv->labelSize.width() + 4); 0531 } 0532 0533 return {w, h}; 0534 } 0535 0536 void kpDoubleNumInput::resizeEvent(QResizeEvent *e) 0537 { 0538 K_USING_kpNumInput_P(priv); 0539 0540 int w = priv->column1Width; 0541 int h = 0; 0542 const int spacingHint = 0;//style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); 0543 0544 if (priv->label && (priv->labelAlignment & Qt::AlignTop)) { 0545 priv->label->setGeometry(0, 0, e->size().width(), priv->labelSize.height()); 0546 h += priv->labelSize.height() + 4; 0547 } 0548 0549 if (priv->label && (priv->labelAlignment & Qt::AlignVCenter)) { 0550 priv->label->setGeometry(0, 0, w, d->editSize.height()); 0551 } 0552 0553 if (qApp->layoutDirection() == Qt::RightToLeft) { 0554 d->spin->setGeometry(w, h, priv->slider ? priv->column2Width 0555 : e->size().width() - w, d->editSize.height()); 0556 w += priv->column2Width + spacingHint; 0557 0558 if (priv->slider) { 0559 priv->slider->setGeometry(w, h, e->size().width() - w, d->editSize.height() + spacingHint); 0560 } 0561 } else if (priv->slider) { 0562 priv->slider->setGeometry(w, h, e->size().width() - 0563 (priv->column1Width + priv->column2Width + spacingHint), 0564 d->editSize.height() + spacingHint); 0565 d->spin->setGeometry(w + priv->slider->width() + spacingHint, h, 0566 priv->column2Width, d->editSize.height()); 0567 } else { 0568 d->spin->setGeometry(w, h, e->size().width() - w, d->editSize.height()); 0569 } 0570 0571 h += d->editSize.height() + 2; 0572 0573 if (priv->label && (priv->labelAlignment & Qt::AlignBottom)) { 0574 priv->label->setGeometry(0, h, priv->labelSize.width(), priv->labelSize.height()); 0575 } 0576 } 0577 0578 void kpDoubleNumInput::doLayout() 0579 { 0580 K_USING_kpNumInput_P(priv); 0581 0582 d->editSize = d->spin->sizeHint(); 0583 priv->column2Width = d->editSize.width(); 0584 } 0585 0586 void kpDoubleNumInput::setValue(double val) 0587 { 0588 d->spin->setValue(val); 0589 } 0590 0591 void kpDoubleNumInput::setRange(double lower, double upper, double singleStep) 0592 { 0593 K_USING_kpNumInput_P(priv); 0594 0595 QDoubleSpinBox *spin = d->spin; 0596 0597 d->spin->setRange(lower, upper); 0598 d->spin->setSingleStep(singleStep); 0599 0600 const double range = spin->maximum() - spin->minimum(); 0601 const double steps = range * std::pow(10.0, spin->decimals()); 0602 if (!priv->slider) { 0603 priv->slider = new QSlider(Qt::Horizontal, this); 0604 priv->slider->setTickPosition(QSlider::TicksBelow); 0605 // feedback line: when one moves, the other moves, too: 0606 connect(priv->slider, &QSlider::valueChanged, 0607 this, &kpDoubleNumInput::sliderMoved); 0608 layout(); 0609 } 0610 if (steps > 1000 ) { 0611 priv->slider->setRange(0, 1000); 0612 priv->slider->setSingleStep(1); 0613 priv->slider->setPageStep(50); 0614 } else { 0615 const int singleSteps = qRound(steps); 0616 priv->slider->setRange(0, singleSteps); 0617 priv->slider->setSingleStep(1); 0618 const int pageSteps = qBound(1, singleSteps / 20, 10); 0619 priv->slider->setPageStep(pageSteps); 0620 } 0621 spinBoxChanged(spin->value()); 0622 connect(spin, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &kpDoubleNumInput::spinBoxChanged); 0623 0624 layout(); 0625 } 0626 0627 void kpDoubleNumInput::setMinimum(double min) 0628 { 0629 setRange(min, maximum(), d->spin->singleStep()); 0630 } 0631 0632 double kpDoubleNumInput::minimum() const 0633 { 0634 return d->spin->minimum(); 0635 } 0636 0637 void kpDoubleNumInput::setMaximum(double max) 0638 { 0639 setRange(minimum(), max, d->spin->singleStep()); 0640 } 0641 0642 double kpDoubleNumInput::maximum() const 0643 { 0644 return d->spin->maximum(); 0645 } 0646 0647 double kpDoubleNumInput::singleStep() const 0648 { 0649 return d->spin->singleStep(); 0650 } 0651 0652 void kpDoubleNumInput::setSingleStep(double singleStep) 0653 { 0654 d->spin->setSingleStep(singleStep); 0655 } 0656 0657 double kpDoubleNumInput::value() const 0658 { 0659 return d->spin->value(); 0660 } 0661 0662 QString kpDoubleNumInput::suffix() const 0663 { 0664 return d->spin->suffix(); 0665 } 0666 0667 void kpDoubleNumInput::setSuffix(const QString &suffix) 0668 { 0669 d->spin->setSuffix(suffix); 0670 0671 layout(); 0672 } 0673 0674 void kpDoubleNumInput::setDecimals(int decimals) 0675 { 0676 d->spin->setDecimals(decimals); 0677 0678 layout(); 0679 } 0680 0681 int kpDoubleNumInput::decimals() const 0682 { 0683 return d->spin->decimals(); 0684 } 0685 0686 void kpDoubleNumInput::setSpecialValueText(const QString &text) 0687 { 0688 d->spin->setSpecialValueText(text); 0689 0690 layout(); 0691 } 0692 0693 void kpDoubleNumInput::setLabel(const QString &label, Qt::Alignment a) 0694 { 0695 K_USING_kpNumInput_P(priv); 0696 0697 kpNumInput::setLabel(label, a); 0698 0699 if (priv->label) { 0700 priv->label->setBuddy(d->spin); 0701 } 0702 } 0703 0704 #include "moc_kpNumInput.cpp"