-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnavigationview.h
More file actions
70 lines (65 loc) · 2.04 KB
/
navigationview.h
File metadata and controls
70 lines (65 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef NAVIGATIONVIEW_H
#define NAVIGATIONVIEW_H
#include <QTreeView>
#include <QObject>
#include <QWidget>
#include <QMenu>
#include <QMouseEvent>
#include <QFileInfo>
#include <navigationmodel.h>
#include <QTimer>
#define TIME_PERIOD_FOR_EXPANSION 100
class NavigationView : public QTreeView
{
Q_OBJECT
public:
NavigationView(QWidget * parent = nullptr, bool editable = true);
void setRowsEditable(bool enable);
void expandEveryItems(QModelIndex index);
void keyPressEvent(QKeyEvent *event)override;
void setFont(const QFont &font);
private:
bool editable;
QMenu menu;
QAction addFileAction ;
QAction addFolderAction ;
QAction renameFileAction;
QAction deleteFileAction;
QAction openLocationAction ;
QAction copyPath;
QAction SetVault;
QString newEntryName;
QModelIndex lastClickedIndex;
QTimer expandTimer;
QTimer fileFolderCreatedTimer;
QString editingFilename;
protected:
void rowsInserted(const QModelIndex &parent, int start, int end) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
public slots:
void ContextMenuHandler(QPoint pos);
void addFile();
void addFolder();
void renameFile();
void deleteFile();
void openFileFolder();
void copyFileFolderPath();
void setVaultHandler();
void folderChangedHandler();
void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) override;
void expandTimerHandler();
void rowClicked(const QModelIndex &index);
signals:
void emptySearch();
void createFile(QModelIndex &index, QString &name);
void createFolder(QModelIndex &index, QString &name);
void deleteFileFolder(QModelIndex &index);
void newFileCreated(const QModelIndex &index);
void openLocation(QModelIndex &index);
void copyFolderFilePath(QModelIndex &index);
void setVaultPath();
void expansionComplete();
void fileRenamed(const QString& newName,const QString& oldName, const QModelIndex& index);
void sendFocusToSearch(QWidget * view);
};
#endif // NAVIGATIONVIEW_H