DragDropGuiController.h
75 lines
| 2.6 KiB
| text/x-c
|
CLexer
r1110 | #ifndef SCIQLOP_DRAGDROPGUICONTROLLER_H | |||
#define SCIQLOP_DRAGDROPGUICONTROLLER_H | ||||
r840 | ||||
#include <Common/spimpl.h> | ||||
r852 | #include <QLoggingCategory> | |||
r840 | #include <QWidget> | |||
class QVBoxLayout; | ||||
class QScrollArea; | ||||
r892 | class QTabBar; | |||
r840 | class VisualizationDragWidget; | |||
r852 | class VisualizationDragDropContainer; | |||
r840 | class QMimeData; | |||
r1110 | Q_DECLARE_LOGGING_CATEGORY(LOG_DragDropGuiController) | |||
r843 | ||||
r840 | /** | |||
* @brief Helper class for drag&drop operations. | ||||
r852 | * @note The helper is accessible from the sqpApp singleton and has the same life as the whole | |||
* application (like a controller). But contrary to a controller, it doesn't live in a thread and | ||||
* can interect with the gui. | ||||
* @see SqpApplication | ||||
r840 | */ | |||
r1110 | class DragDropGuiController { | |||
r840 | public: | |||
static const QString MIME_TYPE_GRAPH; | ||||
static const QString MIME_TYPE_ZONE; | ||||
r887 | enum class PlaceHolderType { Default, Graph, Zone }; | |||
r1110 | DragDropGuiController(); | |||
virtual ~DragDropGuiController(); | ||||
r847 | ||||
r852 | /// Resets some internal variables. Must be called before any new drag&drop operation. | |||
void resetDragAndDrop(); | ||||
/// Sets the visualization widget currently being drag on the visualization. | ||||
r847 | void setCurrentDragWidget(VisualizationDragWidget *dragWidget); | |||
r852 | ||||
/// Returns the visualization widget currently being drag on the visualization. | ||||
/// Can be null if a new visualization widget is intended to be created by the drag&drop | ||||
/// operation. | ||||
r847 | VisualizationDragWidget *getCurrentDragWidget() const; | |||
r840 | ||||
QWidget &placeHolder() const; | ||||
r887 | void insertPlaceHolder(QVBoxLayout *layout, int index, PlaceHolderType type, | |||
const QString &topLabelText); | ||||
r840 | void removePlaceHolder(); | |||
bool isPlaceHolderSet() const; | ||||
r852 | /// Checks if the specified mime data is valid for a drop in the visualization | |||
bool checkMimeDataForVisualization(const QMimeData *mimeData, | ||||
VisualizationDragDropContainer *dropContainer); | ||||
r847 | void addDragDropScrollArea(QScrollArea *scrollArea); | |||
void removeDragDropScrollArea(QScrollArea *scrollArea); | ||||
r840 | ||||
r892 | void addDragDropTabBar(QTabBar *tabBar); | |||
void removeDragDropTabBar(QTabBar *tabBar); | ||||
r847 | QUrl imageTemporaryUrl(const QImage &image) const; | |||
r840 | ||||
r879 | void setHightlightedDragWidget(VisualizationDragWidget *dragWidget); | |||
r881 | VisualizationDragWidget *getHightlightedDragWidget() const; | |||
r879 | ||||
Thibaud Rabillard
|
r912 | /// Delays the closing of a widget during a drag&drop operation | ||
void delayedCloseWidget(QWidget *widget); | ||||
void doCloseWidgets(); | ||||
r840 | private: | |||
r1110 | class DragDropGuiControllerPrivate; | |||
spimpl::unique_impl_ptr<DragDropGuiControllerPrivate> impl; | ||||
r840 | }; | |||
r1110 | #endif // SCIQLOP_DRAGDROPGUICONTROLLER_H | |||