开发者

valueChanged of doubleSpinBox not working

//in my .h file i have:
void on_doubleSpinBox_test_valueChanged(double t);

//in my .cpp(mainwindow):
void MainWindow::on_doubleSpinBox_test_valueChanged(double t)
{
    ui->lineEdit_test->setText(QString::number((double) t/2));
}

My problem is that when i set the value for lineEdit in SpinBox everything works, however in doubleSpinBox there is no message se开发者_如何转开发nt (changing value doesn't work). What am i doing wrong? How to make this method to work?


The valueFromText and textFromValue methods might do what you want. They allow displaying the value of the spin box in a customized format, such as always displaying half the value of the spin box as in your code above.

http://doc.trolltech.com/4.7/qdoublespinbox.html#valueFromText http://doc.trolltech.com/4.7/qdoublespinbox.html#textFromValue

A sample of how to use the methods is in the class QSpinBox and they are used the same in QDoubleSpinBox. http://doc.trolltech.com/4.7/qspinbox.html#subclassing-qspinbox

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜