You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr
I am raising this issue as a follow up to #1077 which was partially fixed in #1078. Qt::AA_EnableHighDpiScaling causes RenderWidget resize event to be 1/2 the proper size. Proposed fix in #1263.
Problem:
Since Qt 5.6 (see here), high DPI scaling can be handled automatically by setting the application attribute Qt::AA_EnableHighDpiScaling in the main.cpp of a Qt application.
// Enable support for high DPI screens QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
This makes gui design more homogeneous across screens (at least where pixel coordinates are concerned).
Unfortunately when I enable this attribute and am using librviz, the RenderWidget only fills 1/4 of the RenderPanel:
The rest of the space is filled with whatever was behind the RenderPanel upon a resize event.
When I do not set the AA_EnableHighDpiScaling attribute the RenderWidget displays properly, but the rest of the gui (not shown) is far too small:
The image above is scaled here but on my screen it is 2x smaller than it should be. This is because AA_EnableHighDpiScaling is not set.
Resolution:
I say this problem was partially fixed in #1078 because the AA_EnableHighDpiScaling is never used in rviz and the RenderWidget displays as expected.
I traced the problem to the resizeEvent() handler in RenderWidget:
voidRenderWidget::resizeEvent(QResizeEvent *e)
{
if( render_window_ )
{
// render_window_->writeContentsToFile() (used in// VisualizationFrame::onSaveImage()) does not work right for// window with an odd width, so here I just always force it to be// even.
render_window_->resize( width() + (width() % 2), height() );
render_window_->windowMovedOrResized();
}
}
When using AA_EnableHighDpiScaling, the functions width() and height() return the widget width and height with respect to a virtual pixel coordinate system and not the real pixel coordinate system. The Ogre::RenderWindow on the other hand is expressed in the real pixel coordiante system (I think...) and therefore only renders at 1/devicePixelRatio().
I have proposed a fix in #1263 which simply multiplies the width and height by the pixel ratio:
When not using AA_EnableHighDpiScaling, the widget fills the panel but it the whole gui is half the size, which is the expected behavior on high DPI screens.
The text was updated successfully, but these errors were encountered:
I tried the proposed fix on my Mac and it seems to work. Not sure if it is related to the issue described here when I try to do e.g. a Pose Estimate it only works in the upper right corner of the rendering area.
tl;dr
I am raising this issue as a follow up to #1077 which was partially fixed in #1078.
Qt::AA_EnableHighDpiScaling
causesRenderWidget
resize event to be 1/2 the proper size. Proposed fix in #1263.Setup:
kinetic-devel
Problem:
Since Qt 5.6 (see here), high DPI scaling can be handled automatically by setting the application attribute
Qt::AA_EnableHighDpiScaling
in themain.cpp
of a Qt application.This makes gui design more homogeneous across screens (at least where pixel coordinates are concerned).
Unfortunately when I enable this attribute and am using
librviz
, theRenderWidget
only fills 1/4 of theRenderPanel
:The rest of the space is filled with whatever was behind the
RenderPanel
upon a resize event.When I do not set the
AA_EnableHighDpiScaling
attribute theRenderWidget
displays properly, but the rest of the gui (not shown) is far too small:The image above is scaled here but on my screen it is 2x smaller than it should be. This is because
AA_EnableHighDpiScaling
is not set.Resolution:
I say this problem was partially fixed in #1078 because the
AA_EnableHighDpiScaling
is never used inrviz
and theRenderWidget
displays as expected.I traced the problem to the
resizeEvent()
handler inRenderWidget
:When using
AA_EnableHighDpiScaling
, the functionswidth()
andheight()
return the widget width and height with respect to a virtual pixel coordinate system and not the real pixel coordinate system. TheOgre::RenderWindow
on the other hand is expressed in the real pixel coordiante system (I think...) and therefore only renders at 1/devicePixelRatio()
.I have proposed a fix in #1263 which simply multiplies the width and height by the pixel ratio:
render_window_->resize( width()*pixel_ratio_ + (width()*pixel_ratio_ % 2), height()*pixel_ratio_ );
This results in a properly scaled
RenderWidget
:When not using
AA_EnableHighDpiScaling
, the widget fills the panel but it the whole gui is half the size, which is the expected behavior on high DPI screens.The text was updated successfully, but these errors were encountered: