themeutils.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (C) 2021 by Felix Weilbach <felix.weilbach@nextcloud.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. #include "themeutils.h"
  15. FakePaintDevice::FakePaintDevice() = default;
  16. QPaintEngine *FakePaintDevice::paintEngine() const
  17. {
  18. return nullptr;
  19. }
  20. void FakePaintDevice::setHidpi(bool value)
  21. {
  22. _hidpi = value;
  23. }
  24. int FakePaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
  25. {
  26. switch (metric) {
  27. case QPaintDevice::PdmDevicePixelRatio:
  28. if (_hidpi) {
  29. return 2;
  30. }
  31. return 1;
  32. default:
  33. return QPaintDevice::metric(metric);
  34. }
  35. }