Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
sourceiconview.h
Go to the documentation of this file.
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef SOURCEICONVIEW_H
22 #define SOURCEICONVIEW_H
23 
24 #include <QListView>
25 #include <QDropEvent>
26 #include <QStyledItemDelegate>
27 
28 #include "project/sourcescommon.h"
29 
30 class Project;
31 class SourceIconDelegate;
32 
33 class SourceIconDelegate : public QStyledItemDelegate {
34 public:
35  SourceIconDelegate(QObject *parent = nullptr);
36  virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
37  virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
38 };
39 
40 class SourceIconView : public QListView {
41  Q_OBJECT
42 public:
43  SourceIconView(SourcesCommon& commons);
45 
46  void mousePressEvent(QMouseEvent* event);
47  void mouseDoubleClickEvent(QMouseEvent *event);
48  void dragEnterEvent(QDragEnterEvent *event);
49  void dragMoveEvent(QDragMoveEvent *event);
50  void dropEvent(QDropEvent* event);
51 signals:
52  void changed_root();
53 private slots:
54  void show_context_menu();
55  void item_click(const QModelIndex& index);
56 private:
59 };
60 
61 #endif // SOURCEICONVIEW_H
void dragEnterEvent(QDragEnterEvent *event)
Definition: sourceiconview.cpp:60
void dragMoveEvent(QDragMoveEvent *event)
Definition: sourceiconview.cpp:68
void dropEvent(QDropEvent *event)
Definition: sourceiconview.cpp:76
void show_context_menu()
Definition: sourceiconview.cpp:44
Project * project_parent
Definition: sourceiconview.h:44
SourceIconDelegate(QObject *parent=nullptr)
Definition: sourceiconview.cpp:96
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: sourceiconview.cpp:101
Definition: sourceiconview.h:40
void mouseDoubleClickEvent(QMouseEvent *event)
Definition: sourceiconview.cpp:82
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: sourceiconview.cpp:114
SourceIconDelegate delegate_
Definition: sourceiconview.h:58
void mousePressEvent(QMouseEvent *event)
Definition: sourceiconview.cpp:54
Definition: project.h:54
void item_click(const QModelIndex &index)
Definition: sourceiconview.cpp:48
void changed_root()
SourcesCommon & commons_
Definition: sourceiconview.h:57
Definition: sourceiconview.h:33
SourceIconView(SourcesCommon &commons)
Definition: sourceiconview.cpp:32
Definition: sourcescommon.h:37