I have old Qt C++ Application which works perfectly in Desktop or Laptop. I am now trying to make it work in a High DPI touchscreen embedded device having 10 inch screen having 1920 X 1200 Resolution. The device is running Windows 10. I am using MXE to cross-compile for Windows in my Ubuntu machine.
Following the suggestion given over here, I added following lines to automatically scale my application.
static const char ENV_VAR_QT_DEVICE_PIXEL_RATIO[] = "QT_DEVICE_PIXEL_RATIO";
if (!qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO)
&& !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR")
&& !qEnvironmentVariableIsSet("QT_SCALE_FACTOR")
&& !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
}
The application starts with right size:
However, when I make settingWidget visible which is added to QDockWidget, then the application becomes larger than the screen size. I am unable to understand the source of problem.
The codebase is very large if someone wants to review the code then they have to help me with the code fragment which may have the bug and I will shall post it here.
Related
I have an embedded device where I use Qt 5.9 and Weston. Weston has to use fbdev backend (reasons out of scope) and needs
transform=90
in its output section, otherwise the screen is rotated. It runs fine, but I am unable to get a propper screen size in Qt. To run my application in fullscreen in Qt 5.8 I used:
auto geometry = QGuiApplication::screens().first()->geometry();
view.setGeometry(geometry);
and it was ok. With Qt 5.9 the screen reports its size transposed, so I would have to use
auto geometry = QGuiApplication::screens().first()->geometry();
geometry = geometry.transposed();
view.setGeometry(geometry);
This runs fine again, but the application is no longer portable. I use it on other platforms as well, all work without correctly without transposing.
Looking into the weston log I see
fbdev output 480×854 px
which corresponds to what I get in Qt now. But how to properly detect the rotation caused by transform=90?
I am using multiple monitors on my PC. One of them is a TV. When I launch my application on my regular monitors, the application gets scaled properly.
However, when I run the application in fullscreen on my TV, the resolution will be too large and the output shows partially on another screen (see the blue colored output in my screenshot).
The TV is connected via HDMI and uses the same resolution as the other screens (1920x1080). It seems to be a software issue, because the output is partially visible on another screen.
I am using the following code to toggle fullscreen mode:
SDL_SetWindowFullscreen( m_Window, SDL_WINDOW_FULLSCREEN );
Any ideas on how to solve this issue?
UPDATE
When I make the TV my main display in Windows, it seems to fit properly on the TV. However, it still shows partially on the other screen (but this time it shows twice) and the mouse positioning is incorrect on the TV. Maybe the resolution is changed differently?
UPDATE 2
Windows 10 allows font sizes to be changed on a monitor. This is why my resolution detection in SDL2 identified a different resolution for my TV. Now I need to find a way to work around this.
Update 1&2: Check bottom of question
I have several games (built with Visual Studio 2012 C++ under Windows 8.0) on the Windows Store. These games have worked fine under Windows 8.0 and 8.1. Recently customers complained that, under Windows 10, the image is not centered and part of it 'spills' outside the screen.
I have reproduced the problem by installing Visual Studio 2012 Update 4 under Windows 10. The problem is that the window coordinates reported by the OS are about 20% larger than what they should be. For example, mouse move events on a 1366x768 window report coordinates up to 1645.783 x 925.301. The only time the window dimensions are correct (as obtained by CoreWindow::Bounds) is when the app first starts up -- any resize event will mess them up (mouse events are never correct).
The same issue occurs even if I create a blank new project based on the "Visual C++ >> Windows Store >> Direct3D App" template.
The "size of text, apps, and other items" option in Windows 10 is set to 100%, so I can't see how this could be a scaling issue.
Does anyone know why this is happening?
UPDATE 1: Upon further testing, this problem occurs only when the desktop resolution height is less than 942 pixels (width is irrelevant). For example, on a 1366x768 desktop the problem occurs, but on a 1280x960 it doesn't.
UPDATE 2: This really looks like a Windows 10 bug. Does anyone know how it can be reported to Microsoft?
I have a full screen QT OpenGL application which needs to display the virtual keyboard (tabTip.exe) when input textboxes are entered. The problem I'm facing is that the virtual keyboard appears behind the application when the keyboard is invoked. I have tried many different things and found that the only way I can make it appear in front, is if my window is not fullscreen (e.g. making it 1 pixel less than full screen in the width and/or height). If I have the tablet in portrait mode this also still displays the keyboard even in full screen.
Now I'm trying to figure out if this is a driver issue, Qt issue, OpenGL issue or general windows issue.
Any suggestions?
Update:
I have investigated this a bit further and I think I see what's going on.
Windows 8, upon detecting that the monitor rotation is set to zero, and that it has an OpenGL window that matches the desktop resolution and covers the whole screen, kicks into legacy mode that blocks any Windows 8 themed animations from running (including virtual keyboard).
Do you have any suggestions on how I can stop windows from doing this? DwmEnableComposition has been removed in windows 8.
I am experiencing some undesirable behavior while running these OpenGL examples (click the download to get access to the visual studio solution). Everything compiles correctly, but when running tutorial 3, the window cuts off the top and right side of the triangle. (Shown Here)
I have run this demo on Ubuntu and Mac before with no problems. I have not tried this on Windows 7 or below. In no way have I modified the code or the project. Also when I bring freeglut into fullscreen, the triangle is not cutoff at all.
Am I missing something or is this a new setback to using windows 8 and freeglut? Has any one else had this problem?
Most likely it is a bug. In Windows, when you specify the size of the window, the size is including system borders. Therefore the effective client area (black area in your screenshot) is less than the original size requested, and this problem propagates to glViewport. When these two do not match, you experience those cuts.
There are two opportunities for a fix. i. make adjustments to free-glut so it correctly respects requesting a window-size by their client area ii. adjust glviewport to adhere to the actual client area.