Blame toonz/sources/include/toonzqt/glwidget_for_highdpi.h
|
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 |
3cc41f |
#include "toonzqt/gutil.h"
|
|
shun_iwasawa |
7c988d |
|
|
shun_iwasawa |
7c988d |
// use obsolete QGLWidget instead of QOpenGLWidget for now...
|
|
shun_iwasawa |
7c988d |
// TODO: replace with the "modern" OpenGL source and transfer to QOpenGLWidget
|
|
Jeremy Bullock |
1ef2a2 |
class GLWidgetForHighDpi : public QOpenGLWidget {
|
|
shun_iwasawa |
7c988d |
public:
|
|
shun_iwasawa |
339330 |
GLWidgetForHighDpi(QWidget *parent = Q_NULLPTR,
|
|
Jeremy Bullock |
1ef2a2 |
const QOpenGLWidget *shareWidget = Q_NULLPTR,
|
|
shun_iwasawa |
339330 |
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 |
7c988d |
};
|
|
shun_iwasawa |
7c988d |
|
|
shun_iwasawa |
7c988d |
#endif
|