Skip to content

Commit

Permalink
Merge pull request #11583 from ronso0/remove-from-disk-fixes
Browse files Browse the repository at this point in the history
Remove from disk: shrink dialog so buttons are (hopefully) on screen
  • Loading branch information
daschuer authored May 23, 2023
2 parents 6d909eb + ede9251 commit bc37b30
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/util/widgethelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ void growListWidget(QListWidget& listWidget, const QWidget& parent) {
listWidget.style()->pixelMetric(QStyle::PM_ScrollBarExtent);
int minW = listWidget.sizeHintForColumn(0) + margin;
int minH = listWidget.sizeHintForRow(0) * listWidget.count() + margin;
// The file list should fit into the window, but clamp to 90% of screen size.
int newW = std::min(minW, static_cast<int>(screenSpace.width() * 0.9));
int newH = std::min(minH, static_cast<int>(screenSpace.height() * 0.9));
// The file list should fit into the window, but clamp to 75% of screen size
// so (hoepfully) the entire containing dialog is visible even if there are
// toolbars at the screen edges
int newW = std::min(minW, static_cast<int>(screenSpace.width() * 0.75));
int newH = std::min(minH, static_cast<int>(screenSpace.height() * 0.75));
// Apply new size
if (newW > 0 && newH > 0) {
listWidget.setMinimumSize(newW, newH);
Expand Down

0 comments on commit bc37b30

Please sign in to comment.