diff options
| author | Akseli Lahtinen <[email protected]> | 2025-05-09 13:34:30 +0300 |
|---|---|---|
| committer | Akseli Lahtinen <[email protected]> | 2025-05-09 13:34:30 +0300 |
| commit | 2201018673467bf7a871082b1fd1e3f8c6f926e7 (patch) | |
| tree | 0eac8446d79c39e83432a2e8f60378c67cfcaf56 /src/kitemviews/kitemlistcontroller.cpp | |
| parent | 882cd01717f53ac544c54fec3d03163b8fbdebe7 (diff) | |
DolphinView: Remove -1 interval, add setAutoActivationEnabled
In future Qt versions, Qt Timers do not allow negative intervals.
Instead, they will be changed to 1.
Related Qt commit:
https://github.com/qt/qtbase/commit/f1f610bc67bfd5c2ef31270a6945e7bae93b5e4a
Instead of relying on the interval, use a boolean variable
to check if the autoactivation is enabled or not.
Diffstat (limited to 'src/kitemviews/kitemlistcontroller.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistcontroller.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 2f1bdc551..cd60c3a41 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -64,7 +64,7 @@ KItemListController::KItemListController(KItemModelBase *model, KItemListView *v m_autoActivationTimer = new QTimer(this); m_autoActivationTimer->setSingleShot(true); - m_autoActivationTimer->setInterval(-1); + m_autoActivationTimer->setInterval(750); connect(m_autoActivationTimer, &QTimer::timeout, this, &KItemListController::slotAutoActivationTimeout); setModel(model); @@ -200,14 +200,14 @@ int KItemListController::indexCloseToMousePressedPosition() const return -1; } -void KItemListController::setAutoActivationDelay(int delay) +void KItemListController::setAutoActivationEnabled(bool enabled) { - m_autoActivationTimer->setInterval(delay); + m_autoActivationEnabled = enabled; } -int KItemListController::autoActivationDelay() const +bool KItemListController::isAutoActivationEnabled() const { - return m_autoActivationTimer->interval(); + return m_autoActivationEnabled; } void KItemListController::setSingleClickActivationEnforced(bool singleClick) @@ -857,7 +857,7 @@ bool KItemListController::dragMoveEvent(QGraphicsSceneDragDropEvent *event, cons Q_EMIT itemHovered(index); } - if (!m_autoActivationTimer->isActive() && m_autoActivationTimer->interval() >= 0 && m_model->canEnterOnHover(index)) { + if (m_autoActivationEnabled && !m_autoActivationTimer->isActive() && m_model->canEnterOnHover(index)) { m_autoActivationTimer->setProperty("index", index); m_autoActivationTimer->start(); newHoveredWidget->startActivateSoonAnimation(m_autoActivationTimer->remainingTime()); |
