Results 1 to 8 of 8

Thread: Signal doubleClicked(QModelIndex) crashes application on next accepted() signal.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Signal doubleClicked(QModelIndex) crashes application on next accepted() signal.

    Quote Originally Posted by ChrisW67 View Post
    Put a breakpoint in each of the functions: ListaAng::rSelect(), void widget::tabelSql, widget::ferVizAng() and curatare().
    Run your program in the debugger. Single step until it crashes then you will know what your program did to deserve it.

    My money is on whatever you are hiding in curatare().
    Really though, refreshing the content of the table should involve causing the QSqlQueryModel to requery the data, not stuffing around with new widgets and layouts.
    Qt Code:
    1. // QSqlQueryModel *model;
    2.  
    3. model->setQuery(model->query());
    To copy to clipboard, switch view to plain text mode 
    curatare() contains the following:
    Qt Code:
    1. QLayoutItem *child;
    2. while ((child = layoutCentral->takeAt(0)) != 0) {
    3. delete child->widget();
    4. delete child;
    5. }
    To copy to clipboard, switch view to plain text mode 

    Which removes any widgets that are in my central widget, but this is only called when I trigger menu actions and not when I refresh the table, I will try first your solution as is it now I am remaking the tableview entirely.
    And it only cause my app to crash after calling rSelect(QModelIndex) from doubleClick, if I call it from shortcut(QKeySequence) it does not crash.


    Update:

    Solved the issue, thank you both.
    I restructured my code, and now I am just resetting the query as you,ChrisW67, said; also as you both seen I was calling both tabelSql() and ferVizAng() from widget and when semnalAct(QString) signal was emited the app would do tabelSql()(trying to clean the central widget and remaking the whole table) all over again which here is where my app was crashing.

    Now I moved the ferVizAng() slot inside table file and just reseting the query when I press the accept button.

    Again thank you both for the assistance
    Last edited by adutzu89; 11th February 2014 at 08:36.

Similar Threads

  1. Replies: 2
    Last Post: 28th December 2010, 09:59
  2. Replies: 4
    Last Post: 10th December 2009, 14:54
  3. QTableView doubleclicked event not working
    By sgmurphy19 in forum Qt Programming
    Replies: 6
    Last Post: 15th March 2009, 10:00
  4. QTreeView::doubleClicked(const QModelIndex&) signal
    By Vladimir in forum Qt Programming
    Replies: 5
    Last Post: 6th July 2007, 09:25
  5. QTreeWidget and doubleClicked signal
    By becond in forum Newbie
    Replies: 1
    Last Post: 2nd March 2006, 06:16

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.