Skip to content

Commit

Permalink
fix: When renaming a file in the icon view, if there are no other fil…
Browse files Browse the repository at this point in the history
…es below the file, the input displayed during file renaming is incomplete

Calculate the height issue of editing

Log: When renaming a file in the icon view, if there are no other files below the file, the input displayed during file renaming is incomplete
Bug: https://pms.uniontech.com/bug-view-259517.html
  • Loading branch information
liyigang1 committed Jul 11, 2024
1 parent 83fb0ac commit 703588e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ void IconItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionV
{
Q_D(const IconItemDelegate);

const QSize &iconSize = parent()->parent()->iconSize();
auto fileview = parent()->parent();
const QSize &iconSize = fileview->iconSize();

editor->move(option.rect.topLeft());
editor->setMinimumHeight(option.rect.height());
Expand All @@ -715,7 +716,11 @@ void IconItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionV
return;

FileViewHelper *viewHelper = qobject_cast<FileViewHelper *>(parent());
const int maxHeight = viewHelper ? (viewHelper->viewContentSize().height() - viewHelper->verticalOffset() - item->pos().y()) : INT_MAX;
int maxHeight = viewHelper ? (viewHelper->viewContentSize().height() - viewHelper->verticalOffset() - item->pos().y()) : INT_MAX;
if (viewHelper && fileview
&& fileview->size().height() > viewHelper->viewContentSize().height())
maxHeight = fileview->size().height() - viewHelper->verticalOffset() - item->pos().y();

item->setMaxHeight(qMax(maxHeight, sizeHint(opt, index).height()));

QLabel *icon = item->getIconLabel();
Expand Down

0 comments on commit 703588e

Please sign in to comment.