diff options
| author | TryTwo <taolas@gmail.com> | 2023-11-21 18:29:07 -0700 |
|---|---|---|
| committer | TryTwo <taolas@gmail.com> | 2025-03-21 09:55:52 -0700 |
| commit | b0867c1602cf0a397d335f84e0ba23e88c6c0d73 (patch) | |
| tree | 3e76b6e077bc4794da2bf79a6820990519e694d2 /Source/Core/DolphinQt/Debugger/CodeWidget.cpp | |
| parent | 4d3f247cc37cec8ab7bf42e2a158f045f8559bb6 (diff) | |
CodeWidget: Layout tweak. Give left-side widgets more vertical space by moving the address bar out of the way. Align things better.
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/CodeWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/CodeWidget.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp index af8315f179..eedf70a192 100644 --- a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp @@ -100,16 +100,22 @@ void CodeWidget::showEvent(QShowEvent* event) void CodeWidget::CreateWidgets() { - auto* layout = new QGridLayout; + auto* layout = new QHBoxLayout; layout->setContentsMargins(2, 2, 2, 2); layout->setSpacing(0); + auto* top_layout = new QHBoxLayout; m_search_address = new QLineEdit; + m_search_address->setPlaceholderText(tr("Search Address")); m_branch_watch = new QPushButton(tr("Branch Watch")); - m_code_view = new CodeViewWidget; + top_layout->addWidget(m_search_address); + top_layout->addWidget(m_branch_watch); - m_search_address->setPlaceholderText(tr("Search Address")); + auto* right_layout = new QVBoxLayout; + m_code_view = new CodeViewWidget; + right_layout->addLayout(top_layout); + right_layout->addWidget(m_code_view); m_box_splitter = new QSplitter(Qt::Vertical); m_box_splitter->setStyleSheet(BOX_SPLITTER_STYLESHEET); @@ -146,12 +152,23 @@ void CodeWidget::CreateWidgets() m_code_splitter = new QSplitter(Qt::Horizontal); - m_code_splitter->addWidget(m_box_splitter); - m_code_splitter->addWidget(m_code_view); + // right_layout is the searchbar area and the codeview. + QWidget* right_widget = new QWidget; + right_widget->setLayout(right_layout); - layout->addWidget(m_search_address, 0, 0); - layout->addWidget(m_branch_watch, 0, 2); - layout->addWidget(m_code_splitter, 1, 0, -1, -1); + m_code_splitter->addWidget(m_box_splitter); + m_code_splitter->addWidget(right_widget); + + layout->addWidget(m_code_splitter); + + // Corrects button height mis-aligning the layout. Note: Margin only populates values after this + // point. + const int height_fix = + m_branch_watch->sizeHint().height() - m_search_address->sizeHint().height(); + auto margins = right_layout->contentsMargins(); + margins.setTop(margins.top() - height_fix / 2); + right_layout->setContentsMargins(margins); + right_layout->setSpacing(right_layout->spacing() - height_fix / 2); QWidget* widget = new QWidget(this); widget->setLayout(layout); |
