Qt: Set display window size on context create not constructor

The size isn't known at construction time.
This commit is contained in:
Connor McLaughlin 2020-02-16 00:15:00 +09:00
parent cd2f6d1f68
commit e48e6141c8

View file

@ -7,8 +7,6 @@
QtDisplayWindow::QtDisplayWindow(QtHostInterface* host_interface, QWindow* parent)
: QWindow(parent), m_host_interface(host_interface)
{
m_window_width = static_cast<int>(static_cast<qreal>(width()) * devicePixelRatio());
m_window_height = static_cast<int>(static_cast<qreal>(height()) * devicePixelRatio());
}
QtDisplayWindow::~QtDisplayWindow() = default;
@ -30,6 +28,9 @@ bool QtDisplayWindow::createDeviceContext(QThread* worker_thread, bool debug_dev
bool QtDisplayWindow::initializeDeviceContext(bool debug_device)
{
m_window_width = static_cast<int>(static_cast<qreal>(width()) * devicePixelRatio());
m_window_height = static_cast<int>(static_cast<qreal>(height()) * devicePixelRatio());
if (!createImGuiContext() || !createDeviceResources())
return false;