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. Semantic isue: ~[className] overrides a destructor but is not marked 'override'
Forum Updated to NodeBB v4.3 + New Features

Semantic isue: ~[className] overrides a destructor but is not marked 'override'

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 463 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    arsinte_andrei
    wrote on last edited by
    #1

    Why if I subclass a class like QDialog, QWidget, QMainWindow.... (possible all that came from qWidget)
    and if I include in the header file a

    virtual void accept() override;
    

    or

    void mousePressEvent(QMouseEvent *event) override;
    

    or any other override function then is showing that I have also to do the same with the destructor... is that right?? none of the Qt examples shows that...

    How is proper to write destructors in Qt????

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

      This is a new warning in the current gcc9 (or clang) compiler which is explicitly disabled in Qt code since it's not very useful. But there are are lot of discussions around this, see e.g. here: https://github.com/isocpp/CppCoreGuidelines/issues/721

      Qt will not annotate destructors with the override keyword afaik (can't find the discussion on qt-interest atm...)

      /edit: found it: https://lists.qt-project.org/pipermail/development/2018-August/033437.html

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

      1 Reply Last reply
      3

      • Login

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