Skip to content

Commit ec5e714

Browse files
moooorgCalcProgrammer1
authored andcommitted
Enable/Disable devices checkbox now takes filter into account. Fix #1587
1 parent cbee337 commit ec5e714

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

qt/DetectorTableModel.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,13 @@ void DetectorTableModel::applySettings()
146146
ResourceManager::get()->GetSettingsManager()->SaveSettings();
147147
}
148148

149-
void DetectorTableModel::toggleAll(const bool state)
149+
void DetectorTableModel::toggleAll(const bool state, QSortFilterProxyModel* detectorSortModel)
150150
{
151151
for(unsigned int detector_idx = 0; detector_idx < detectors.size(); detector_idx++)
152152
{
153-
setData(index(detector_idx,1), state, Qt::CheckStateRole);
153+
if(detectorSortModel->mapFromSource(index(detector_idx, 0)).isValid())
154+
{
155+
setData(index(detector_idx,1), state, Qt::CheckStateRole);
156+
}
154157
}
155158
}

qt/DetectorTableModel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef DETECTORTABLEMODEL_H
22
#define DETECTORTABLEMODEL_H
33

4+
#include <QSortFilterProxyModel>
45
#include <QAbstractTableModel>
56
#include "ResourceManager.h"
67

@@ -28,7 +29,7 @@ class DetectorTableModel : public QAbstractTableModel
2829

2930
public slots:
3031
void applySettings();
31-
void toggleAll(const bool state);
32+
void toggleAll(const bool state, QSortFilterProxyModel* detectorSortModel);
3233
};
3334

3435
#endif // DETECTORTABLEMODEL_H

qt/OpenRGBSupportedDevicesPage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ void OpenRGBSupportedDevicesPage::on_Filter_textChanged(const QString &arg1)
6464

6565
void OpenRGBSupportedDevicesPage::on_ToggleAllCheckbox_toggled(const bool checked)
6666
{
67-
detectorTableModel->toggleAll(checked);
67+
detectorTableModel->toggleAll(checked, detectorSortModel);
6868
}

0 commit comments

Comments
 (0)