File indexing completed on 2024-04-28 15:39:50

0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #ifndef CATEGORYLISTVIEW_CHECKDROPITEM_H
0006 #define CATEGORYLISTVIEW_CHECKDROPITEM_H
0007 
0008 #include "DragItemInfo.h"
0009 
0010 #include <QMimeData>
0011 #include <QTreeWidgetItem>
0012 
0013 class QDropEvent;
0014 namespace CategoryListView
0015 {
0016 class DragableTreeWidget;
0017 
0018 /*
0019  * Implementation detail:
0020  * The drag and drop support here is partly similar to Browser::TreeCategoryModel.
0021  * Any bugs there probably apply here as well and vice versa.
0022  */
0023 class CheckDropItem : public QTreeWidgetItem
0024 {
0025 public:
0026     CheckDropItem(DragableTreeWidget *listview, const QString &column1, const QString &column2);
0027     CheckDropItem(DragableTreeWidget *listview, QTreeWidgetItem *parent, const QString &column1, const QString &column2);
0028     void setDNDEnabled(bool);
0029     bool dataDropped(const QMimeData *data);
0030     bool isSelfDrop(const QMimeData *data) const;
0031     void setTristate(bool b);
0032 
0033 protected:
0034     bool verifyDropWasIntended(const QString &parent, const DragItemInfoSet &children);
0035     DragItemInfoSet extractData(const QMimeData *data) const;
0036 
0037 private:
0038     DragableTreeWidget *m_listView;
0039 };
0040 
0041 }
0042 
0043 #endif /* CATEGORYLISTVIEW_CHECKDROPITEM_H */
0044 // vi:expandtab:tabstop=4 shiftwidth=4: