Well, I comment with more details the problems that I have noticed with the scroll area of this new version (4.1.0). I have subclassed QScrollArea because I need to reimplement the method paintEvent. I put an instance of this class as a central widget of a main window. I want that the first time that appears the main window is in full screen, calling QMainWindow::setWindowState(Qt::WindowMaximized). Well, I subclass QWidget because i want to paint under the widget a image with qpainter on the paint event of the iwdget. I put this widget inside the scroll area with ScrollArea::setWidget method. And here comes the main problem: the paintEvent of the scroll area only is called the first time the scroll area is shown: if I try to resize the main window, the paint event of the scroll area is not called while in version 4.0.1 was called everytime I resized the main window. I find it very strange . For example if i put the next code in the paintEvent of the scroll area:
void FotoAreaEditorFotos
::paintEvent(QPaintEvent *event
) {
FotoEditorFotos *foto = widget();
if (foto)
foto -> resize(viewport() -> width(), viewport() -> height());
}
void FotoAreaEditorFotos::paintEvent(QPaintEvent *event)
{
FotoEditorFotos *foto = widget();
if (foto)
foto -> resize(viewport() -> width(), viewport() -> height());
}
To copy to clipboard, switch view to plain text mode
"FotoAreaEditorFotos" is my subclass of "QScrollArea" and "FotoEditorFotos" is the widget that i insert in the scroll area. I have reimplemented the functions widget() and setWidget() of my scroll area to only permit insert and return instances of "FotoEditorFotos" class.
The rersult of this example code should resize the widget that manages the scroll area to the viewport's size everytime the paint event is called. So, in theory, if i resize the main window, the paint event method has to be called and, so, the widget of the scroll area should be resized to the new viewport's size. Well in the partice, the result of this code is that the widget is resized only the first time: when I try to reduce the size of the main window (the first time is shown at full screen), appears the scroll bars on the scroll area meaning that the widget has not been resized to new viewport's size.
I hope this time all this explanation could help to find my problem. Thanks.
Bookmarks