ExpertListWidget.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef EXPERTLISTWIDGET_H
  2. #define EXPERTLISTWIDGET_H
  3. #include <QWidget>
  4. class QFUser;
  5. class QVBoxLayout;
  6. class QListWidget;
  7. class QListWidgetItem;
  8. ///
  9. /// \brief The ExpertListWidget class
  10. /// 专家列表
  11. class ExpertListWidget : public QWidget
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit ExpertListWidget(QWidget *parent = nullptr);
  16. void showUsers(const QList<QFUser *> &list);
  17. bool hasSelectedItem() const;
  18. int selectedRow() const;
  19. void clearSelection();
  20. signals:
  21. void signalSelectionChanged();
  22. void siganlItemDoubleClicked(int row);
  23. private:
  24. void initialize();
  25. void initLayout();
  26. void connectSignalsAndSlots();
  27. private slots:
  28. void slotItemDoubleClicked(QListWidgetItem *item);
  29. void slotItemClicked(QListWidgetItem *item);
  30. void slotCurrentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
  31. void slotCurrentRowChanged(int currentRow);
  32. void slotItemSelectionChanged();
  33. private:
  34. QVBoxLayout *m_vBoxLayout = nullptr;
  35. QListWidget *m_listWidget = nullptr;
  36. };
  37. #endif // EXPERTLISTWIDGET_H