//显示整数
QSpinBox *spin = new QSpinBox(this);
spin->setMinimum(10);
spin->setMaximum(300);
spin->setPrefix("$ ");
spin->setValue(200); //设置默认值,必须在10-300之间,否则离10进就是10,离300进就是300
spin->setGeometry(10, 30, 100, 30);
QDoubleSpinBox * doublespin = new QDoubleSpinBox(this);
doublespin->setMinimum(10.0);
doublespin->setMaximum(300.0);
doublespin->setValue(50.5);
doublespin->setSuffix(" mm");
doublespin->setGeometry(30 + 110, 30, 100, 30);
//常用的信号:valueChanged(int),valueChanged(double)
Qt:QSpinBox&QDoubleSpinBox
最新推荐文章于 2022-12-13 21:39:40 发布