Important: Please read the Qt Code of Conduct -

Slow resizing dialog box

  • Greetings.

    I have a dialog box that displays an image and several other widgtes (Buttons, GroupBox, ListWidget, ect). The dialog can be resized manually by the user.

    Well, when the dialog shows large images (3000x4000) there is a clear lag (ie resizing the dialog is slow) when trying to resize the dialog. When tasting with smaller images (for example, 500x600) no such problem.

    I guess the lag is due to the size of the images, the problem is that the images with which the application works are precisely of 3000x4000 (or similar size). How I can avoid this lag?

    Thanks in advance for any help and / or suggestions.

  • A couple of possibilities:
    1. Don't resize the image until resizing of the dialog is finished. I have seen that behavior with other software.
    Maybe there is a setting for this, I would probably try to hack something together using "QObject::blockSignals": or by reimplementing the resize/update function of the widget.

    2. The images size may be huge, but does the representation inside your dialog have to be? "QImage::scaled": respectively "QPixmap::scaled": would offer you the ability to limit the view onto the image to something more reasonable. A desktops resolution might be a good point of reference, since more won't be of any advantage anyway.

    3. Correlated to the other two: While resizing the window show a placeholder image with a much lower resolution (750*1000 could speed things up by about a factor of ten). This should keep the interface snappy and you still have a good idea of what happens to the image. Of course, after resizing is finished, you need to go back to the original image. Unless you decide to take route two, where that lower resolution might be all you need.

Log in to reply