#include <QApplication>
#include <QDrag>
-#include <QEvent>
#include <QGraphicsScene>
#include <QGraphicsSceneEvent>
#include <QGraphicsView>
m_selectionBehavior(NoSelection),
m_autoActivationBehavior(ActivationAndExpansion),
m_mouseDoubleClickAction(ActivateItemOnly),
- m_model(0),
- m_view(0),
+ m_model(nullptr),
+ m_view(nullptr),
m_selectionManager(new KItemListSelectionManager(this)),
m_keyboardManager(new KItemListKeyboardSearchManager(this)),
m_pressedIndex(-1),
m_pressedMousePos(),
- m_autoActivationTimer(0),
+ m_autoActivationTimer(nullptr),
m_oldSelection(),
m_keyboardAnchorIndex(-1),
m_keyboardAnchorPos(0)
KItemListController::~KItemListController()
{
- setView(0);
+ setView(nullptr);
Q_ASSERT(!m_view);
- setModel(0);
+ setModel(nullptr);
Q_ASSERT(!m_model);
}
return m_mouseDoubleClickAction;
}
+int KItemListController::indexCloseToMousePressedPosition() const
+{
+ QHashIterator<KItemListWidget*, KItemListGroupHeader*> it(m_view->m_visibleGroups);
+ while (it.hasNext()) {
+ it.next();
+ KItemListGroupHeader *groupHeader = it.value();
+ const QPointF mappedToGroup = groupHeader->mapFromItem(nullptr, m_pressedMousePos);
+ if (groupHeader->contains(mappedToGroup)) {
+ return it.key()->index();
+ }
+ }
+ return -1;
+}
+
void KItemListController::setAutoActivationDelay(int delay)
{
m_autoActivationTimer->setInterval(delay);
}
}
}
- // Fall through to the default case and add the Space to the current search string.
-
+ // fall through
+ // to the default case and add the Space to the current search string.
default:
m_keyboardManager->addKeys(event->text());
// Make sure unconsumed events get propagated up the chain. #302329
{
Q_UNUSED(event);
Q_UNUSED(transform);
+
+ DragAndDropHelper::clearUrlListMatchesUrlCache();
+
return false;
}
}
}
- return 0;
+ return nullptr;
}
KItemListWidget* KItemListController::widgetForPos(const QPointF& pos) const
}
}
- return 0;
+ return nullptr;
}
void KItemListController::updateKeyboardAnchor()