#define PROTOCOL_NAME_COL 0#define REGTYPE_NAME_COL 1
QDirIterator it(sPath, QDirIterator::Subdirectories); QFileInfo qFileInfo; QTableWidgetItem *newItem; QTableWidgetItem *newItem2; while (it.hasNext()) { qFileInfo.setFile(it.next()); if(qFileInfo.isDir()) continue; else { if((ExtractFileExt(qFileInfo.fileName())).toUpper() == "DLL") { CProcessingService* pProcService = new CProcessingService; if(!pProcService->Load(qFileInfo.absFilePath())) { delete pProcService; continue; } pProcServ_t pPS = {NULL, pProcService->GetInfo()}; pPS.pProcessingService = pProcService; vectProcessingService->push_back(pPS); int iRowIndx = ui.tableWidgetProtocolList->rowCount(); ui.tableWidgetProtocolList->insertRow(iRowIndx); QColor qClr = pProcService->GetOnOff() ? Qt::green : Qt::red; newItem = new QTableWidgetItem(pPS.sProcServName); newItem->setBackgroundColor(qClr); ui.tableWidgetProtocolList->setItem(iRowIndx, PROTOCOL_NAME_COL, newItem); newItem2 = new QTableWidgetItem(RegTypes[REGTYPEBASE]); newItem2->setBackgroundColor(qClr); ui.tableWidgetProtocolList->setItem(iRowIndx, REGTYPE_NAME_COL, newItem2); } } }
ui.tableWidgetProtocolList->setColumnCount(2);
C++ (Qt)//newItem = new QTableWidgetItem(pPS.sProcServName);newItem = new QTableWidgetItem( "Test item" );