Qt之QSpinBox&QDoubleSpinBox

//显示整数
    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)

相关文章
相关标签/搜索