VisualizationDragDropContainer.h
51 lines
| 1.5 KiB
| text/x-c
|
CLexer
r846 | #ifndef SCIQLOP_VISUALIZATIONDRAGDROPCONTAINER_H | |||
#define SCIQLOP_VISUALIZATIONDRAGDROPCONTAINER_H | ||||
r838 | ||||
#include <Common/spimpl.h> | ||||
r850 | #include <QLoggingCategory> | |||
r844 | #include <QMimeData> | |||
#include <QVBoxLayout> | ||||
#include <QWidget> | ||||
r838 | ||||
r850 | #include <functional> | |||
Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationDragDropContainer) | ||||
r838 | class VisualizationDragWidget; | |||
r844 | class VisualizationDragDropContainer : public QWidget { | |||
r838 | Q_OBJECT | |||
signals: | ||||
r844 | void dropOccured(int dropIndex, const QMimeData *mimeData); | |||
r838 | ||||
public: | ||||
r850 | using AcceptMimeDataFunction = std::function<bool(const QMimeData *mimeData)>; | |||
r844 | VisualizationDragDropContainer(QWidget *parent = nullptr); | |||
r838 | ||||
r844 | void addDragWidget(VisualizationDragWidget *dragWidget); | |||
void insertDragWidget(int index, VisualizationDragWidget *dragWidget); | ||||
r838 | ||||
r844 | void setAcceptedMimeTypes(const QStringList &mimeTypes); | |||
void setMergeAllowedMimeTypes(const QStringList &mimeTypes); | ||||
r838 | ||||
int countDragWidget() const; | ||||
r850 | void setAcceptMimeDataFunction(AcceptMimeDataFunction fun); | |||
r838 | protected: | |||
void dragEnterEvent(QDragEnterEvent *event); | ||||
void dragLeaveEvent(QDragLeaveEvent *event); | ||||
void dragMoveEvent(QDragMoveEvent *event); | ||||
void dropEvent(QDropEvent *event); | ||||
private: | ||||
class VisualizationDragDropContainerPrivate; | ||||
spimpl::unique_impl_ptr<VisualizationDragDropContainerPrivate> impl; | ||||
private slots: | ||||
r844 | void startDrag(VisualizationDragWidget *dragWidget, const QPoint &dragPosition); | |||
r838 | }; | |||
r846 | #endif // SCIQLOP_VISUALIZATIONDRAGDROPCONTAINER_H | |||