FormOptionsWidget.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <QWidget>
  11. #endif
  12. QT_FORWARD_DECLARE_CLASS(QCheckBox)
  13. QT_FORWARD_DECLARE_CLASS(QFrame)
  14. namespace AzQtComponents
  15. {
  16. class CheckBox;
  17. }
  18. namespace O3DE::ProjectManager
  19. {
  20. class FormOptionsWidget : public QWidget
  21. {
  22. Q_OBJECT
  23. public:
  24. FormOptionsWidget(const QString& labelText,
  25. const QStringList& options,
  26. const QString& allOptionsText,
  27. int optionItemSpacing = 24,
  28. QWidget* parent = nullptr);
  29. void Clear();
  30. void Enable(const QString& option);
  31. void Enable(const QStringList& options);
  32. void Disable(const QString& option);
  33. void Disable(const QStringList& options);
  34. void EnableAll();
  35. QStringList GetOptions() const;
  36. private:
  37. int GetCheckedCount() const;
  38. QFrame* m_optionFrame = nullptr;
  39. QHash<QString, QCheckBox*> m_options;
  40. QCheckBox* m_allOptionsToggle = nullptr;
  41. };
  42. } // namespace O3DE::ProjectManager