ccEntitySelectionDlg.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. //##########################################################################
  3. //# #
  4. //# CLOUDCOMPARE #
  5. //# #
  6. //# This program is free software; you can redistribute it and/or modify #
  7. //# it under the terms of the GNU General Public License as published by #
  8. //# the Free Software Foundation; version 2 or later of the License. #
  9. //# #
  10. //# This program is distributed in the hope that it will be useful, #
  11. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  12. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  13. //# GNU General Public License for more details. #
  14. //# #
  15. //# COPYRIGHT: CloudCompare project #
  16. //# #
  17. //##########################################################################
  18. //qCC_db
  19. #include <ccHObject.h>
  20. //Qt
  21. #include <QDialog>
  22. class Ui_EntitySelectionDialog;
  23. //! Dialog to select one or multiple entities
  24. class ccEntitySelectionDialog : public QDialog
  25. {
  26. Q_OBJECT
  27. public:
  28. //! Default constructor
  29. ccEntitySelectionDialog(const ccHObject::Container& entities,
  30. bool multiSelectionEnabled,
  31. int defaultSelectedIndex = 0,
  32. QWidget* parent = nullptr,
  33. QString label = QString());
  34. //! Destructor
  35. virtual ~ccEntitySelectionDialog();
  36. //! Returns the selected index (unique selection mode)
  37. int getSelectedIndex() const;
  38. //! Returns the selected indexes (multi-selection mode)
  39. void getSelectedIndexes(std::vector<int>& indexes) const;
  40. //! Static shortcut: unique selection mode
  41. static int SelectEntity(const ccHObject::Container& entities,
  42. int defaultSelectedIndex = 0,
  43. QWidget* parent = nullptr,
  44. QString label = QString());
  45. //! Static shortcut: multi-selection mode
  46. static bool SelectEntities( const ccHObject::Container& entities,
  47. std::vector<int>& indexes,
  48. QWidget* parent = nullptr,
  49. QString label = QString());
  50. public:
  51. //! Selects all entities
  52. void selectAll();
  53. //! Selects all entities
  54. void selectNone();
  55. protected:
  56. //! Associated ui
  57. Ui_EntitySelectionDialog* m_ui;
  58. };