Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Using the value of a double spin box



  • Hello to all,

    I am using a doubleSpinBox in Qt designer. I want to get the value of this doubleSpinBox and use it directly in my code.How could this be done? Do I just need to use something like this?

    @ ui->doubleSpinBox->value();@



  • Signal-slot?



  • I do not want to use the value of doubleSpinBox every time the value is changed.I am using Qt designer and I just want to set the value, and then insert ths value in my code as a variable. Do I really need to use signal-slot? Could you be more specific?



  • [quote author="jk_mk" date="1307257128"]ui->doubleSpinBox->value();[/quote]

    QDoubleSpinBox has a value method, so you should be able to use it. So what is your problem? Have you tried the quoted code? Do you have issue with the protected/private inheritance?



  • Well, I have found my mistake. I am beginner in using Qt and I am not used in using signal and slots.So I am a little confused.But in my application, I give this signal and slot by pressing a button.As a result I am using this code and get the results every time I press this button.
    @
    ui->doubleSpinBox->value();@

    Thanks for your replies



  • Your welcome. If you consider your issue solved please set the thread so.


Log in to reply