Skip to content

Commit

Permalink
fix: 修改歌曲数目未根据宽度显示
Browse files Browse the repository at this point in the history
重新根据宽度计算显示范围

Log: 歌曲数目根据宽度刷新显示
  • Loading branch information
wyu71 authored and lzwind committed Mar 11, 2022
1 parent c2ddbcf commit 8fb2b0c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/music-player/mainFrame/musiclistdatawidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ void MusicListDataWidget::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
m_lableWidget->setGeometry(m_actionBar->geometry());
refreshInfoLabel(m_currentHash);
}

// 大标题跟随size变化
Expand Down Expand Up @@ -1094,10 +1095,12 @@ void MusicListDataWidget::refreshInfoLabel(QString hash)
m_pStackedWidget->setCurrentWidget(m_addMusicWidget);
}
}

// 文本太长显示...
QFontMetrics m_titleLabelFontMetrics(m_titleLabel->font());
int width = m_actionBar->width() / 2 - 20 - m_btPlayAll->width() - m_titleLabelFontMetrics.width(m_titleLabel->text()) / 2;
QFontMetrics font(m_infoLabel->font());
countStr = font.elidedText(countStr, Qt::ElideRight, 240);
countStr = font.elidedText(countStr, Qt::ElideRight, width);
m_infoLabel->setText(countStr);
}

Expand Down

0 comments on commit 8fb2b0c

Please sign in to comment.