QTreeWidgetItem *locwi; bool same[] = {false, true, true, true, true, true, true, true}; for (int i = 0; i < filModel->rowCount(*mi); i++) { if ((filModel->fileInfo(mi->child(i,0)).isDir()) && (filModel->rowCount(mi->child(i,0)) > 0)) { locwi = new QTreeWidgetItem(wi); locwi->setText( 0, filModel->fileName(mi->child( i, 0 ))); locwi->setIcon( 0, filModel->fileIcon(mi->child( i, 0 ))); locwi->setText( 8, filModel->filePath(mi->child( i, 0 ))); locwi->setText( 9, "Folder"); LookUp(&mi->child(i, 0), locwi); } if (filModel->fileInfo( mi->child( i, 0 )).isFile()) { TagLib::FileRef fl(filModel->filePath( mi->child( i, 0) ).toAscii().data()); locwi = new QTreeWidgetItem(wi); locwi->setText( 0, filModel->fileName( mi->child( i, 0) )); locwi->setIcon( 0, filModel->fileIcon( mi->child( i, 0) )); locwi->setText( 8, filModel->filePath( mi->child( i, 0) )); locwi->setText( 9, "File"); locwi->setText( 1, QString::fromStdWString(fl.tag()->artist().toWString())); locwi->setText( 2, QString::fromStdWString(fl.tag()->title().toWString())); locwi->setText( 3, QString::fromStdWString(fl.tag()->album().toWString())); locwi->setText( 4, QString::number(fl.tag()->year())); locwi->setText( 5, QString::number(fl.tag()->track())); locwi->setText( 6, QString::fromStdWString(fl.tag()->genre().toWString())); locwi->setText( 7, QString::fromStdWString(fl.tag()->comment().toWString())); emit incProgVal(); } for (int j = 1; j <= 8; j++) if ( (same[j]) && (i > 0) ) if (wi->child(i - 1) != NULL) if (locwi->text(j) != wi->child(i - 1)->text(j)) same[j] = false; if (cancel) { return; } //QApplication::processEvents(); } for (int j = 1; j <= 8 ; j++) if (same[j]) if (wi->child(0) != NULL) wi->setText(j, wi->child(0)->text(j));
QObject Reentrancy...Although QObject is reentrant, the GUI classes, notably QWidget and all its subclasses, are not reentrant. They can only be used from the main thread. As noted earlier, QCoreApplication::exec() must also be called from that thread...