Assign doubleSpinBox value to a variable in order to write them down in a txt file



  • Hello, first of all I have to admit that I'm a newbie in Qt programming. I'm trying to make a simple program to write values given by a user to a .txt file. My idea is to use doubleSpinBox to set the values and by pressing a button the value of the box will be assigned to a variable. Then, the variables will be writen using traditional C methods to a file. I'm facing a difficulty in writing the right command to do this. I use

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

    right after MainWIndow class in mainwindow.cpp file. But nothing happens. What I'm doing wrong? I know I have to use Signals and Slots in order to do this, but again I'm a newbie. Any kind of help/hint appreciated.

    Regards


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I would recommend you to first go through the tutorials and examples from Qt's documentation in order get a grasp of both signals and slots and Qt programming in general.

    For the file writing part you can use QFile so you get an all Qt solution.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.