LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
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 
14 namespace LC::Util
15 {
35  template<typename Model>
36  class DndActionsMixin : public Model
37  {
38  Qt::DropActions Drags_;
39  Qt::DropActions Drops_;
40  public:
49  template<typename... Args>
50  explicit DndActionsMixin (Args&&... args)
51  : Model { std::forward<Args> (args)... }
52  , Drags_ { Model::supportedDragActions () }
53  , Drops_ { Model::supportedDropActions () }
54  {
55  }
56 
57  Qt::DropActions supportedDragActions () const override
58  {
59  return Drags_;
60  }
61 
62  void setSupportedDragActions (Qt::DropActions acts)
63  {
64  Drags_ = acts;
65  }
66 
67  Qt::DropActions supportedDropActions () const override
68  {
69  return Drops_;
70  }
71 
72  void setSupportedDropActions (Qt::DropActions acts)
73  {
74  Drops_ = acts;
75  }
76  };
77 }
LC::Util::DndActionsMixin::setSupportedDropActions
void setSupportedDropActions(Qt::DropActions acts)
Definition: dndactionsmixin.h:84
LC::Util::DndActionsMixin::supportedDragActions
Qt::DropActions supportedDragActions() const override
Definition: dndactionsmixin.h:69
LC::Util
Definition: icoreproxy.h:33
LC::Util::DndActionsMixin::DndActionsMixin
DndActionsMixin(Args &&... args)
Constructs the model passing the arguments to the base constructor.
Definition: dndactionsmixin.h:62
LC::Util::DndActionsMixin::setSupportedDragActions
void setSupportedDragActions(Qt::DropActions acts)
Definition: dndactionsmixin.h:74
LC::Util::DndActionsMixin::supportedDropActions
Qt::DropActions supportedDropActions() const override
Definition: dndactionsmixin.h:79
LC::Model
@ Model
The human-readable name of the device model (QString).
Definition: deviceroles.h:103