qtqt4symbianprogress-bargrid-layout

How to place one widget over another in Qt


I have a window in Qt on which I am drawing a picture. Now I want to place a progressbar over it.

Steps I am aiming to do

  1. Create a window

  2. Draw a picture in the paint event of the window

  3. Then create a QGridLayout, add it to the window

  4. Display over it.

Suppose I want to add a progress bar over a portion of the picture window. How can I do that?

I don't think it is possible to implement it in the window's paint event.


Solution

  • You can add the progress bar as child of your QWidget without adding it in the layout. This will draw the QProgressBar into the QWidget. Since you are not using the layout you will have to manually manage the position of the QProgressBar.