-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibraryWidget.h
44 lines (34 loc) · 955 Bytes
/
LibraryWidget.h
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
#pragma once
#include <QWidget>
#include <QMenu>
#include <QKeyEvent>
#include <QItemSelection>
#include <QScopedPointer>
#include "LibraryDelegate.h"
#include "LibraryModel.h"
namespace Ui { class LibraryWidget; }
class LibraryWidget: public QWidget
{
Q_OBJECT
public:
explicit LibraryWidget(QWidget* a_parent = nullptr);
void init(const LibraryModelPtr& a_model);
signals:
void instrumentSelected(int a_index) const;
protected:
virtual bool eventFilter(QObject* a_watched, QEvent* a_event) override;
private slots:
void onAdd();
void onDelete();
void onContextMenuRequested(const QPoint& a_position);
void onSelectionChanged(const QItemSelection& a_selected, const QItemSelection& a_deselected);
private:
void addNewItem();
void deleteSelectedItem();
void moveUpSelected();
void moveDownSelected();
void updateDeleteButtonState();
QScopedPointer<Ui::LibraryWidget> m_ui;
LibraryDelegate m_delegate;
LibraryModelPtr m_model;
};