shun_iwasawa 7c988d
#pragma once
shun_iwasawa 7c988d
shun_iwasawa 7c988d
#ifndef GLWIDGET_FOR_HIGHDPI_H
shun_iwasawa 7c988d
#define GLWIDGET_FOR_HIGHDPI_H
shun_iwasawa 7c988d
Jeremy Bullock 1ef2a2
#include <qopenglwidget></qopenglwidget>
shun_iwasawa 7c988d
#include <qapplication></qapplication>
shun_iwasawa 7c988d
#include <qdesktopwidget></qdesktopwidget>
shun_iwasawa 5e0d4f
#include <qopenglfunctions></qopenglfunctions>
shun_iwasawa 3cc41f
#include "toonzqt/gutil.h"
shun_iwasawa 7c988d
shun_iwasawa 5e0d4f
class GLWidgetForHighDpi : public QOpenGLWidget, protected QOpenGLFunctions {
shun_iwasawa 7c988d
public:
otakuto fb3573
  GLWidgetForHighDpi(QWidget *parent   = nullptr,
shun_iwasawa 5e0d4f
                     Qt::WindowFlags f = Qt::WindowFlags())
Jeremy Bullock 1ef2a2
      : QOpenGLWidget(parent, f) {}
shun_iwasawa 7c988d
shun_iwasawa 7c988d
  //  modify sizes for high DPI monitors
Jeremy Bullock 1ef2a2
  int width() const { return QOpenGLWidget::width() * getDevPixRatio(); }
Jeremy Bullock 1ef2a2
  int height() const { return QOpenGLWidget::height() * getDevPixRatio(); }
shun_iwasawa 7c988d
  QRect rect() const { return QRect(0, 0, width(), height()); }
shun-iwasawa f2e168
  int getDevPixRatio() const { return getDevicePixelRatio(this); }
shun_iwasawa 7c988d
};
shun_iwasawa 7c988d
shun_iwasawa 7c988d
#endif