Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Serious design problem in Qt 5.12?

Serious design problem in Qt 5.12?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 514 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dave2
    wrote on last edited by
    #1

    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).

    1 Reply Last reply
    1
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by JKSH
      #2

      @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 method QWidget::setParent(QWidget *).

      What problems are you experiencing due to the redefinition?

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      D 1 Reply Last reply
      1
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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).

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        D 1 Reply Last reply
        1
        • JKSHJ JKSH

          @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 method QWidget::setParent(QWidget *).

          What problems are you experiencing due to the redefinition?

          D Offline
          D Offline
          dave2
          wrote on last edited by
          #4

          @JKSH I am not experiencing any specific problem. I just noticed redefinition of non-virtual methods, and I thought I should report it.

          J.HilkJ 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            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).

            D Offline
            D Offline
            dave2
            wrote on last edited by
            #5

            @Christian-Ehrlicher Of course. See my answer to JKSH.

            1 Reply Last reply
            0
            • D dave2

              @JKSH I am not experiencing any specific problem. I just noticed redefinition of non-virtual methods, and I thought I should report it.

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @dave2
              you should actually rather report it over at bugreports.qt.io

              That'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


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              D 1 Reply Last reply
              4
              • J.HilkJ J.Hilk

                @dave2
                you should actually rather report it over at bugreports.qt.io

                That'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

                D Offline
                D Offline
                dave2
                wrote on last edited by
                #7

                @J-Hilk Done (https://bugreports.qt.io/browse/QTBUG-90561).

                1 Reply Last reply
                2

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved