C++ (Qt) ui->spinBox->lineEdit();
C++ (Qt) SpinBox::SpinBox(QWidget*parent):QSpinBox(parent){ connect(this,SIGNAL(valueChange(int)),this,SLOT(setValueHex(int)));} void SpinBox::setValueHex(int value){ QLineEdit *le = lineEdit(); le->setText("0xFF");}
C++ (Qt)SpinBox::SpinBox(QWidget*parent):QSpinBox(parent){ le = lineEdit(); connect(le,SIGNAL(textChange(QString)),this,SLOT(setValueHex(QString))); connect(this,SIGNAL(valueChange(int)),this,SLOT(setValueHex1(int))); } void SpinBox::setValueHex(QString value){ QLineEdit *le = lineEdit(); le->setText("0xFF");} void SpinBox::setValueHex1(int value){ QLineEdit *le = lineEdit(); le->setText("0xFF");}
virtual QString textFromValue ( int value ) constvirtual int valueFromText ( const QString & text ) const
C++ (Qt)QString MySpinBox::textFromValue(int val) const{ QString str = QVariant(val).toString(); if(val<16){ return "0x0" + str.number(val,16); } return "0x" + str.number(val,16);} int SpinBox::valueFromText(const QString &text) const { return text.toInt();}