In feature and channel add dialogs ignore apply action if there are no items to select

This commit is contained in:
f4exb 2022-06-25 12:19:26 +02:00
parent d2951627f4
commit 77963f9ebf
2 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ void ChannelAddDialog::addChannelNames(const QStringList& channelNames)
void ChannelAddDialog::apply(QAbstractButton *button)
{
if (button == (QAbstractButton*) ui->buttonBox->button(QDialogButtonBox::Apply))
if ((ui->channelSelect->count() > 0) && (button == (QAbstractButton*) ui->buttonBox->button(QDialogButtonBox::Apply)))
{
int selectedChannelIndex = ui->channelSelect->currentIndex();
emit(addChannel(selectedChannelIndex));

View File

@ -46,7 +46,7 @@ void FeatureAddDialog::addFeatureNames(const QStringList& featureNames)
void FeatureAddDialog::apply(QAbstractButton *button)
{
if (button == (QAbstractButton*) ui->buttonBox->button(QDialogButtonBox::Apply))
if ((ui->featureSelect->count() > 0) && (button == (QAbstractButton*) ui->buttonBox->button(QDialogButtonBox::Apply)))
{
int selectedFeatureIndex = ui->featureSelect->currentIndex();
emit(addFeature(selectedFeatureIndex));