##// END OF EJS Templates
Updates data sources UI representation (1)...
Updates data sources UI representation (1) Makes the merge each time a data source is added

File last commit:

r958:ebb8b3d01eee
r1035:8c7e6cbfd659
Show More
VisualizationDragWidget.cpp
55 lines | 1.5 KiB | text/x-c | CppLexer
/ gui / src / Visualization / VisualizationDragWidget.cpp
New visualization classes for the drag&drop
r838 #include "Visualization/VisualizationDragWidget.h"
#include "Visualization/VisualizationDragDropContainer.h"
#include <QApplication>
Format changes
r844 #include <QMouseEvent>
New visualization classes for the drag&drop
r838
Basic mouse wheel interactions + mode drag
r958 #include <SqpApplication.h>
New visualization classes for the drag&drop
r838 struct VisualizationDragWidget::VisualizationDragWidgetPrivate {
Format changes
r844 QPoint m_DragStartPosition;
bool m_DragStartPositionValid = false;
New visualization classes for the drag&drop
r838
Format changes
r844 explicit VisualizationDragWidgetPrivate() {}
New visualization classes for the drag&drop
r838 };
Format changes
r844 VisualizationDragWidget::VisualizationDragWidget(QWidget *parent)
: QWidget{parent}, impl{spimpl::make_unique_impl<VisualizationDragWidgetPrivate>()}
New visualization classes for the drag&drop
r838 {
}
void VisualizationDragWidget::mousePressEvent(QMouseEvent *event)
{
Format changes
r844 if (event->button() == Qt::LeftButton) {
impl->m_DragStartPosition = event->pos();
}
New visualization classes for the drag&drop
r838
Format changes
r844 impl->m_DragStartPositionValid = isDragAllowed();
New visualization classes for the drag&drop
r838
QWidget::mousePressEvent(event);
}
void VisualizationDragWidget::mouseMoveEvent(QMouseEvent *event)
{
Format changes
r844 if (!impl->m_DragStartPositionValid || !isDragAllowed()) {
New visualization classes for the drag&drop
r838 return;
Format changes
r844 }
New visualization classes for the drag&drop
r838
Format changes
r844 if (!(event->buttons() & Qt::LeftButton)) {
New visualization classes for the drag&drop
r838 return;
Format changes
r844 }
New visualization classes for the drag&drop
r838
Basic mouse wheel interactions + mode drag
r958 if (sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::DragAndDrop
|| event->modifiers().testFlag(Qt::AltModifier)) {
New visualization classes for the drag&drop
r838
Basic mouse wheel interactions + mode drag
r958 if ((event->pos() - impl->m_DragStartPosition).manhattanLength()
< QApplication::startDragDistance()) {
return;
}
New visualization classes for the drag&drop
r838
Basic mouse wheel interactions + mode drag
r958 emit dragDetected(this, impl->m_DragStartPosition);
}
New visualization classes for the drag&drop
r838
QWidget::mouseMoveEvent(event);
}