Results 1 to 7 of 7

Thread: Run-time error in QWizardPage when I connect a signal to a slot, and page is canceled

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Run-time error in QWizardPage when I connect a signal to a slot, and page is canceled

    Hi,

    PageCounter is a QWizardPage of a QWizard. This is the slot I'm using in it:

    Qt Code:
    1. void PageCounter::refreshDescription(int selectedItem)
    2. {
    3. // this changes the text of a QPlainTextEdit based on the selected item in QComboBox:
    4. plaintextDescriptionOfSelectedCounter->setPlainText(wizard->caller->getCounterDescription(originalCounterIDs.at(selectedItem)));
    5. }
    To copy to clipboard, switch view to plain text mode 

    Signal is a QComboBox currentIndexChanged(int) defined in PageCounter constructor:

    Qt Code:
    1. connect(comboCounters, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshDescription(int)));
    To copy to clipboard, switch view to plain text mode 

    Everything works, except if I cancel the wizard, then it crashes the whole program.
    Maybe I should disconnect the signal, but I don't know where. This is the only clue I have, since it had been working perfectly before I added connect.

    Thx!

  2. #2
    Join Date
    May 2010
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Run-time error in QWizardPage when I connect a signal to a slot, and page is canc

    Qt Code:
    1. PageCounter::~PageCounter()
    2. {
    3. disconnect(comboCounters, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshDescription(int)));
    4. }
    To copy to clipboard, switch view to plain text mode 

    I have put it into the destructor, but still the same.
    Please, help, I cannot debug it, it simply crashes...

  3. #3
    Join Date
    May 2010
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Run-time error in QWizardPage when I connect a signal to a slot, and page is canc

    This has also appeared in Application Output tab.

    ASSERT failure in QList<T>::at: "index out of range", file d:\Qt\2010.05\qt\include/QtCore/../../src/corelib/tools/qlist.h, line 455

    It looks like QComboBox is destroyed sooner than SIGNAL/SLOT connection - just a guess. How could I avoid this?

  4. #4
    Join Date
    May 2010
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Run-time error in QWizardPage when I connect a signal to a slot, and page is canc

    Nobody knows it?

  5. #5
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Run-time error in QWizardPage when I connect a signal to a slot, and page is canc

    Hi,

    I don't know the answer to your problem. But I think the argument for setPlainText could be a bit suspect. It is possible that wizard could be a null pointer? Sorry if I'm stating something you have already thought of

Similar Threads

  1. Replies: 2
    Last Post: 15th September 2010, 00:54
  2. Can't connect a signal to a slot
    By cejohnsonsr in forum Newbie
    Replies: 5
    Last Post: 26th August 2010, 20:42
  3. How to connect signal/slot in QItemEditorFactory?
    By yyalli in forum Qt Programming
    Replies: 1
    Last Post: 4th June 2010, 14:56
  4. problem connect signal - slot
    By jaca in forum Newbie
    Replies: 13
    Last Post: 9th March 2010, 19:38
  5. Replies: 2
    Last Post: 8th October 2007, 15:02

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.