QTableWidget: cannot insert an item that is already owned by another QTableWidget
C++ (Qt) void tableWidget::sl_base_format(Base *base){ table->clear(); if(base->stantionList.length() != 0) { table->setRowCount(base->stantionList.length()); table->setColumnCount(3); for(int i = 0; i<base->stantionList.length(); i++) { table->setItem(i,0,base->stantionList.at(i)->twi); } }} void tableWidget::sl_stantion_format(Stantion* stantion){ table->clear(); if(stantion->deviceList.length() != 0) { table->setRowCount(stantion->deviceList.length()); table->setColumnCount(3); for(int i = 0; i<stantion->deviceList.length(); i++) { table->setItem(i,0,stantion->deviceList.at(i)->twi); //!!! в дебаге вылетает вот на этой строчке } }}
C++ (Qt)table->clear();
C++ (Qt)delete item;
C++ (Qt) class Base;class Device; class Stantion: public QObject{ Q_OBJECT public: explicit Stantion(Base*); virtual ~Stantion(); public Q_SLOTS: void sl_addDevice(); void sl_removeDevice(Device*); public: Base *base; StantionItem *stantionitem; QTableWidgetItem *twi; QList<Device*> deviceList;};