Login  Register

Re: Object not deleted in main/qc_applicationwindow.cpp

Posted by R. van Twisk on Jul 24, 2011; 4:42pm
URL: https://forum.librecad.org/Object-not-deleted-in-main-qc-applicationwindow-cpp-tp4627858p4628268.html

Claude,

al Qt examples I have just looked at are creating the painter on the stack,
except the project called dbscreen (it does soem fnacy bitblk's....

This give me the impression that it's fine to create a QPainter on the stack.

RS_PainterQt extends QPainter and RS_Painter, RS_Painter.

RS_Painter is a abstract class and only holds 

    /**
     * Current drawing mode.
     */
    RS2::DrawingMode drawingMode;
    /**
     * A fixed offset added to all entities drawn (useful for previews).
     */
    RS_Vector offset;

So in terms of memory usage, I think it's neglect-able, no long arrays
are anything are stored in a RS_PAinterQT.

Ries

On Jul 24, 2011, at 9:39 AM, ClaudeQC [via LibreCAD] wrote:


On 24/07/2011 09:15, R. van Twisk [via LibreCAD] wrote:

 > Claude,
 >
 > what if we just do it like this??
 > This way we don't have to worry about deleting the painter at all.
 >

Hello Ries,

- I don't like creating objects in the stack.
   Prefer to create them in the heap memory (with new).

- I don't know RS_PainterQt class.
   If this class is not too big in term of data memory usage, it may be
   acceptable to create associated objects in the stack.


Claude





If you reply to this email, your message will be added to the discussion below:
http://librecad.1049103.n5.nabble.com/Object-not-deleted-in-main-qc-applicationwindow-cpp-tp4627858p4628044.html
To start a new topic under LibreCAD, email [hidden email]
To unsubscribe from LibreCAD, click here.