Results 1 to 2 of 2

Thread: Application Crash problem on second time click on Menu Arrow of QToolButton

  1. #1
    Join Date
    Jul 2011
    Posts
    12
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Application Crash problem on second time click on Menu Arrow of QToolButton

    Hi,
    In my APPlication I have to show filter option (as filter option in xls)in Qtable widget for this
    I have used tool Button( with property "QToolButton::MenuButtonPopup") to display Menu List and
    Upon First Click upon Menu arrow it should show Menu list and selection of any of the Menu it should show only row having the text.
    This functionality works fine.
    But if Nothing is selected from Menu list and user has clicked Menu arrow second time then list should be hidden but in my case
    application crashes giving error:

    ASSERT failure in QList<T>:perator[]: "index out of range", file ..\..\..\..\Qt\2010.04\qt\include/QtCore/../../src/corelib/tools/qlist.h, line 447


    I have written below code:

    QToolButton *lToolButton = new QToolButton();
    lToolButton->setPopupMode(QToolButton::MenuButtonPopup);
    lToolButton->setAutoRaise(true);
    lToolButton->setText("Filter");
    QMenu *lMenu = new QMenu();
    QAction *lAction = new QAction("All",this);
    lMenu->addAction(lAction);
    lToolButton->setMenu(lMenu);


    Please let me know what is wrong in my coding.

  2. #2
    Join Date
    Aug 2011
    Location
    Seoul, Korea
    Posts
    46
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Application Crash problem on second time click on Menu Arrow of QToolButton

    Obviously, this is a out of range assertion failure so it means you are accessing an item in a list with invalid index. Since you are saying "if Nothing is selected from Menu list", it means there is no such list at all so it sounds like you are trying to access a index of null object? Are you sure the error is from the codes you provided because I can't think of any index out of range failures from the codes. I might be wrong... =(

    Regards,
    Last edited by Lykurg; 9th August 2011 at 10:52. Reason: Removed full quote
    Dong Back Kim

Similar Threads

  1. Problem: the Application Takes very long time to build
    By Ma7moud El-Naggar in forum Qt Programming
    Replies: 5
    Last Post: 20th November 2010, 07:26
  2. application crash problem
    By anshul in forum Newbie
    Replies: 3
    Last Post: 25th December 2009, 13:27
  3. qtoolbutton popup menu
    By anoar in forum Qt Programming
    Replies: 1
    Last Post: 6th December 2008, 06:20
  4. Replies: 12
    Last Post: 21st November 2008, 05:42
  5. QToolButton icon not updated in overflow menu
    By pabakertx in forum Qt Programming
    Replies: 2
    Last Post: 26th September 2007, 14:48

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.