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

Syntax for QspinBox connection



  • For QPushButton named "pushButtonShow" we can create a slot with this syntax and we do not need to explicitly create the connect expression

    void on_pushButtonShow_clicked();
    

    what would be the similar syntax for QSpinBox value changed



  • @summit
    I would guess

    void on_nameOfSpinBox_valueChanged();
    

    because of void QSpinBox::valueChanged(int i).

    You are achieving this because of the behaviour of Qt Designer doing "auto-connects" of signals to slots based on what the widget is named and what the signal is named. This is generally considered inadvisable (e.g. try changing the name of your widget in Designer and see what happens),

    Despite the apparent convenience of this approach in Designer, most of us would suggest you simple do not use the signal/slot connection mechanism it offers and rather put the necessary connect() statements into your code explicitly instead.



  • @summit
    I would guess

    void on_nameOfSpinBox_valueChanged();
    

    because of void QSpinBox::valueChanged(int i).

    You are achieving this because of the behaviour of Qt Designer doing "auto-connects" of signals to slots based on what the widget is named and what the signal is named. This is generally considered inadvisable (e.g. try changing the name of your widget in Designer and see what happens),

    Despite the apparent convenience of this approach in Designer, most of us would suggest you simple do not use the signal/slot connection mechanism it offers and rather put the necessary connect() statements into your code explicitly instead.


Log in to reply