void MusicConnectTransferWidget::createAllItems(const MusicSongs &songs) { ui->playListTableWidget->clear(); if(ui->allSelectedcheckBox->isChecked()) { ui->allSelectedcheckBox->click(); } ui->playListTableWidget->setRowCount(songs.count()); for(int i=0; i<songs.count(); ++i) { MusicSong song = songs[i]; QTableWidgetItem *item = new QTableWidgetItem; item->setData(MUSIC_CHECK_ROLE, false); ui->playListTableWidget->setItem(i, 0, item); item = new QTableWidgetItem; item->setText(QFontMetrics(font()).elidedText(song.getMusicName(), Qt::ElideRight, 280)); item->setToolTip(song.getMusicPath()); item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); ui->playListTableWidget->setItem(i, 1, item); item = new QTableWidgetItem; item->setText(QFontMetrics(font()).elidedText(song.getMusicTime(), Qt::ElideRight, 40)); item->setToolTip(song.getMusicTime()); item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); ui->playListTableWidget->setItem(i, 2, item); } }
foreach(MusicSong song, musics[2]) { writeDomElementMutilText(netFilePath, "value", QStringList() << "name" << "playCount" << "time", QList<QVariant>() << song.getMusicName() << song.getMusicPlayCount() << song.getMusicTime(), song.getMusicPath()); }