コード例 #1
0
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);
    }
}
コード例 #2
0
void MusicSongsListItemInfoWidget::setMusicSongInformation(MusicSong &info)
{
    QString musicArt = info.getMusicArtistFront();
    QFontMetrics str(font());
    ui->songNameValue->setText( info.getMusicName().isEmpty() ? "-" :
                str.elidedText( info.getMusicName(), Qt::ElideRight, ui->songNameValue->width()) );
    ui->artlistValue->setText( musicArt.isEmpty() ? "-" :
               str.elidedText( musicArt, Qt::ElideRight, ui->artlistValue->width()) );
    ui->sizeValue->setText( str.elidedText( QString::number(MusicTime::fileSizeByte2MByte(
                            info.getMusicSize())).left(4) + "M", Qt::ElideRight, ui->sizeValue->width()) );
    ui->typeValue->setText( info.getMusicType().isEmpty() ? "-" :
            str.elidedText( info.getMusicType(), Qt::ElideRight, ui->typeValue->width()) );
    ui->timeValue->setText(
            str.elidedText( QString::number(info.getMusicPlayCount()), Qt::ElideRight, ui->timeValue->width()) );


    if(!showArtPicture(musicArt) && !showArtPicture(info.getMusicArtistBack()))
    {
        ui->artPicture->setPixmap(QPixmap(":/share/defaultArt").scaled(60, 60));
    }
}
コード例 #3
0
 foreach(MusicSong song, musics[2])
 {
     writeDomElementMutilText(netFilePath, "value", QStringList() << "name" << "playCount" << "time",
                              QList<QVariant>() << song.getMusicName() << song.getMusicPlayCount()
                                                << song.getMusicTime(), song.getMusicPath());
 }