문제

//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 sent (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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top