-1

I have promoted a QDoubleSpinBox to SumDoubleSpinBox.

I want to link now the click() event of a button to the spinBox , whenever the button is clicked the spinBox value should become 0.0.

In the QT editor using Edit Signals / Slots i am linking the click() event to setZero() slot of the SumDoubleSpinBox class.

class SumDoubleBox : public QDoubleSpinBox
{
    Q_OBJECT
public:
    using QDoubleSpinBox::QDoubleSpinBox;  // inherit c'tors

public slots:   

    void setZero();


private:
    double m_defaultStep = 1.0;
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void SumDoubleBox::setZero()
{
    QDoubleSpinBox::setValue(0.0);
}

Currently i am not able to set the spinbox value to 0.0

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97

1 Answers1

0

you have to add the widget to a layout i the QEditor and do something like

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->doubleSpinBox->setZero();/// HERE!
}
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97