Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we include Reinit() inside of the constructor? #577

Closed
shaomeng opened this issue Mar 22, 2018 · 1 comment
Closed

Should we include Reinit() inside of the constructor? #577

shaomeng opened this issue Mar 22, 2018 · 1 comment

Comments

@shaomeng
Copy link
Collaborator

shaomeng commented Mar 22, 2018

The following code snippet shows the constructor of TFWidget.

TFWidget::TFWidget(QWidget* parent)
: QWidget(parent), Ui_TFWidgetGUI() {
setupUi(this);
_myRGB[0] = _myRGB[1] = _myRGB[2] = 1.f;
_minCombo = new Combo(minRangeEdit, minRangeSlider);
_maxCombo = new Combo(maxRangeEdit, maxRangeSlider);
_rangeCombo = new RangeCombo(_minCombo, _maxCombo);
connectWidgets();
}

In practice, one has to always call a Reinit() function of the TFWidget immediately after its construction. Failing to do so will result in a crash. Given this behavior, does it make more sense to include a function call of Reinit() inside of the constructor?

@shaomeng
Copy link
Collaborator Author

shaomeng commented Apr 3, 2018

To clarify, currently I need to do the following to construct a TFWidget:

TFWidget* tf = new TFWidget();
tf->Reinit();

If we were to adopt my feedback, I will only need the following to construct a TFWidget:

TFWidget* tf = new TFWidget();

@clyne clyne added the Fixed label Dec 27, 2021
@clyne clyne closed this as completed Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants