mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
This adds the ability for filters to be dragged and dropped to be reordered, similar to scenes and sources.
28 lines
597 B
C++
28 lines
597 B
C++
#include "focus-list.hpp"
|
|
#include <QDragMoveEvent>
|
|
|
|
FocusList::FocusList(QWidget *parent) : QListWidget(parent) {}
|
|
|
|
void FocusList::focusInEvent(QFocusEvent *event)
|
|
{
|
|
QListWidget::focusInEvent(event);
|
|
|
|
emit GotFocus();
|
|
}
|
|
|
|
void FocusList::dragMoveEvent(QDragMoveEvent *event)
|
|
{
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
QPoint pos = event->position().toPoint();
|
|
#else
|
|
QPoint pos = event->pos();
|
|
#endif
|
|
int itemRow = row(itemAt(pos));
|
|
|
|
if ((itemRow == currentRow() + 1) ||
|
|
(currentRow() == count() - 1 && itemRow == -1))
|
|
event->ignore();
|
|
else
|
|
QListWidget::dragMoveEvent(event);
|
|
}
|