vselectdialog.h 806 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef VSELECTDIALOG_H
  2. #define VSELECTDIALOG_H
  3. #include <QDialog>
  4. #include <QMap>
  5. class QPushButton;
  6. class QMouseEvent;
  7. class QListWidget;
  8. class QListWidgetItem;
  9. class QShowEvent;
  10. class QKeyEvent;
  11. class VSelectDialog : public QDialog
  12. {
  13. Q_OBJECT
  14. public:
  15. VSelectDialog(const QString &p_title, QWidget *p_parent = 0);
  16. // @p_selectID should >= 0.
  17. void addSelection(const QString &p_selectStr, int p_selectID);
  18. int getSelection() const;
  19. protected:
  20. void showEvent(QShowEvent *p_event) Q_DECL_OVERRIDE;
  21. void keyPressEvent(QKeyEvent *p_event) Q_DECL_OVERRIDE;
  22. private slots:
  23. void selectionChosen(QListWidgetItem *p_item);
  24. private:
  25. void setupUI(const QString &p_title);
  26. void updateSize();
  27. int m_choice;
  28. QListWidget *m_list;
  29. };
  30. #endif // VSELECTDIALOG_H