mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
Remove current item highlighting in the Places Panel
In the Places Panel, there is always exactly one selected item, which is equal to the current item. Since the selected item is highlighted by drawing its background in a different color, it is not really necessary to highlight additionally that it is the current item. This is achieved by removing the calls to KItemListWidget::setCurrent(true) from KItemListView. The "current" information in the widget is only used for deciding if the "current item highlighting", like an underline in Oxygen, should be drawn. The motivation for this change is that I have seem some complaints about the "current item" highlighting, which can be even more distracting with non-Oxygen styles. REVIEW: 119019
This commit is contained in:
parent
1e22db8ba5
commit
4d8f89f55a
|
@ -1332,14 +1332,18 @@ void KItemListView::slotCurrentChanged(int current, int previous)
|
||||||
{
|
{
|
||||||
Q_UNUSED(previous);
|
Q_UNUSED(previous);
|
||||||
|
|
||||||
KItemListWidget* previousWidget = m_visibleItems.value(previous, 0);
|
// In SingleSelection mode (e.g., in the Places Panel), the current item is
|
||||||
if (previousWidget) {
|
// always the selected item. It is not necessary to highlight the current item then.
|
||||||
previousWidget->setCurrent(false);
|
if (m_controller->selectionBehavior() != KItemListController::SingleSelection) {
|
||||||
}
|
KItemListWidget* previousWidget = m_visibleItems.value(previous, 0);
|
||||||
|
if (previousWidget) {
|
||||||
|
previousWidget->setCurrent(false);
|
||||||
|
}
|
||||||
|
|
||||||
KItemListWidget* currentWidget = m_visibleItems.value(current, 0);
|
KItemListWidget* currentWidget = m_visibleItems.value(current, 0);
|
||||||
if (currentWidget) {
|
if (currentWidget) {
|
||||||
currentWidget->setCurrent(true);
|
currentWidget->setCurrent(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
QAccessible::updateAccessibility(this, current+1, QAccessible::Focus);
|
QAccessible::updateAccessibility(this, current+1, QAccessible::Focus);
|
||||||
}
|
}
|
||||||
|
@ -1978,7 +1982,12 @@ void KItemListView::updateWidgetProperties(KItemListWidget* widget, int index)
|
||||||
widget->setStyleOption(m_styleOption);
|
widget->setStyleOption(m_styleOption);
|
||||||
|
|
||||||
const KItemListSelectionManager* selectionManager = m_controller->selectionManager();
|
const KItemListSelectionManager* selectionManager = m_controller->selectionManager();
|
||||||
widget->setCurrent(index == selectionManager->currentItem());
|
|
||||||
|
// In SingleSelection mode (e.g., in the Places Panel), the current item is
|
||||||
|
// always the selected item. It is not necessary to highlight the current item then.
|
||||||
|
if (m_controller->selectionBehavior() != KItemListController::SingleSelection) {
|
||||||
|
widget->setCurrent(index == selectionManager->currentItem());
|
||||||
|
}
|
||||||
widget->setSelected(selectionManager->isSelected(index));
|
widget->setSelected(selectionManager->isSelected(index));
|
||||||
widget->setHovered(false);
|
widget->setHovered(false);
|
||||||
widget->setEnabledSelectionToggle(enabledSelectionToggles());
|
widget->setEnabledSelectionToggle(enabledSelectionToggles());
|
||||||
|
|
Loading…
Reference in a new issue