LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
dndactionsmixin.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <utility>
12#include <QAbstractItemModel>
13
14namespace LC::Util
15{
34 template<typename Model>
35 class DndActionsMixin : public Model
36 {
37 Qt::DropActions Drags_;
38 Qt::DropActions Drops_;
39 public:
48 template<typename... Args>
49 explicit DndActionsMixin (Args&&... args)
50 : Model { std::forward<Args> (args)... }
51 , Drags_ { Model::supportedDragActions () }
52 , Drops_ { Model::supportedDropActions () }
53 {
54 }
55
56 Qt::DropActions supportedDragActions () const override
57 {
58 return Drags_;
59 }
60
61 void setSupportedDragActions (Qt::DropActions acts)
62 {
63 Drags_ = acts;
64 }
65
66 Qt::DropActions supportedDropActions () const override
67 {
68 return Drops_;
69 }
70
71 void setSupportedDropActions (Qt::DropActions acts)
72 {
73 Drops_ = acts;
74 }
75 };
76}
Qt::DropActions supportedDropActions() const override
DndActionsMixin(Args &&... args)
Constructs the model passing the arguments to the base constructor.
void setSupportedDragActions(Qt::DropActions acts)
Qt::DropActions supportedDragActions() const override
void setSupportedDropActions(Qt::DropActions acts)
@ Model
The human-readable name of the device model (QString).
Definition deviceroles.h:97