Clicked() signal triggered by return key when a spin box has focus

  • Hello all,

    I have a GUI that has many different widgets on it including mainly QPushButton, QDoubleSpinBox and QCheckBox. Basically i want the slot i set up associated with a clicked() signal from a push button to execute only when the button is pressed. However the behaviour i am getting is when say a spinner has focus and the return key is hit the same slot for the button is executed, suggesting to me that a clicked() signal has been triggered. Below is some test code which demonstrates this behaviour, it just has a button and a spinner on UI.

    @class TestForm : public QDialog {
    virtual ~TestForm();
    public slots:
    void Button_clicked();
    Ui::TestForm widget;

    @#include "TestForm.h"

    TestForm::TestForm() {
    // Connect to SLOT

    TestForm::~TestForm() {

    void TestForm::Button_clicked()

    What confuses me is that a spinner as far as i can see does not even have a clicked() signal? So my question is can i stop this behaviour in some way? I went down the road of mapping without any sucess.

    Any suggestions would be much appreciated. Cheers.

  • I had the button set to autoDefault = true.

    I see what you mean, probably should have read the documentation more closely.

    All sorted now, many thanks.

Log in to reply

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