Commit dd385310 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix enable/disable custom button

parent 1ddb90bc
......@@ -171,6 +171,7 @@ SimpleStringListEditor::SimpleStringListEditor(QWidget *parent, ButtonCode butto
if (buttons & Custom) {
d->mCustomButton = new QPushButton(i18n("&Customize..."), this);
d->mCustomButton->setAutoDefault(false);
d->mCustomButton->setEnabled(false); // no selection yet
d->mButtonLayout->addWidget(d->mCustomButton);
connect(d->mCustomButton, &QPushButton::clicked, this, &SimpleStringListEditor::slotCustomize);
}
......@@ -316,6 +317,7 @@ void SimpleStringListEditor::slotCustomize()
QString SimpleStringListEditor::customEntry(const QString &text)
{
Q_UNUSED(text);
return {};
}
......@@ -457,6 +459,10 @@ void SimpleStringListEditor::slotSelectionChanged()
const bool theLast = (currentIndex >= d->mListBox->count() - 1);
const bool theFirst = (currentIndex == 0);
if (d->mCustomButton) {
d->mCustomButton->setEnabled(uniqItemSelected);
}
if (d->mUpButton) {
d->mUpButton->setEnabled(aItemIsSelected && ((uniqItemSelected && !theFirst)
|| (!uniqItemSelected)) && !allItemSelected);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment