DragDropHelper.h
65 lines
| 1.7 KiB
| text/x-c
|
CLexer
r847 | #ifndef SCIQLOP_DRAGDROPHELPER_H | |||
#define SCIQLOP_DRAGDROPHELPER_H | ||||
r840 | ||||
#include <Common/spimpl.h> | ||||
#include <QWidget> | ||||
class QVBoxLayout; | ||||
class QScrollArea; | ||||
class VisualizationDragWidget; | ||||
class QMimeData; | ||||
r843 | /** | |||
* @brief Event filter class which manage the scroll of QScrollArea during a drag&drop operation. | ||||
* @note A QScrollArea inside an other QScrollArea is not fully supported. | ||||
*/ | ||||
r847 | class DragDropScroller : public QObject { | |||
r843 | Q_OBJECT | |||
public: | ||||
r847 | DragDropScroller(QObject *parent = nullptr); | |||
r843 | ||||
r847 | void addScrollArea(QScrollArea *scrollArea); | |||
void removeScrollArea(QScrollArea *scrollArea); | ||||
r843 | ||||
protected: | ||||
bool eventFilter(QObject *obj, QEvent *event); | ||||
private: | ||||
class DragDropScrollerPrivate; | ||||
spimpl::unique_impl_ptr<DragDropScrollerPrivate> impl; | ||||
private slots: | ||||
void onTimer(); | ||||
}; | ||||
r840 | /** | |||
* @brief Helper class for drag&drop operations. | ||||
*/ | ||||
r847 | class DragDropHelper { | |||
r840 | public: | |||
static const QString MIME_TYPE_GRAPH; | ||||
static const QString MIME_TYPE_ZONE; | ||||
r847 | DragDropHelper(); | |||
virtual ~DragDropHelper(); | ||||
void setCurrentDragWidget(VisualizationDragWidget *dragWidget); | ||||
VisualizationDragWidget *getCurrentDragWidget() const; | ||||
r840 | ||||
QWidget &placeHolder() const; | ||||
r847 | void insertPlaceHolder(QVBoxLayout *layout, int index); | |||
r840 | void removePlaceHolder(); | |||
bool isPlaceHolderSet() const; | ||||
r847 | void addDragDropScrollArea(QScrollArea *scrollArea); | |||
void removeDragDropScrollArea(QScrollArea *scrollArea); | ||||
r840 | ||||
r847 | QUrl imageTemporaryUrl(const QImage &image) const; | |||
r840 | ||||
private: | ||||
class DragDropHelperPrivate; | ||||
spimpl::unique_impl_ptr<DragDropHelperPrivate> impl; | ||||
}; | ||||
r847 | #endif // SCIQLOP_DRAGDROPHELPER_H | |||