MainWindow_mac.mm 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #import <Cocoa/Cocoa.h>
  9. #include <QWidget>
  10. void setCocoaMouseCursor(QWidget* widget)
  11. {
  12. if (widget == nullptr)
  13. {
  14. // no widget, default cursor
  15. [[NSCursor arrowCursor] set];
  16. }
  17. else
  18. {
  19. // otherwhise activate the Cocoa mouse
  20. // cursor matching the one set via Qt
  21. switch (widget->cursor().shape())
  22. {
  23. case Qt::ArrowCursor:
  24. [[NSCursor arrowCursor] set];
  25. break;
  26. case Qt::SizeHorCursor:
  27. case Qt::SplitVCursor:
  28. [[NSCursor resizeUpDownCursor] set];
  29. break;
  30. case Qt::SizeVerCursor:
  31. case Qt::SplitHCursor:
  32. [[NSCursor resizeLeftRightCursor] set];
  33. break;
  34. default:
  35. // for all other cursors we do nothing
  36. // since this is only to fix the splitter handle cursors for now
  37. break;
  38. }
  39. }
  40. }