Results 1 to 10 of 10

Thread: Unexplained Segmentation Fault with QDialog::show() and QDialog::exec()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    5
    Thanked 86 Times in 81 Posts

    Default Re: Unexplained Segmentation Fault with QDialog::show() and QDialog::exec()

    Quote Originally Posted by powerofpi View Post
    Thank you for your ideas.

    1) & 4) The reason I emit a signal on accept() is because I need to get the index of the spinbox that was selected. If there's a better way to do this, let me know!

    2) Why would this be a bad thing? I need to free the memory before the dialog ceases to exist, right?
    2) When a QObject are destroyed, it delete all children. You have not need to delete them explicitly

    For the 1) I suggest you to define a difficulty() public methods that returns m_difficulty and call it after exec from calling code

    Qt Code:
    1. // For modal Dialog (exec()) you can use a stack variable
    2. GenerateNewDialog dlg(this);
    3.  
    4. if (QDialog::Accepted == generateNewDialog.exec()) {
    5. difficulty = dlg.difficulty();
    6. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by mcosta; 25th February 2011 at 23:56. Reason: spelling corrections
    A camel can go 14 days without drink,
    I can't!!!

Similar Threads

  1. QDialog.exec() exiting without calling QDialog::accept()
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2011, 11:35
  2. QDialog problem with exec()
    By nomadscarecrow in forum Qt Programming
    Replies: 3
    Last Post: 23rd April 2010, 18:40
  3. exec() not blocking, derived QDialog, Qt 4.4.3
    By wdezell in forum Qt Programming
    Replies: 2
    Last Post: 4th August 2009, 18:56
  4. problem with show/exec of Qdialog
    By dudedude in forum Qt Programming
    Replies: 1
    Last Post: 23rd December 2008, 11:20
  5. QDialog: show() and exec() together in constructor?
    By Teuniz in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2007, 11:43

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