In the QT application i'm developing i have the following problem.
In the main window i have some layouts and a splitter with widget that work perfectly.
Now, one of those widgets is a custom widget.
What i need is to put some scrollbars to this Widget. This widget holds a Qimage which is painted with a QPainter object within the widget using the paintevent. Sometimes this image is huge, so that's why i want the scrollbars, to scroll this image.
What i did. Was to create a QScrollArea in the mainWindow.
Then i used setWidget to set the customWidget "inside" the scrollArea.
Then i put the scrollArea inside the layout where the widget used to be:
viewer = new cSpriteViewer(); viewerScroller = new QScrollArea; viewerScroller->setWidget(viewer); viewerScroller->setWidgetResizable(true); viewerScroller->setBackgroundRole(QPalette::Dark); . . mainSplitter->addWidget(viewerScroller); setCentralWidget(mainSplitter);
But it's not working. There are no scrollbars, and i have to resize the window to see the entire image (except when the image is bigger than my desktop resolution).