🐞 fix(UI模块): 绘制代理时处理字号变化
This commit is contained in:
parent
bb0198e6bc
commit
e2e1e91ed4
|
@ -157,14 +157,18 @@ void FileView::changeFontSize(double fontSize)
|
|||
{
|
||||
m_listItemHeight = m_listItemHeight + ((fontSize - m_fontSize) * 2);
|
||||
m_fontSize = fontSize;
|
||||
updateViewMode();
|
||||
if (m_downloadBtn != nullptr) {
|
||||
m_downloadBtn->changeFontSize(m_fontSize);
|
||||
}
|
||||
QFont font;
|
||||
font.setPointSizeF(fontSize);
|
||||
setFont(font);
|
||||
update();
|
||||
updateViewMode();
|
||||
}
|
||||
|
||||
double FileView::getFontSize() const
|
||||
{
|
||||
return m_fontSize;
|
||||
}
|
||||
|
||||
void FileView::setItemMode(FileView::ItemSelectMode mode, bool isClear)
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
void setTheme(PublicAttributes::Theme theme);
|
||||
PublicAttributes::Theme getTheme() const;
|
||||
void changeFontSize(double fontSize);
|
||||
double getFontSize() const;
|
||||
void setItemMode(FileView::ItemSelectMode mode, bool isClear = false);
|
||||
FileView::ItemSelectMode getItemMode() const;
|
||||
void setThumbnailType(ThumbnailType type);
|
||||
|
|
|
@ -28,6 +28,11 @@ FileViewDelegate::~FileViewDelegate()
|
|||
void FileViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
auto *view = qobject_cast<const FileView *>(option.widget);
|
||||
double fontSize = view->getFontSize();
|
||||
QFont font;
|
||||
font.setPointSizeF(fontSize);
|
||||
painter->setFont(font);
|
||||
|
||||
if (view->getItemMode() == FileView::ItemSelectMode::Default) {
|
||||
kdk::KListViewDelegate::paint(painter, option, index);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue