CustomAspectRatioDlg.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. // Description : A dialog for getting an aspect ratio info from users
  9. // Notice : Refer to ViewportTitleDlg cpp for a use case
  10. #include "EditorDefs.h"
  11. #include "CustomAspectRatioDlg.h"
  12. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  13. #include <ui_CustomAspectRatioDlg.h>
  14. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  15. #define MIN_ASPECT 1
  16. #define MAX_ASPECT 16384
  17. CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=nullptr*/)
  18. : QDialog(pParent)
  19. , m_xDefault(x)
  20. , m_yDefault(y)
  21. , m_ui(new Ui::CustomAspectRatioDlg)
  22. {
  23. m_ui->setupUi(this);
  24. setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
  25. OnInitDialog();
  26. }
  27. CCustomAspectRatioDlg::~CCustomAspectRatioDlg()
  28. {
  29. }
  30. void CCustomAspectRatioDlg::OnInitDialog()
  31. {
  32. m_ui->m_x->setRange(MIN_ASPECT, MAX_ASPECT);
  33. m_ui->m_x->setValue(m_xDefault);
  34. m_ui->m_y->setRange(MIN_ASPECT, MAX_ASPECT);
  35. m_ui->m_y->setValue(m_yDefault);
  36. }
  37. int CCustomAspectRatioDlg::GetX() const
  38. {
  39. return m_ui->m_x->value();
  40. }
  41. int CCustomAspectRatioDlg::GetY() const
  42. {
  43. return m_ui->m_y->value();
  44. }
  45. #include <moc_CustomAspectRatioDlg.cpp>