[Qt-interest] Delete Items Problem

Sujan Dasmahapatra sdh at lmglasfiber.com
Mon Apr 20 13:55:11 CEST 2009


Dear Friends 

I am facing a problem very serious.I  am developing an engineering tool
where I am loading multiple geometries one by one.At the same time I
have a QTableWidget and I am loading  correspondingly the geometry file
names in the QTableWidget as QTableWidgetItem.

 

Now  after loading some 3 or 4 geometries if delete the last item
everythings is fine.But if I delete the first item then some problem is
happening so that I am not able select the geometry again from the
QTableWdiget as its crashing.

 

You can see this peace of code. Yo can see these two functions
mouseReleaseEvent is there for selecting geometry from the TableWdiget
and delete part is the mechanism by which I am deleteing parts.......

I am doubting something do I need to refresh the QTableWidget after I
delete an item from QTableWdiget.Please help any one  to fix this bug ..

 

 

void TableWidget::mouseReleaseEvent(QMouseEvent * )

{

        if(countTableWidget>=1)

        {

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

        {

                if(countTableWidget != 1) {

                for(i=0;i<countTableWidget;i++)

                {

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

                        {

 
geoMetry[i]->setFlag(QGraphicsItem::ItemIsSelectable,false);

                                geoMetry[i]->setSelected(false);

 

                        }

                }

                }

                selectPart();

        }

        }

}

 

void TableWidget::deletePart()

{

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

        {

        delete geoMetry[currentRow()];

        removeRow(currentRow());

        countTableWidget--;

        if(countTableWidget==0)

                {

                        geoMetry.clear();

                        item.clear();

                }

 

        }

}

 

 

Kind regards, 
LM Glasfiber R&D (India) Pvt. Ltd.
 
Sujan Dasmahapatra
Project Engineer - CFD
  
Telephone: +91 80 66470248 
Mobile: 
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/20090420/40bdfdd6/attachment.html 


More information about the Qt-interest-old mailing list