Results 1 to 3 of 3

Thread: Issue deleting and replacing 3Dscatter and 3DSurface plots in Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,349
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: Issue deleting and replacing 3Dscatter and 3DSurface plots in Qt

    With just a quick read, the only thing that sticks out is this in line 8 of your last code block:
    Qt Code:
    1. delete m3DImageHolder;
    To copy to clipboard, switch view to plain text mode 
    instead of:
    Qt Code:
    1. m3DImageHolder->deleteLater();
    To copy to clipboard, switch view to plain text mode 
    Calling delete on a QWidget instance that may still be in use (even though in the previous statement you removed it from what is presumably a parent object) does not allow the Qt event loop to run and process any events associated with either removing the instance or deleting it because delete immediately invalidates the instance and its contents. Calling QObject::deleteLater() schedules the instance for deletion during a future cycle through the event loop, but also allows Qt to first process any events the removal causes using the still-valid instance.
    Last edited by d_stranz; 9th July 2020 at 18:06.
    <=== 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.

  2. The following user says thank you to d_stranz for this useful post:

    Stophe (13th July 2020)

  3. #2
    Join Date
    Jul 2020
    Posts
    11
    Qt products
    Qt5
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: Issue deleting and replacing 3Dscatter and 3DSurface plots in Qt

    Quote Originally Posted by d_stranz View Post
    With just a quick read, the only thing that sticks out is this in line 8 of your last code block:
    Qt Code:
    1. m3DImageHolder->deleteLater();
    To copy to clipboard, switch view to plain text mode 
    Thanks for this advice ! I'll be carefull about that now.
    I've applied this patch, but unfortunately... I still get the same error.
    I changed to
    Qt Code:
    1. if(m3DImageHolder) {
    2. m3DLayoutHolder->removeWidget(m3DImageHolder);
    3. m3DImageHolder->deleteLater();
    4. m3DImageHolder = nullptr;
    5. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Stophe; 13th July 2020 at 12:05.

Similar Threads

  1. QHttp Post work inkorect
    By Pablik in forum Qt Programming
    Replies: 12
    Last Post: 29th January 2013, 12:19
  2. Testing Qt-Software with a GUI Testing Tool
    By nightghost in forum Qt Programming
    Replies: 8
    Last Post: 22nd February 2012, 07:43
  3. Replies: 6
    Last Post: 25th May 2010, 10:42
  4. GUI Testing
    By larry104 in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2007, 13:46

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
  •  
Qt is a trademark of The Qt Company.