Disable delete button when no entry is selected in Nanoleaf detection

This commit is contained in:
Dmitry Kychanov committed 2025-06-27 17:45:53 +04:00
1 parent e4e5995558
commit af12e0b1d6
2 files changed
+12

No files matched your search

@@ -21,6 +21,7 @@ NanoleafScanPage::NanoleafScanPage(QWidget *parent) :
ui(new Ui::NanoleafScanPage)
{
ui->setupUi(this);
on_NanoleafDeviceList_itemSelectionChanged(); // Refresh button state
}
NanoleafScanPage::~NanoleafScanPage()
@@ -136,3 +137,12 @@ void NanoleafScanPage::on_DeviceFound(QString address, int port)
ui->NanoleafDeviceList->show();
}
}
void NanoleafScanPage::on_NanoleafDeviceList_itemSelectionChanged()
{
int cur_row = ui->NanoleafDeviceList->currentRow();
bool anySelected = (cur_row >= 0);
ui->RemoveNanoleafDeviceButton->setEnabled(anySelected);
}
@@ -32,6 +32,8 @@ private slots:
void on_ScanForNanoleafDevicesButton_clicked();
void on_DeviceFound(QString address, int port);
void on_NanoleafDeviceList_itemSelectionChanged();
private:
Ui::NanoleafScanPage *ui;
std::map<std::string, NanoleafSettingsEntry*> entries;