LeechCraft 0.6.70-16373-g319c272718
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{
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}
Abstracts away differences between Qt4 and Qt5 in model DnD support.
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)
STL namespace.