Important: Please read the Qt Code of Conduct -

Will Creator allow me to connect a QspinBox signal to a private slot?

  • I've declared a private slot in the .h file, have the code for it in the .cpp file, and I'd like to tie the "changed" signal from a QspinBox to it. When I use Creator and the signal/slots editor at the bottom, I do find my spinbox listed as a sender and the changed signal as one of the possibles in the dropdown, but in the receiver list I do not find my private slot. Do I have to make such connections by hand? Or is there some way to use Creator to make said connections?

    thanks - greg

  • Hi,

    "visually" you can connect just signals and slot that you can see in the Signal/Slots editor, not your private ones.

    I can suggest you to call your private slot in the form reported by the documentation of QMetaObject::connectSlotsByName:


    So, if you call your private slots (suppose that your QSpinBox is called "mySpinBox")

    void on_mySpinBox_valueChanged(int i)

    it will be automatically connected when you perform the call "setupUi" in your constructor.

    Antonio Di Monaco

  • Antonio -

    Thanks for the reply... and bloody clever on the Qt developer's part.

    again, thanks - greg

Log in to reply