Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/applicationcomponents.cpp
Show All 18 Lines | 1 | /* This file is part of Zanshin | |||
---|---|---|---|---|---|
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
21 | USA. | 21 | USA. | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | 24 | | |||
25 | #include "applicationcomponents.h" | 25 | #include "applicationcomponents.h" | ||
26 | 26 | | |||
27 | #include <memory> | ||||
28 | | ||||
27 | #include <QBoxLayout> | 29 | #include <QBoxLayout> | ||
28 | #include <QLabel> | 30 | #include <QLabel> | ||
31 | #include <QMimeData> | ||||
29 | #include <QVariant> | 32 | #include <QVariant> | ||
30 | #include <QWidget> | 33 | #include <QWidget> | ||
31 | #include <QWidgetAction> | 34 | #include <QWidgetAction> | ||
32 | 35 | | |||
33 | #include "availablepagesview.h" | 36 | #include "availablepagesview.h" | ||
34 | #include "availablesourcesview.h" | 37 | #include "availablesourcesview.h" | ||
35 | #include "editorview.h" | 38 | #include "editorview.h" | ||
36 | #include "pageview.h" | 39 | #include "pageview.h" | ||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | |||||
244 | { | 247 | { | ||
245 | Q_ASSERT(destination.isValid()); | 248 | Q_ASSERT(destination.isValid()); | ||
246 | Q_ASSERT(!droppedItems.isEmpty()); | 249 | Q_ASSERT(!droppedItems.isEmpty()); | ||
247 | 250 | | |||
248 | auto centralListModel = droppedItems.first().model(); | 251 | auto centralListModel = droppedItems.first().model(); | ||
249 | auto availablePagesModel = const_cast<QAbstractItemModel*>(destination.model()); | 252 | auto availablePagesModel = const_cast<QAbstractItemModel*>(destination.model()); | ||
250 | 253 | | |||
251 | // drag | 254 | // drag | ||
252 | const auto data = centralListModel->mimeData(droppedItems); | 255 | const auto data = std::unique_ptr<QMimeData>(centralListModel->mimeData(droppedItems)); | ||
253 | 256 | | |||
254 | // drop | 257 | // drop | ||
255 | availablePagesModel->dropMimeData(data, Qt::MoveAction, -1, -1, destination); | 258 | availablePagesModel->dropMimeData(data.get(), Qt::MoveAction, -1, -1, destination); | ||
256 | } | 259 | } | ||
257 | 260 | |