2018-10-25 00:19:38 +00:00
|
|
|
#ifndef DUST3D_MOTION_LIST_WIDGET_H
|
|
|
|
#define DUST3D_MOTION_LIST_WIDGET_H
|
2018-10-02 04:59:30 +00:00
|
|
|
#include <QTreeWidget>
|
|
|
|
#include <map>
|
2018-10-24 08:54:18 +00:00
|
|
|
#include <QMouseEvent>
|
2018-10-02 04:59:30 +00:00
|
|
|
#include "motionwidget.h"
|
|
|
|
|
2020-12-19 02:29:24 +00:00
|
|
|
class Document;
|
|
|
|
|
2018-10-24 08:54:18 +00:00
|
|
|
class MotionListWidget : public QTreeWidget
|
2018-10-02 04:59:30 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
|
|
|
void removeMotion(QUuid motionId);
|
|
|
|
void modifyMotion(QUuid motionId);
|
2018-10-23 14:57:47 +00:00
|
|
|
void cornerButtonClicked(QUuid motionId);
|
2018-10-02 04:59:30 +00:00
|
|
|
public:
|
2018-10-25 00:19:38 +00:00
|
|
|
MotionListWidget(const Document *document, QWidget *parent=nullptr);
|
2018-10-02 04:59:30 +00:00
|
|
|
bool isMotionSelected(QUuid motionId);
|
|
|
|
public slots:
|
|
|
|
void reload();
|
|
|
|
void removeAllContent();
|
|
|
|
void motionRemoved(QUuid motionId);
|
|
|
|
void showContextMenu(const QPoint &pos);
|
|
|
|
void selectMotion(QUuid motionId, bool multiple=false);
|
|
|
|
void copy();
|
2018-10-23 14:57:47 +00:00
|
|
|
void setCornerButtonVisible(bool visible);
|
|
|
|
void setHasContextMenu(bool hasContextMenu);
|
2018-10-02 04:59:30 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
private:
|
|
|
|
int calculateColumnCount();
|
|
|
|
void updateMotionSelectState(QUuid motionId, bool selected);
|
2018-10-25 00:19:38 +00:00
|
|
|
const Document *m_document = nullptr;
|
2018-10-02 04:59:30 +00:00
|
|
|
std::map<QUuid, std::pair<QTreeWidgetItem *, int>> m_itemMap;
|
|
|
|
std::set<QUuid> m_selectedMotionIds;
|
|
|
|
QUuid m_currentSelectedMotionId;
|
|
|
|
QUuid m_shiftStartMotionId;
|
2018-10-23 14:57:47 +00:00
|
|
|
bool m_cornerButtonVisible = false;
|
|
|
|
bool m_hasContextMenu = true;
|
2018-10-02 04:59:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|