Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.7, 6.8
-
None
-
fc4c6fb5f (dev), 705dbea2a (6.8), a007c5aa0 (6.7)
Description
The virtual function QWidget::setVisible(bool) has earlier always been called when the visibility status of a widget changed. So it has been used as a way to do lazy initialization in a custom widget: implement a setVisible() override and do the init there, just before the widget gets shown. However, after https://codereview.qt-project.org/c/qt/qtbase/+/536262 this no longer works. This has resulted in https://bugreports.qt.io/browse/QTBUG-126218, since QPrintPreviewWidget used that mechanism.
Now the doc of setVisible() is pretty clear that overriding that function is not the way to go; instead it recommends showEvent() etc. So the choice in QPrintPreviewWidget was presumably not so smart. And presumably it not so hard to fix/workaround, although there may be some BIC complexities. Nonetheless there are some issues here:
- There are ~20 other overridden setVisible() functions in qtbase alone - are we sure this behavior change do not cause issues with any of those?
- Are we comfortable inducing this behavior change on users?
Attachments
Issue Links
- resulted in
-
QTBUG-126218 Preview is not generated when QPrintPreviewWidget is shown
- Closed