mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-25 06:44:59 +00:00
CodeWidget: Layout tweak. Give left-side widgets more vertical space by moving the address bar out of the way. Align things better.
This commit is contained in:
parent
4d3f247cc3
commit
b0867c1602
1 changed files with 26 additions and 9 deletions
|
@ -100,16 +100,22 @@ void CodeWidget::showEvent(QShowEvent* event)
|
||||||
|
|
||||||
void CodeWidget::CreateWidgets()
|
void CodeWidget::CreateWidgets()
|
||||||
{
|
{
|
||||||
auto* layout = new QGridLayout;
|
auto* layout = new QHBoxLayout;
|
||||||
|
|
||||||
layout->setContentsMargins(2, 2, 2, 2);
|
layout->setContentsMargins(2, 2, 2, 2);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
|
|
||||||
|
auto* top_layout = new QHBoxLayout;
|
||||||
m_search_address = new QLineEdit;
|
m_search_address = new QLineEdit;
|
||||||
m_branch_watch = new QPushButton(tr("Branch Watch"));
|
|
||||||
m_code_view = new CodeViewWidget;
|
|
||||||
|
|
||||||
m_search_address->setPlaceholderText(tr("Search Address"));
|
m_search_address->setPlaceholderText(tr("Search Address"));
|
||||||
|
m_branch_watch = new QPushButton(tr("Branch Watch"));
|
||||||
|
top_layout->addWidget(m_search_address);
|
||||||
|
top_layout->addWidget(m_branch_watch);
|
||||||
|
|
||||||
|
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 = new QSplitter(Qt::Vertical);
|
||||||
m_box_splitter->setStyleSheet(BOX_SPLITTER_STYLESHEET);
|
m_box_splitter->setStyleSheet(BOX_SPLITTER_STYLESHEET);
|
||||||
|
@ -146,12 +152,23 @@ void CodeWidget::CreateWidgets()
|
||||||
|
|
||||||
m_code_splitter = new QSplitter(Qt::Horizontal);
|
m_code_splitter = new QSplitter(Qt::Horizontal);
|
||||||
|
|
||||||
m_code_splitter->addWidget(m_box_splitter);
|
// right_layout is the searchbar area and the codeview.
|
||||||
m_code_splitter->addWidget(m_code_view);
|
QWidget* right_widget = new QWidget;
|
||||||
|
right_widget->setLayout(right_layout);
|
||||||
|
|
||||||
layout->addWidget(m_search_address, 0, 0);
|
m_code_splitter->addWidget(m_box_splitter);
|
||||||
layout->addWidget(m_branch_watch, 0, 2);
|
m_code_splitter->addWidget(right_widget);
|
||||||
layout->addWidget(m_code_splitter, 1, 0, -1, -1);
|
|
||||||
|
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);
|
QWidget* widget = new QWidget(this);
|
||||||
widget->setLayout(layout);
|
widget->setLayout(layout);
|
||||||
|
|
Loading…
Add table
Reference in a new issue