Results 1 to 6 of 6

Thread: Crash during sending list from dialog to main window

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Crash during sending list from dialog to main window

    Hi, I have crash I can't really understand (and for me it's really dificult to debug Qt in Eclipse on Windows). This is the issue: I have dialog with some Qlistwidget and this dialog needs to send all items from it's qlistwidget to qmain window's list widget. The first time I try to do this, all goes well, but second time (when there are already some items in qmainwindow's qlistwidget) the application crashes.

    This is the code for qdialog's method which sends the items to qmain window: (qdialog is child of qmain window, btw)

    Qt Code:
    1. void Search::transferSelectedResults() //Search inherited QDialog
    2. {
    3. int row;
    4. QListWidgetItem * item1;
    5. MTEV_menu * menu=(MTEV_menu *)m_parent;
    6. //MTEV_menu inherited QMain Window
    7.  
    8. ltwLoadTCTS->selectAll();
    9. QList<QString> list;
    10.  
    11. foreach (QListWidgetItem * item, ltwLoadTCTS->selectedItems())
    12. {
    13. list.append(item->text());
    14. row=ltwLoadTCTS->row(item); // ltwLoadTCTS is QListWidget * of Search
    15. item1=ltwLoadTCTS->takeItem(row);
    16. delete item1;
    17. }
    18.  
    19. menu->AddTestItems(list);
    20.  
    21. accept();
    22. }
    To copy to clipboard, switch view to plain text mode 

    this is code for method of qmain window which adds items to it's qlistwidget
    Qt Code:
    1. void MTEV_menu::AddTestItems(QList <QString> &list)
    2. {
    3.  
    4. foreach (QString item, list)
    5. {
    6. if (!isInList(item))
    7. TestCases->addItem(item);
    8. //TestCases are QListWidgetItem * of MTEV_menu
    9. }
    10.  
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 

    Any comments appreciated

    P.S. Any other suggestions on how to do sending items from qdialog to qmainwindow are also welcomed....
    Last edited by Djony; 23rd November 2006 at 18:38.

Similar Threads

  1. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 09:23
  2. Replies: 3
    Last Post: 23rd July 2006, 18:02
  3. Replies: 3
    Last Post: 31st March 2006, 18:38
  4. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21
  5. Main window
    By Michiel in forum Qt Tools
    Replies: 1
    Last Post: 20th March 2006, 23:54

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.