Skip to content

Commit

Permalink
Revert "CheckBox behavior"
Browse files Browse the repository at this point in the history
  • Loading branch information
XRay3D authored Mar 8, 2024
1 parent a65c200 commit 9876c3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 3 additions & 7 deletions plugins/gcode/drill/drill_form.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,16 @@ void Form::initToolTable() {
ui->toolTable->setVerticalHeader(header);
checkBox = new QCheckBox(cornerButton);
checkBox->setFocusPolicy(Qt::NoFocus);
checkBox->setGeometry(Header::getRect(cornerButton->rect()) /*.translated(1, -4)*/);
connect(checkBox, &QCheckBox::clicked, [this](bool checked) {
Qt::CheckState state = header->checkBoxState;
header->setAll(checked ? (state == Qt::Unchecked ? 1 : 0) : 0);
});
checkBox->setGeometry(Header::getRect(cornerButton->rect()) /*.translated(1, -4)*/);
connect(checkBox, &QCheckBox::clicked, [this](bool checked) { header->setAll(checked); });
connect(header, &Header::onChecked, [this](int idx) {
if (model) {
int fl {};
for (int i {}; i < model->rowCount(); ++i)
if (model->useForCalc(i))
++fl;

header->checkBoxState = !fl ? Qt::Unchecked : (fl == model->rowCount() ? Qt::Checked : Qt::PartiallyChecked);
checkBox->setCheckState(header->checkBoxState);
checkBox->setCheckState(!fl ? Qt::Unchecked : (fl == model->rowCount() ? Qt::Checked : Qt::PartiallyChecked));
pbCreate->setEnabled(fl);
}
});
Expand Down
2 changes: 0 additions & 2 deletions plugins/gcode/drill/drill_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class Header : public QHeaderView {
Header(Qt::Orientation orientation, QWidget* parent = nullptr);
~Header() override;

Qt::CheckState checkBoxState;

enum {
XOffset = 5,
DelegateSize = 16
Expand Down

0 comments on commit 9876c3d

Please sign in to comment.