Results 1 to 2 of 2

Thread: QGLWidget deleted at startup

  1. #1
    Join Date
    Aug 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGLWidget deleted at startup

    I regularly use subclasses of QGLWidget as the central widget in a QMainWindow. But now I have one that somehow is getting deleted -- not by my code -- at program startup. The main window ctor creates the widget apparently OK, and it still look OK when its resize handler gets called (as expected) when main() issues show() for main window; but as soon as main calls app.exec() its dtor gets called with a deferred_delete message.

    The class in question is an elaboration of one I have used sucessfully in another program, so I guess the problem has to do with something I changed. I'm gradually rolling back those changes but have not yet found the critical one.

    But what I want to ask here is the general question: has anyone heard of a QGLWidget deleting itself? Or know why the meta-object or window system might do that?

    Thanks, Tom


    Added after 16 minutes:


    Update: the problem may not be in my QGLwidget subclass, as the identical code still runs OK in the older app. Both main and MainWindow are different in the new app, so that's where I'm looking now.


    Added after 11 minutes:


    FIXED by moving create/install QGLWidget after GUI setup in MainWindow c'tor. A C++ problem I guess.

    But still, who deleted the object, and why?
    Last edited by tksharpless; 6th August 2012 at 20:53.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGLWidget deleted at startup

    Why two identical posts? See my reply to the later one: http://www.qtcentre.org/threads/5041...ted-at-startup
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QTextEdit not deleted when implemented as list
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 5
    Last Post: 24th June 2011, 07:46
  2. Controls are automaticaly deleted in QWizardPage
    By ranna in forum Qt Programming
    Replies: 0
    Last Post: 15th May 2009, 10:15
  3. Makefile deleted automatically
    By raghvendramisra in forum Qt Tools
    Replies: 0
    Last Post: 6th May 2008, 06:24
  4. why bitBlt() deleted in Qt4
    By iGoo in forum Qt Programming
    Replies: 1
    Last Post: 27th June 2006, 09:59

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.