Important: Please read the Qt Code of Conduct -

Accept user input using Spinbox

  • Hi,
    I'm developing an application which consists of a Spinbox, Push_button and lineEdit.

    The user has to enter an integer value between 3 and 50 using the Spinbox and press the Push_button. When the Push_button is pressed, QT calls a C code and passes to it as argument the value in Spinbox. Once the C code has run, the result gets displayed in lineEdit.

    How should I configure Push_button so as to capture the value in Spinbox? Right clicking Spinbox > 'Go to slot' shows signals such as Valuechanged(int) and (string). Is that the way to go?

    Please help.

  • Qt Champions 2017

    You need to connect the pushbutton clicked() signal with your slot


    void MyWidget::myslot() {
    int val = spinBox->value().

    I suggest you read the signal and slots of pushbutton. Look at how to write slots.

Log in to reply