// Usually this code goes in the MyDialog constructor; in Python, that's the _init_ method, I think
connect( mlButton, &QRadioButton:clicked, this, &MyDialog::onMLClicked );
// And say you also have a Calculate button, you connect its signal to your slot
connect( calculateBtn, &QPushButton::clicked, myDialog, &MyDialog::onCalculate );
// And the slots look like this
void MyDialog::onMLClicked( bool bChecked )
{
if ( bChecked )
mlToOz = true;
else
mlToOz = false;
}
void MyDialog::onCalculate()
{
if ( mlToOz )
// perform the ML -> OZ conversion of the value in the input line edit
else
// perform the OZ -> ML conversion
// and set the result (after formatting to a string) into the output line edit
}
// Usually this code goes in the MyDialog constructor; in Python, that's the _init_ method, I think
connect( mlButton, &QRadioButton:clicked, this, &MyDialog::onMLClicked );
// And say you also have a Calculate button, you connect its signal to your slot
connect( calculateBtn, &QPushButton::clicked, myDialog, &MyDialog::onCalculate );
// And the slots look like this
void MyDialog::onMLClicked( bool bChecked )
{
if ( bChecked )
mlToOz = true;
else
mlToOz = false;
}
void MyDialog::onCalculate()
{
if ( mlToOz )
// perform the ML -> OZ conversion of the value in the input line edit
else
// perform the OZ -> ML conversion
// and set the result (after formatting to a string) into the output line edit
}
To copy to clipboard, switch view to plain text mode
Bookmarks