Commit d1672548 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Make selection of the attributes with the keyboard work

The itemClicked() signal is not fired if an item is selected with the
keyboard. Use the proper signal (itemSelectionChanged) for reacting to
a changed selection.

GnuPG-bug-id: 6089
parent fc783889
......@@ -78,8 +78,8 @@ Kleo::DNAttributeOrderConfigWidget::DNAttributeOrderConfigWidget(QWidget *parent
prepare(d->currentLV);
glay->addWidget(d->currentLV, row, 2);
connect(d->availableLV, &QTreeWidget::itemClicked, this, &DNAttributeOrderConfigWidget::slotAvailableSelectionChanged);
connect(d->currentLV, &QTreeWidget::itemClicked, this, &DNAttributeOrderConfigWidget::slotCurrentOrderSelectionChanged);
connect(d->availableLV, &QTreeWidget::itemSelectionChanged, this, &DNAttributeOrderConfigWidget::slotAvailableSelectionChanged);
connect(d->currentLV, &QTreeWidget::itemSelectionChanged, this, &DNAttributeOrderConfigWidget::slotCurrentOrderSelectionChanged);
d->placeHolderItem = new QTreeWidgetItem(d->availableLV);
d->placeHolderItem->setText(0, QStringLiteral("_X_"));
......@@ -225,14 +225,16 @@ QStringList Kleo::DNAttributeOrderConfigWidget::attributeOrder() const
return order;
}
void Kleo::DNAttributeOrderConfigWidget::slotAvailableSelectionChanged(QTreeWidgetItem *item)
void Kleo::DNAttributeOrderConfigWidget::slotAvailableSelectionChanged()
{
d->navTB[DNAttributeOrderConfigWidgetPrivate::Right]->setEnabled(item);
d->navTB[DNAttributeOrderConfigWidgetPrivate::Right]->setEnabled(!d->availableLV->selectedItems().empty());
}
void Kleo::DNAttributeOrderConfigWidget::slotCurrentOrderSelectionChanged(QTreeWidgetItem *item)
void Kleo::DNAttributeOrderConfigWidget::slotCurrentOrderSelectionChanged()
{
enableDisableButtons(item);
const auto selectedItems = d->currentLV->selectedItems();
auto selectedItem = selectedItems.empty() ? nullptr : selectedItems.front();
enableDisableButtons(selectedItem);
}
void Kleo::DNAttributeOrderConfigWidget::enableDisableButtons(QTreeWidgetItem *item)
......
......@@ -36,8 +36,8 @@ Q_SIGNALS:
//
private Q_SLOTS:
void slotAvailableSelectionChanged(QTreeWidgetItem *);
void slotCurrentOrderSelectionChanged(QTreeWidgetItem *);
void slotAvailableSelectionChanged();
void slotCurrentOrderSelectionChanged();
void slotDoubleUpButtonClicked();
void slotUpButtonClicked();
void slotDownButtonClicked();
......
Supports Markdown
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