DolphinQt: Resolve deprecated usage of margin()

This function has been marked as obsolete. In Qt 6.0 it's removed
entirely, so we must use getContentsMargin() explicitly instead
(margin() would do this for us).

Ditto for setMargin(), in which case we use setContentsMargin instead.
setMargin() would just pass its argument to all four parameters of
setContentsMargin(), so we can do the same.
This commit is contained in:
Lioncash 2021-01-13 04:33:01 -05:00
parent 46ca371ef3
commit 892154f7ea
3 changed files with 7 additions and 3 deletions

View File

@ -654,7 +654,7 @@ void MainWindow::ConnectStack()
layout->addWidget(m_game_list);
layout->addWidget(m_search_bar);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
connect(m_search_bar, &SearchBar::Search, m_game_list, &GameList::SetSearchTerm);

View File

@ -151,7 +151,11 @@ QSize FlowLayout::minimumSize() const
for (const auto& item : m_item_list)
size = size.expandedTo(item->minimumSize());
size += QSize(2 * margin(), 2 * margin());
// Any direction's margin works, as they all set the same within the constructor.
int margin = 0;
getContentsMargins(&margin, nullptr, nullptr, nullptr);
size += QSize(2 * margin, 2 * margin);
return size;
}

View File

@ -48,7 +48,7 @@ void WrapInScrollArea(QWidget* parent, QLayout* wrapped_layout, QWidget* to_resi
auto* scroll_layout = new QVBoxLayout;
scroll_layout->addWidget(scroll_area);
scroll_layout->setMargin(0);
scroll_layout->setContentsMargins(0, 0, 0, 0);
parent->setLayout(scroll_layout);
}