FocusList.cpp 537 B

12345678910111213141516171819202122232425
  1. #include "FocusList.hpp"
  2. #include <QDragMoveEvent>
  3. #include "moc_FocusList.cpp"
  4. FocusList::FocusList(QWidget *parent) : QListWidget(parent) {}
  5. void FocusList::focusInEvent(QFocusEvent *event)
  6. {
  7. QListWidget::focusInEvent(event);
  8. emit GotFocus();
  9. }
  10. void FocusList::dragMoveEvent(QDragMoveEvent *event)
  11. {
  12. QPoint pos = event->position().toPoint();
  13. int itemRow = row(itemAt(pos));
  14. if ((itemRow == currentRow() + 1) || (currentRow() == count() - 1 && itemRow == -1))
  15. event->ignore();
  16. else
  17. QListWidget::dragMoveEvent(event);
  18. }