mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
DolphinQt: Make WrapInScrollArea and GetWrappedWidget less hacky.
This commit is contained in:
@ -24,9 +24,6 @@
|
||||
#include "DolphinQt/Config/HardcoreWarningWidget.h"
|
||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
#include "UICommon/GameFile.h"
|
||||
|
||||
ARCodeWidget::ARCodeWidget(std::string game_id, u16 game_revision, bool restart_required)
|
||||
: m_game_id(std::move(game_id)), m_game_revision(game_revision),
|
||||
@ -77,7 +74,7 @@ void ARCodeWidget::CreateWidgets()
|
||||
button_layout->addWidget(m_code_edit);
|
||||
button_layout->addWidget(m_code_remove);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
auto* const layout = new QVBoxLayout{this};
|
||||
|
||||
layout->addWidget(m_warning);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
@ -85,8 +82,6 @@ void ARCodeWidget::CreateWidgets()
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
layout->addWidget(m_code_list);
|
||||
layout->addLayout(button_layout);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
}
|
||||
|
||||
void ARCodeWidget::ConnectWidgets()
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "DolphinQt/Config/CommonControllersWidget.h"
|
||||
#include "DolphinQt/Config/GamecubeControllersWidget.h"
|
||||
#include "DolphinQt/Config/WiimoteControllersWidget.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
ControllersWindow::ControllersWindow(QWidget* parent) : QDialog(parent)
|
||||
@ -41,6 +42,7 @@ void ControllersWindow::CreateMainLayout()
|
||||
layout->addWidget(m_button_box);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void ControllersWindow::ConnectWidgets()
|
||||
|
@ -205,14 +205,11 @@ void GameConfigWidget::CreateWidgets()
|
||||
|
||||
auto* gfx_tabs = new QTabWidget;
|
||||
|
||||
gfx_tabs->addTab(GetWrappedWidget(new GeneralWidget(this, m_layer.get()), this, 125, 100),
|
||||
tr("General"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new EnhancementsWidget(this, m_layer.get()), this, 125, 100),
|
||||
gfx_tabs->addTab(GetWrappedWidget(new GeneralWidget(this, m_layer.get())), tr("General"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new EnhancementsWidget(this, m_layer.get())),
|
||||
tr("Enhancements"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new HacksWidget(this, m_layer.get()), this, 125, 100),
|
||||
tr("Hacks"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new AdvancedWidget(this, m_layer.get()), this, 125, 100),
|
||||
tr("Advanced"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new HacksWidget(this, m_layer.get())), tr("Hacks"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new AdvancedWidget(this, m_layer.get())), tr("Advanced"));
|
||||
const int editor_index = tab_widget->addTab(advanced_widget, tr("Editor"));
|
||||
gfx_layout->addWidget(gfx_tabs);
|
||||
|
||||
|
@ -32,8 +32,6 @@
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
#include "UICommon/GameFile.h"
|
||||
|
||||
GeckoCodeWidget::GeckoCodeWidget(std::string game_id, std::string gametdb_id, u16 game_revision,
|
||||
bool restart_required)
|
||||
: m_game_id(std::move(game_id)), m_gametdb_id(std::move(gametdb_id)),
|
||||
@ -105,7 +103,7 @@ void GeckoCodeWidget::CreateWidgets()
|
||||
|
||||
m_download_codes->setToolTip(tr("Download Codes from the WiiRD Database"));
|
||||
|
||||
auto* layout = new QVBoxLayout;
|
||||
auto* const layout = new QVBoxLayout{this};
|
||||
|
||||
layout->addWidget(m_warning);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
@ -139,8 +137,6 @@ void GeckoCodeWidget::CreateWidgets()
|
||||
btn_layout->addWidget(m_download_codes);
|
||||
|
||||
layout->addLayout(btn_layout);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
}
|
||||
|
||||
void GeckoCodeWidget::ConnectWidgets()
|
||||
|
@ -156,8 +156,8 @@ void ColorCorrectionConfigWindow::Create()
|
||||
layout->addStretch();
|
||||
layout->addWidget(m_button_box);
|
||||
|
||||
setLayout(layout);
|
||||
WrapInScrollArea(this, layout);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void ColorCorrectionConfigWindow::ConnectWidgets()
|
||||
|
@ -12,17 +12,16 @@
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#include "DolphinQt/Config/Graphics/AdvancedWidget.h"
|
||||
#include "DolphinQt/Config/Graphics/EnhancementsWidget.h"
|
||||
#include "DolphinQt/Config/Graphics/GeneralWidget.h"
|
||||
#include "DolphinQt/Config/Graphics/HacksWidget.h"
|
||||
#include "DolphinQt/MainWindow.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
GraphicsWindow::GraphicsWindow(MainWindow* parent) : QDialog(parent), m_main_window(parent)
|
||||
{
|
||||
@ -32,6 +31,8 @@ GraphicsWindow::GraphicsWindow(MainWindow* parent) : QDialog(parent), m_main_win
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
OnBackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
||||
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void GraphicsWindow::CreateMainLayout()
|
||||
@ -52,10 +53,10 @@ void GraphicsWindow::CreateMainLayout()
|
||||
|
||||
connect(general_widget, &GeneralWidget::BackendChanged, this, &GraphicsWindow::OnBackendChanged);
|
||||
|
||||
QWidget* const wrapped_general = GetWrappedWidget(general_widget, this, 50, 100);
|
||||
QWidget* const wrapped_enhancements = GetWrappedWidget(enhancements_widget, this, 50, 100);
|
||||
QWidget* const wrapped_hacks = GetWrappedWidget(hacks_widget, this, 50, 100);
|
||||
QWidget* const wrapped_advanced = GetWrappedWidget(advanced_widget, this, 50, 100);
|
||||
QWidget* const wrapped_general = GetWrappedWidget(general_widget);
|
||||
QWidget* const wrapped_enhancements = GetWrappedWidget(enhancements_widget);
|
||||
QWidget* const wrapped_hacks = GetWrappedWidget(hacks_widget);
|
||||
QWidget* const wrapped_advanced = GetWrappedWidget(advanced_widget);
|
||||
|
||||
tab_widget->addTab(wrapped_general, tr("General"));
|
||||
tab_widget->addTab(wrapped_enhancements, tr("Enhancements"));
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/QtUtils/WindowActivationEventFilter.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
@ -96,6 +97,8 @@ MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num)
|
||||
[] { HotkeyManagerEmu::Enable(false); });
|
||||
|
||||
MappingCommon::CreateMappingProcessor(this);
|
||||
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void MappingWindow::CreateDevicesLayout()
|
||||
@ -543,7 +546,7 @@ void MappingWindow::PopulateProfileSelection()
|
||||
|
||||
QWidget* MappingWindow::AddWidget(const QString& name, QWidget* widget)
|
||||
{
|
||||
QWidget* wrapper = GetWrappedWidget(widget, this, 150, 210);
|
||||
auto* const wrapper = GetWrappedWidget(widget);
|
||||
m_tab_widget->addTab(wrapper, name);
|
||||
return wrapper;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ void StackedSettingsWindow::OnDoneCreatingPanes()
|
||||
// Make sure the first item is actually selected by default.
|
||||
ActivatePane(0);
|
||||
// Take on the preferred size.
|
||||
adjustSize();
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void StackedSettingsWindow::AddPane(QWidget* widget, const QString& name)
|
||||
|
Reference in New Issue
Block a user