MCPcopy Create free account
hub / github.com/deskflow/deskflow / dragMoveEvent

Method dragMoveEvent

src/lib/gui/widgets/ScreenSetupView.cpp:92–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void ScreenSetupView::dragMoveEvent(QDragMoveEvent *event)
93{
94 if (event->mimeData()->hasFormat(ScreenSetupModel::mimeType())) {
95 // where does the event come from? myself or someone else?
96 if (event->source() == this) {
97 // myself is ok, but then it must be a move action, never a copy
98 event->setDropAction(Qt::MoveAction);
99 event->accept();
100 } else {
101 const auto &point = event->position().toPoint();
102 int col = columnAt(point.x());
103 int row = rowAt(point.y());
104
105 // a drop from outside is not allowed if there's a screen already there.
106 if (!model()->screen(col, row).isNull())
107 event->ignore();
108 else {
109 event->acceptProposedAction();
110 }
111 }
112 } else
113 event->ignore();
114}
115
116// this is reimplemented from QAbstractItemView::startDrag()
117void ScreenSetupView::startDrag(Qt::DropActions)

Callers

nothing calls this directly

Calls 5

hasFormatMethod · 0.80
mimeDataMethod · 0.80
isNullMethod · 0.80
ignoreMethod · 0.80
acceptMethod · 0.45

Tested by

no test coverage detected