Skip to content

Commit

Permalink
add checks to qobject_casts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHal committed Jul 7, 2022
1 parent 8815c34 commit e43268a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions QtPMbrowser/DlgSelectParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ class DlgSelectParameters : public QDialog
std::array<PMparameter, Nrows>& ar)
{
for (int i = 0; i < int(ar.size()); ++i) {
ar[i].exportIBW = (qobject_cast<QCheckBox*>(grid->itemAtPosition(i, 0)->widget()))->isChecked();
ar[i].print = (qobject_cast<QCheckBox*>(grid->itemAtPosition(i, 1)->widget()))->isChecked();
auto chkExport = qobject_cast<QCheckBox*>(grid->itemAtPosition(i, 0)->widget());
assert(chkExport);
ar[i].exportIBW = chkExport->isChecked();
auto chkPrint = qobject_cast<QCheckBox*>(grid->itemAtPosition(i, 1)->widget());
assert(chkPrint);
ar[i].print = chkPrint->isChecked();
}
}

Expand Down

0 comments on commit e43268a

Please sign in to comment.