Unsolved Serious design problem in Qt 5.12?
-
Isn't there a serious design problem in Qt 5.12 with QWidget methods move(), resize() and setGeometry()?
These methods are not virtual, and yet they are redefined at least in subclass QRubberBand, which is a subclass of QWidget.
Redefining an inherited non-virtual method is a no-no - this is well explained for example by Scott Meyers, in Item 36 ("Never redefine an inherited non-virtual function") of his book "Effective C++" (3rd edition).
-
@dave2 You're right, the methods that you listed go against Meyers' Item 36. A slightly different but related case is
QObject::setParent(QObject *)
-- QWidget inherits QObject but it has a methodQWidget::setParent(QWidget *)
.What problems are you experiencing due to the redefinition?
-
Simply store it as QRubberBand pointer and not as QWidget pointer resolves the problem. It can't be changed until Qt7 (and I think it wont be changed then though).
-
@JKSH I am not experiencing any specific problem. I just noticed redefinition of non-virtual methods, and I thought I should report it.
-
@Christian-Ehrlicher Of course. See my answer to JKSH.
-
@dave2
you should actually rather report it over at bugreports.qt.ioThat's the official way to do it. And you should actually get an answer from one of the developers or maintainers
This is more of an user orientated forum after all :D
-