Qt setChecked() takes a boolean argument
This commit is contained in:
+4
-5
@@ -559,7 +559,7 @@ void NetHackQtMenuWindow::AddRow(int row, const MenuItem& mi)
|
|||||||
|
|
||||||
// Check box, set if pre-selected
|
// Check box, set if pre-selected
|
||||||
QCheckBox *cb = new QCheckBox();
|
QCheckBox *cb = new QCheckBox();
|
||||||
cb->setChecked(mi.preselected ? Qt::Checked : Qt::Unchecked);
|
cb->setChecked(mi.preselected);
|
||||||
cb->setFocusPolicy(Qt::NoFocus);
|
cb->setFocusPolicy(Qt::NoFocus);
|
||||||
// CheckboxClicked() will call ToggleSelect() for item whose checkbox
|
// CheckboxClicked() will call ToggleSelect() for item whose checkbox
|
||||||
// gets clicked upon
|
// gets clicked upon
|
||||||
@@ -760,7 +760,7 @@ void NetHackQtMenuWindow::All()
|
|||||||
}
|
}
|
||||||
QCheckBox *cb = dynamic_cast<QCheckBox *> (table->cellWidget(row, 1));
|
QCheckBox *cb = dynamic_cast<QCheckBox *> (table->cellWidget(row, 1));
|
||||||
if (cb != NULL) {
|
if (cb != NULL) {
|
||||||
cb->setChecked(Qt::Checked);
|
cb->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (biggestcount > 0L) { // had one or more counts
|
if (biggestcount > 0L) { // had one or more counts
|
||||||
@@ -864,8 +864,7 @@ void NetHackQtMenuWindow::ToggleSelect(int row, bool already_toggled)
|
|||||||
QTableWidgetItem *countfield = table->item(row, 0);
|
QTableWidgetItem *countfield = table->item(row, 0);
|
||||||
if (!counting) {
|
if (!counting) {
|
||||||
if (!already_toggled)
|
if (!already_toggled)
|
||||||
cb->setChecked((cb->checkState() == Qt::Unchecked) // toggle
|
cb->setChecked((cb->checkState() == Qt::Unchecked)); // toggle
|
||||||
? Qt::Checked : Qt::Unchecked);
|
|
||||||
itemlist[row].selected = (cb->checkState() != Qt::Unchecked);
|
itemlist[row].selected = (cb->checkState() != Qt::Unchecked);
|
||||||
if (countfield != NULL)
|
if (countfield != NULL)
|
||||||
countfield->setText("");
|
countfield->setText("");
|
||||||
@@ -885,7 +884,7 @@ void NetHackQtMenuWindow::ToggleSelect(int row, bool already_toggled)
|
|||||||
// [maybe not necessary since unlike tty menus, count is visible]
|
// [maybe not necessary since unlike tty menus, count is visible]
|
||||||
|
|
||||||
// uncheck if count is explicitly 0, otherwise check
|
// uncheck if count is explicitly 0, otherwise check
|
||||||
cb->setChecked((amt > 0L) ? Qt::Checked : Qt::Unchecked);
|
cb->setChecked((amt > 0L));
|
||||||
itemlist[row].selected = (cb->checkState() != Qt::Unchecked);
|
itemlist[row].selected = (cb->checkState() != Qt::Unchecked);
|
||||||
|
|
||||||
// if this count is larger than the biggest we've seen
|
// if this count is larger than the biggest we've seen
|
||||||
|
|||||||
Reference in New Issue
Block a user