[Qt-interest] Not able to delete a QGraphicsItem

Sujan Dasmahapatra sdh at lmglasfiber.com
Wed Apr 22 14:45:32 CEST 2009


Dear Friends 

I have a QGraphicsItem what I am hiding and showing and after that trying to check whether it selected or not...It's crashing  I think its  a Qt bug.Please help what  have I done wrong else ?

 

See the code below. 1st I am calling  hidePart() and then calling showPart() after that Calling deletePart() it's  crashing at the first line

--------à        geoMetry[currentRow()]->isSelected()

Program received signal SIGSEGV, Segmentation fault to evaluate the value of    geoMetry[currentRow()]->isSelected()

void TableWidget::showPart()

{

        if(item[currentRow()]->isSelected()==true)

                {

                geoMetry[currentRow()]->show();

                geoMetry[currentRow()]->setSelected(true);

                geoMetry[currentRow()]->setVisible(true);

                }

        else

                return;

}

 

void TableWidget::hidePart()

{

        if(geoMetry[currentRow()]->isSelected() == true)

                geoMetry[currentRow()]->hide();

        else

                return;

 

}

 

void TableWidget::deletePart()

{

        if(geoMetry[currentRow()]->isVisible() == true && geoMetry[currentRow()]->isSelected() == true)

        {

                delete geoMetry[currentRow()];

                geoMetry.removeOne(geoMetry[currentRow()]);

                item.removeOne(item[currentRow()]);

                removeRow(currentRow());

                countTableWidget--;

                if(countTableWidget==0)

                {

                        geoMetry.clear();

                        item.clear();

                        return;

                }

 

        }

        else

        return;

 

}

 

 

Kind regards, 
LM Glasfiber R&D (India) Pvt. Ltd.
 
Sujan Dasmahapatra
Senior Engineer - CFD
  
Telephone: +91 80 66470248 
Mobile:9900839788 
E-mail: sdh at lmglasfiber.com <mailto:sdh at lmglasfiber.com>  

 

 

 

 

--------------------------------------------------------------

This e-mail and any attachments are confidential. If you are not the named or intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose or store or copy the information in any medium. Any unauthorized disclosure, use or storage is prohibited and might be unlawful.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090422/89c37c7e/attachment.html 


More information about the Qt-interest-old mailing list