void TTableWidgetDrop::setStateAbonent(uchar numPC, uchar numTLK, char state){ switch(state) { case ABN_TRANS_COMM: { item(numTLK-1, getNumTLKPositionAbn(numPC, numTLK)+1)->setBackground(QBrush(QColor(Qt::green))); //здесь нужно передать setStateAbonent(numPc, numTLK, -1); QTimer::singleShot(2000, this, SLOT(setStateAbonent(uchar, uchar, uchar))); break; } case ABN_TRANS_REC: { item(numTLK-1, getNumTLKPositionAbn(numPC, numTLK)+1)->setBackground(QBrush(QColor(Qt::cyan))); //здесь нужно передать setStateAbonent(numPc, numTLK, -1); QTimer::singleShot(2000, this, SLOT(setStateAbonent(uchar, uchar, uchar))); break; } default: { item(numTLK-1, getNumTLKPositionAbn(numPC, numTLK)+1)->setBackground(QBrush(QColor(Qt::white))); break; } }}
void TTableWidgetDrop::setStateAbonent(uchar numPC, uchar numTLK, char state){ qWarning("setStateAbonent %d, %d, %d", numPC, numTLK, state); uchar iNumPC = numPC; uchar iNumTLK = numTLK; if(numTLK == 0 && numPC == 0 && state == -1) if(!qStck_abnNumPC.isEmpty() && !qStck_abnNumTLK.isEmpty()) { qWarning("copy"); iNumPC = qStck_abnNumPC.pop(); iNumTLK = qStck_abnNumTLK.pop(); } switch(state) { case ABN_TRANS_COMM: { qWarning("comm %d, %d", numPC, numTLK); item(numTLK-1, getNumTLKPositionAbn(numPC, numTLK))->setBackground(QBrush(QColor(Qt::green))); qStck_abnNumPC.push(numPC); qStck_abnNumTLK.push(numTLK); QTimer::singleShot(500, this, SLOT(setBaseStateAbonent())); break; } case ABN_TRANS_REC: { qWarning("recieve %d, %d", numPC, numTLK); qStck_abnNumPC.push(numPC); qStck_abnNumTLK.push(numTLK); item(numTLK-1, getNumTLKPositionAbn(numPC, numTLK))->setBackground(QBrush(QColor(Qt::cyan))); QTimer::singleShot(500, this, SLOT(setBaseStateAbonent())); break; } default: { if(iNumTLK>0) { qWarning("default %d, %d", iNumPC, iNumTLK); item(iNumTLK-1, getNumTLKPositionAbn(iNumPC, iNumTLK))->setBackground(QBrush(QColor(Qt::white))); } break; } }}void TTableWidgetDrop::setBaseStateAbonent(){ qWarning("setBaseStateAbonent"); setStateAbonent(0, 0 ,-1);}