Important: Please read the Qt Code of Conduct -

What widgets to start with to create Image Display with the following requirements

  • Hi,
    I would like to create a image display widget with the following requirements:

    1. I would like to set the widgets inside a ScrollArea widget, and then set the ScrollArea as the central widgets of the main window.

    2. I would like to make this image display widget able to change number of displayed images from 1x1 to 8x8 maximum grid layout(this still inside the ScrollArea), each individual displayed image should be within "frames" and capable of independently resize, move and other operations(just the display not actually change the image file).

    3. The scroll bar should appear when all the displayed images in the grid gets larger than the current field of view. Scroll bar is not necessary for individual displayed images.

    Currently I have created a widget based on QWidgets, that has a QGridLayout (Let's call this the CanvasWidget) to handle more QWidgets that displays images(Let's call this the DisplayWidget). I can resize CanvasWidgets and the scoll bar work fine, but I can't seem to find a way to resize DisplayWidget, or Move a individual DisplayWidget around inside the CanvasWidget with the mouse.

    Any input would be greatly appreciated.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    It rather sounds like a job for the Graphics View Framework or Qt Quick

  • @SGaist Hi, Thanks for the input!

    I looked at the Graphics View Framework some time ago, but the example I looked at actually display something different than images, also, in the example here: the 4 display areas are somewhat separated from each other, I would like to make it into a single widget, and reconfigurable, i.e. the user will be able to choose how many display areas he wants, it could be just one, or it could 4 in a layout of 2x2. Would that be possible with the graphics view framework?

    Thanks again.

  • Lifetime Qt Champion

    Well, for the 2x2 grid just add 4 QGraphicsPixmapItem at the right positions and you have it

  • @SGaist That does sound like a viable way to do it, I am going to try that out, and let you guys know how it works.