Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kitemlistcontainer.cpp
Show All 24 Lines | |||||
25 | #include "kitemlistcontroller.h" | 25 | #include "kitemlistcontroller.h" | ||
26 | #include "kitemlistview.h" | 26 | #include "kitemlistview.h" | ||
27 | #include "private/kitemlistsmoothscroller.h" | 27 | #include "private/kitemlistsmoothscroller.h" | ||
28 | 28 | | |||
29 | #include <QApplication> | 29 | #include <QApplication> | ||
30 | #include <QGraphicsScene> | 30 | #include <QGraphicsScene> | ||
31 | #include <QGraphicsView> | 31 | #include <QGraphicsView> | ||
32 | #include <QScrollBar> | 32 | #include <QScrollBar> | ||
33 | #include <QScroller> | ||||
33 | #include <QStyleOption> | 34 | #include <QStyleOption> | ||
34 | 35 | | |||
35 | /** | 36 | /** | ||
36 | * Replaces the default viewport of KItemListContainer by a | 37 | * Replaces the default viewport of KItemListContainer by a | ||
37 | * non-scrollable viewport. The scrolling is done in an optimized | 38 | * non-scrollable viewport. The scrolling is done in an optimized | ||
38 | * way by KItemListView internally. | 39 | * way by KItemListView internally. | ||
39 | */ | 40 | */ | ||
40 | class KItemListContainerViewport : public QGraphicsView | 41 | class KItemListContainerViewport : public QGraphicsView | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 72 | { | |||
84 | if (controller->view()) { | 85 | if (controller->view()) { | ||
85 | slotViewChanged(controller->view(), nullptr); | 86 | slotViewChanged(controller->view(), nullptr); | ||
86 | } | 87 | } | ||
87 | 88 | | |||
88 | connect(controller, &KItemListController::modelChanged, | 89 | connect(controller, &KItemListController::modelChanged, | ||
89 | this, &KItemListContainer::slotModelChanged); | 90 | this, &KItemListContainer::slotModelChanged); | ||
90 | connect(controller, &KItemListController::viewChanged, | 91 | connect(controller, &KItemListController::viewChanged, | ||
91 | this, &KItemListContainer::slotViewChanged); | 92 | this, &KItemListContainer::slotViewChanged); | ||
93 | | ||||
94 | QScroller::grabGesture(viewport(), QScroller::TouchGesture); | ||||
92 | } | 95 | } | ||
93 | 96 | | |||
94 | KItemListContainer::~KItemListContainer() | 97 | KItemListContainer::~KItemListContainer() | ||
95 | { | 98 | { | ||
96 | // Don't rely on the QObject-order to delete the controller, otherwise | 99 | // Don't rely on the QObject-order to delete the controller, otherwise | ||
97 | // the QGraphicsScene might get deleted before the view. | 100 | // the QGraphicsScene might get deleted before the view. | ||
98 | delete m_controller; | 101 | delete m_controller; | ||
99 | m_controller = nullptr; | 102 | m_controller = nullptr; | ||
▲ Show 20 Lines • Show All 307 Lines • Show Last 20 Lines |