Enable the remove plugin button only when a plugin is selected.

This commit is contained in:
morg 2021-09-07 13:13:44 +02:00 committed by Adam Honse
parent 04c430e31b
commit 70a2fa81c8
3 changed files with 13 additions and 0 deletions

View file

@ -298,3 +298,11 @@ void Ui::OpenRGBPluginsPage::on_EnableButton_clicked(OpenRGBPluginsEntry* entry)
plugin_manager->UnloadPlugin(entry_path);
}
}
void Ui::OpenRGBPluginsPage::on_PluginsList_itemSelectionChanged()
{
/*-----------------------------------------------------*\
| Enable the remove button when there's a selected item |
\*-----------------------------------------------------*/
ui->RemovePluginButton->setEnabled(!ui->PluginsList->selectedItems().empty());
}

View file

@ -26,6 +26,8 @@ private slots:
void on_RemovePluginButton_clicked();
void on_PluginsList_itemSelectionChanged();
private:
Ui::OpenRGBPluginsPageUi* ui;
PluginManager* plugin_manager;

View file

@ -23,6 +23,9 @@
</item>
<item row="1" column="1">
<widget class="QPushButton" name="RemovePluginButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove Plugin</string>
</property>