GoToButton.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 "GoToButton.h"
  9. #include <native/ui/ui_GoToButton.h>
  10. namespace AssetProcessor
  11. {
  12. GoToButton::GoToButton(QWidget* parent) : QWidget(parent), m_ui(new Ui::GoToButton)
  13. {
  14. m_ui->setupUi(this);
  15. m_ui->goToPushButton->installEventFilter(this);
  16. }
  17. GoToButton::~GoToButton()
  18. {
  19. }
  20. bool GoToButton::eventFilter(QObject* watched, QEvent* event)
  21. {
  22. QPushButton* button = qobject_cast<QPushButton*>(watched);
  23. if (!button)
  24. {
  25. return false;
  26. }
  27. if (event->type() == QEvent::Enter)
  28. {
  29. button->setIcon(QIcon(":/AssetProcessor_goto_hover.svg"));
  30. return true;
  31. }
  32. else if (event->type() == QEvent::Leave)
  33. {
  34. button->setIcon(QIcon(":/AssetProcessor_goto.svg"));
  35. return true;
  36. }
  37. return false;
  38. }
  39. }