Skip to content

Commit 5603895

Browse files
committed
calculate away the space for the scrollbar to match info images
1 parent ad616f5 commit 5603895

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/TombRaiderLinuxLauncher.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,17 @@ void TombRaiderLinuxLauncher::infoClicked() {
493493
if (id != 0) {
494494
InfoData info = controller.getInfo(id);
495495
ui->infoWebEngineView->setHtml(info.m_body);
496+
497+
// Get the vertical scrollbar size to center the images for all themes
498+
int scrollbarWidth = ui->infoListWidget
499+
->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
500+
QMargins margins = ui->infoListWidget->contentsMargins();
501+
int left = margins.left();
502+
int right = margins.right();
503+
504+
ui->infoListWidget->setMinimumWidth(left+502+scrollbarWidth+right);
505+
ui->infoListWidget->setMaximumWidth(left+502+scrollbarWidth+right);
506+
496507
ui->infoListWidget->setViewMode(QListView::IconMode);
497508
ui->infoListWidget->setIconSize(QSize(502, 377));
498509
ui->infoListWidget->setDragEnabled(false);
@@ -504,6 +515,7 @@ void TombRaiderLinuxLauncher::infoClicked() {
504515
for (int i = 0; i < info.m_imageList.size(); ++i) {
505516
const QIcon &icon = info.m_imageList.at(i);
506517
QListWidgetItem *item = new QListWidgetItem(icon, "");
518+
item->setSizeHint(QSize(502, 377));
507519
ui->infoListWidget->addItem(item);
508520
}
509521
ui->infoWebEngineView->show();

0 commit comments

Comments
 (0)