abhiarora
abhiarora

Reputation: 10430

Qt Application becomes larger than screen if QDockWidget becomes visible

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:

enter image description here

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.

enter image description here

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.

Upvotes: 1

Views: 158

Answers (0)

Related Questions