2015-03-24 02:15:19 +00:00
|
|
|
#include "focus-list.hpp"
|
2019-10-09 05:30:22 +00:00
|
|
|
#include <QDragMoveEvent>
|
2015-03-24 02:15:19 +00:00
|
|
|
|
|
|
|
FocusList::FocusList(QWidget *parent) : QListWidget(parent) {}
|
|
|
|
|
|
|
|
void FocusList::focusInEvent(QFocusEvent *event)
|
|
|
|
{
|
|
|
|
QListWidget::focusInEvent(event);
|
|
|
|
|
|
|
|
emit GotFocus();
|
|
|
|
}
|
2019-10-09 05:30:22 +00:00
|
|
|
|
|
|
|
void FocusList::dragMoveEvent(QDragMoveEvent *event)
|
|
|
|
{
|
|
|
|
QPoint pos = event->position().toPoint();
|
|
|
|
int itemRow = row(itemAt(pos));
|
|
|
|
|
|
|
|
if ((itemRow == currentRow() + 1) ||
|
|
|
|
(currentRow() == count() - 1 && itemRow == -1))
|
|
|
|
event->ignore();
|
|
|
|
else
|
|
|
|
QListWidget::dragMoveEvent(event);
|
|
|
|
}
|