本文整理汇总了C++中Album::songs方法的典型用法代码示例。如果您正苦于以下问题:C++ Album::songs方法的具体用法?C++ Album::songs怎么用?C++ Album::songs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::songs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showAlbumInfo
void TableWidget::showAlbumInfo( const Album &a ){
int n = std::max( a.songs().size(), this->rowCount() );
setRowCount(n);
bool enabled = isSortingEnabled();
setSortingEnabled(false);
//delete old results
for(int i=0;i<rowCount();i++){
delete takeItem(i,TITLE);
delete takeItem(i,TRACK);
}
int k=0;
QList<Song> leftOverSongs;
QList<Song> songs = a.songs();
while( songs.size()>0 ){
int row;
//qDebug()<<a.songs[0].title;
if(matchByTrackAction->isChecked()){
row = matchResult( songs[0].track(), CURRENT_TRACK );
}else if(matchByTitleAction->isChecked()){
row = matchResult( songs[0].title(), CURRENT_TITLE );
}else if(matchByTitleTrackAction->isChecked()){
row = matchResult( songs[0].title(), CURRENT_TITLE );
if(row==-1){
row = matchResult( songs[0].track(), CURRENT_TRACK );
}
if(row==-1){
row = matchResult( songs[0].title(), FILE_NAME );
}
}else if(matchByTrackTitleAction->isChecked()){
row = matchResult( songs[0].track(), CURRENT_TRACK );
if(row==-1){
row = matchResult( songs[0].title(), CURRENT_TITLE );
}
if(row==-1){
row = matchResult( songs[0].title(), FILE_NAME );
}
}else if(matchByFileNameAction->isChecked()){
row = matchResult( songs[0].title(), FILE_NAME );
}else if(dontMatchAction->isChecked()){;
row = k;
k++;
}else{
row = k;
k++;
}
if(row==-1){
leftOverSongs.append(songs[0]);
songs.removeAt(0);
continue;
}
TableWidgetItem *newItem = new TableWidgetItem;
newItem->setText(songs[0].title());
QFont f = newItem->font();f.setPointSize(10);
newItem->setFont(f);
setItem(row, TITLE, newItem);
TableWidgetItem *newItem1 = new TableWidgetItem;
newItem1->setText(songs[0].track());
newItem1->setFont(f);
setItem(row, TRACK, newItem1);
songs.removeAt(0);
}
for(int i=0;i<leftOverSongs.size();i++){
int n = rowCount();
int row=n+1;
for(int j=0;j<n;j++){
if(!item(j,TITLE)){
row=j;
break;
}
}
qDebug()<<leftOverSongs[i].title()<<" leftover, put in row "<<row;
TableWidgetItem *newItem = new TableWidgetItem;
newItem->setText(leftOverSongs[i].title());
QFont f = newItem->font();f.setPointSize(10);
newItem->setFont(f);
setItem(row, TITLE, newItem);
TableWidgetItem *newItem1 = new TableWidgetItem;
newItem1->setText(leftOverSongs[i].track());
newItem1->setFont(f);
setItem(row, TRACK, newItem1);
}
setSortingEnabled(enabled);
setNonEditable( 0, n );
}