File indexing completed on 2024-04-21 04:32:09

0001 /*
0002  * Copyright (C) 2009-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 #ifndef LibraryTreeWidget_H
0012 #define LibraryTreeWidget_H
0013 
0014 #include <QTreeWidget>
0015 
0016 class QDragEnterEvent;
0017 class QDragLeaveEvent;
0018 class QDragMoveEvent;
0019 class QDropEvent;
0020 class QTimer;
0021 class QTreeWidgetItem;
0022 class QWidget;
0023 
0024 class LibraryTreeWidget : public QTreeWidget
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     explicit LibraryTreeWidget(QWidget *parent);
0030     virtual ~LibraryTreeWidget();
0031 
0032 protected:
0033     virtual void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
0034     virtual void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
0035     virtual void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
0036     virtual void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
0037     bool acceptDrag(QDropEvent *event) const;
0038 
0039 private slots:
0040     void openBranch();
0041 
0042 private:
0043     QTimer *m_openBranchTimer;
0044     QTreeWidgetItem *m_dropItem;
0045     QTreeWidgetItem *m_currentItem;
0046 };
0047 
0048 #endif // LibraryTreeWidget_H