ImagePopup.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #include "ImagePopup.h"
  9. AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
  10. #include <Source/Editor/ui_ImagePopup.h>
  11. #include <QLabel>
  12. #include <QPixmap>
  13. AZ_POP_DISABLE_WARNING
  14. namespace ImageProcessingAtomEditor
  15. {
  16. ImagePopup::ImagePopup(QImage previewImage, QWidget* parent /*= nullptr*/)
  17. : QDialog(parent, Qt::Dialog | Qt::FramelessWindowHint | Qt::Popup)
  18. , m_ui(new Ui::ImagePopup)
  19. {
  20. m_ui->setupUi(this);
  21. m_previewImage = previewImage;
  22. if (!m_previewImage.isNull())
  23. {
  24. int height = previewImage.height();
  25. int width = previewImage.width();
  26. this->resize(width, height);
  27. m_ui->imageLabel->resize(width, height);
  28. QPixmap pixmap = QPixmap::fromImage(previewImage);
  29. m_ui->imageLabel->setPixmap(pixmap);
  30. this->setFocusPolicy(Qt::FocusPolicy::NoFocus);
  31. this->setModal(false);
  32. }
  33. }
  34. ImagePopup::~ImagePopup()
  35. {
  36. }
  37. }//namespace ImageProcessingAtomEditor
  38. #include <Source/Editor/moc_ImagePopup.cpp>