Skip to content

Commit

Permalink
Prevent the UWT report from moving out of screen
Browse files Browse the repository at this point in the history
See #792.
  • Loading branch information
lmoureaux committed Jan 4, 2022
1 parent 447895e commit 328e9a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/gui-qt/unitreport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ units_waiting::units_waiting(QWidget *parent)
waiting_units->setEditTriggers(QAbstractItemView::NoEditTriggers);
waiting_units->verticalHeader()->setVisible(false);
waiting_units->horizontalHeader()->setVisible(true);
waiting_units->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
waiting_units->setSelectionMode(QAbstractItemView::SingleSelection);
waiting_units->horizontalHeader()->resizeSections(QHeaderView::Stretch);
waiting_units->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Expand Down Expand Up @@ -133,10 +134,9 @@ void units_waiting::update_units()
hide();
}

setFixedSize(waiting_units->horizontalHeader()->length()
+ waiting_units->verticalHeader()->width() + 25,
waiting_units->verticalHeader()->length()
+ waiting_units->horizontalHeader()->height() + 30);
auto max_height = parentWidget()->height() - y();
auto want = sizeHint();
setFixedSize(want.width(), std::min(want.height(), max_height));
}

void units_waiting::showEvent(QShowEvent *event) { update_units(); }
Expand Down

0 comments on commit 328e9a4

Please sign in to comment.