VisualizationDragDropContainer.h
51 lines
| 1.5 KiB
| text/x-c
|
CLexer
r849 | #ifndef SCIQLOP_VISUALIZATIONDRAGDROPCONTAINER_H | |||
#define SCIQLOP_VISUALIZATIONDRAGDROPCONTAINER_H | ||||
r841 | ||||
#include <Common/spimpl.h> | ||||
r852 | #include <QLoggingCategory> | |||
r847 | #include <QMimeData> | |||
#include <QVBoxLayout> | ||||
#include <QWidget> | ||||
r841 | ||||
r852 | #include <functional> | |||
Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationDragDropContainer) | ||||
r841 | class VisualizationDragWidget; | |||
r847 | class VisualizationDragDropContainer : public QWidget { | |||
r841 | Q_OBJECT | |||
signals: | ||||
r847 | void dropOccured(int dropIndex, const QMimeData *mimeData); | |||
r841 | ||||
public: | ||||
r852 | using AcceptMimeDataFunction = std::function<bool(const QMimeData *mimeData)>; | |||
r847 | VisualizationDragDropContainer(QWidget *parent = nullptr); | |||
r841 | ||||
r847 | void addDragWidget(VisualizationDragWidget *dragWidget); | |||
void insertDragWidget(int index, VisualizationDragWidget *dragWidget); | ||||
r841 | ||||
r847 | void setAcceptedMimeTypes(const QStringList &mimeTypes); | |||
void setMergeAllowedMimeTypes(const QStringList &mimeTypes); | ||||
r841 | ||||
int countDragWidget() const; | ||||
r852 | void setAcceptMimeDataFunction(AcceptMimeDataFunction fun); | |||
r841 | 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: | ||||
r847 | void startDrag(VisualizationDragWidget *dragWidget, const QPoint &dragPosition); | |||
r841 | }; | |||
r849 | #endif // SCIQLOP_VISUALIZATIONDRAGDROPCONTAINER_H | |||