ccItemSelectionDlg.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  4. //# #
  5. //# This program is free software; you can redistribute it and/or modify #
  6. //# it under the terms of the GNU General Public License as published by #
  7. //# the Free Software Foundation; version 2 or later of the License. #
  8. //# #
  9. //# This program is distributed in the hope that it will be useful, #
  10. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  11. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  12. //# GNU General Public License for more details. #
  13. //# #
  14. //# COPYRIGHT: Daniel Girardeau-Montaut #
  15. //# #
  16. //##########################################################################
  17. #ifndef CC_ITEM_SELECTION_DIALOG_HEADER
  18. #define CC_ITEM_SELECTION_DIALOG_HEADER
  19. #include <ui_itemSelectionDlg.h>
  20. //qCC_db
  21. #include <ccHObject.h>
  22. //! Dialog to select one or multiple items
  23. class ccItemSelectionDlg : public QDialog, public Ui::ItemSelectionDlg
  24. {
  25. Q_OBJECT
  26. public: //static shortcuts
  27. //! Static shortcut: unique selection mode
  28. static int SelectEntity(const ccHObject::Container& entities,
  29. int defaultSelectedIndex = 0,
  30. QWidget* parent = nullptr,
  31. QString label = QString());
  32. //! Static shortcut: multi-selection mode
  33. static bool SelectEntities( const ccHObject::Container& entities,
  34. std::vector<int>& indexes,
  35. QWidget* parent = nullptr,
  36. QString label = QString());
  37. public:
  38. //! Default constructor
  39. ccItemSelectionDlg( bool multiSelectionEnabled,
  40. QWidget* parent = nullptr,
  41. QString itemName = "entities",
  42. QString label = QString());
  43. //! Sets the list of items
  44. void setItems(const QStringList& items, int defaultSelectedIndex = 0);
  45. //! Returns selected index (unique selection mode)
  46. int getSelectedIndex() const;
  47. //! Returns selected indexes (multi-selection mode)
  48. void getSelectedIndexes(std::vector<int>& indexes) const;
  49. };
  50. #endif //CC_ITEM_SELECTION_DIALOG_HEADER