[Interest] Clarification re destructor in subclass of QWidget
samjnaa at gmail.com
Thu Aug 16 18:08:51 CEST 2012
Hello. I'm writing a program to interface with a drawing library and
output its results to screen using Qt (you might have noticed my
previous post with a minimal example of input/output/error tabs). Upon
clicking a push button "Execute", the app will send the input field
contents to the library and write its output and error messages into
the respective fields. If it successfully processes the instructions,
the drawing output by the library in SVG format to a separate stream
will be drawn using a QSVGWidget on screen.
Now the drawing library needs initiation before using it and cleanup
while closing down the application. And since I have to connect the
clicked() signal of the execute pushbutton to a executeCommands custom
slot, I am subclassing MainWindow from QWidget, so I have included the
library initiation into the constructor of MainWindow.
My question: I am assuming that I have to include the library cleanup
call in the destructor of MainWindow, but if I write a custom
destructor, do I have to do any other delete calls to remove objects
that are created on the heap in the constructor using new QTabWidget
etc? If I don't have to call the library cleanup manually, could I
simply leave out the destructor and the compiler will create the
appropriate instructions itself?
More information about the Interest