Qt/Debugger: Make spacing more compact

This commit is contained in:
spycrab 2018-08-02 21:50:23 +02:00
parent 6d56b03304
commit 8d184ab9bd
8 changed files with 26 additions and 3 deletions

View File

@ -25,6 +25,7 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent)
{ {
setWindowTitle(tr("Breakpoints")); setWindowTitle(tr("Breakpoints"));
setObjectName(QStringLiteral("breakpoints")); setObjectName(QStringLiteral("breakpoints"));
setTitleBarWidget(new QWidget);
setAllowedAreas(Qt::AllDockWidgetAreas); setAllowedAreas(Qt::AllDockWidgetAreas);
@ -78,9 +79,11 @@ BreakpointWidget::~BreakpointWidget()
void BreakpointWidget::CreateWidgets() void BreakpointWidget::CreateWidgets()
{ {
m_toolbar = new QToolBar; m_toolbar = new QToolBar;
m_toolbar->setContentsMargins(0, 0, 0, 0);
m_toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_table = new QTableWidget; m_table = new QTableWidget;
m_table->setContentsMargins(0, 0, 0, 0);
m_table->setColumnCount(5); m_table->setColumnCount(5);
m_table->setSelectionMode(QAbstractItemView::SingleSelection); m_table->setSelectionMode(QAbstractItemView::SingleSelection);
m_table->setSelectionBehavior(QAbstractItemView::SelectRows); m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
@ -100,6 +103,8 @@ void BreakpointWidget::CreateWidgets()
layout->addWidget(m_toolbar); layout->addWidget(m_toolbar);
layout->addWidget(m_table); layout->addWidget(m_table);
layout->setContentsMargins(2, 2, 2, 2);
layout->setSpacing(0);
m_new = m_toolbar->addAction(tr("New"), this, &BreakpointWidget::OnNewBreakpoint); m_new = m_toolbar->addAction(tr("New"), this, &BreakpointWidget::OnNewBreakpoint);
m_delete = m_toolbar->addAction(tr("Delete"), this, &BreakpointWidget::OnDelete); m_delete = m_toolbar->addAction(tr("Delete"), this, &BreakpointWidget::OnDelete);

View File

@ -38,7 +38,8 @@ CodeViewWidget::CodeViewWidget()
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
setSelectionMode(QAbstractItemView::SingleSelection); setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionBehavior(QAbstractItemView::SelectRows);
verticalScrollBar()->setHidden(true);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
for (int i = 0; i < columnCount(); i++) for (int i = 0; i < columnCount(); i++)
{ {

View File

@ -85,6 +85,9 @@ void CodeWidget::CreateWidgets()
{ {
auto* layout = new QGridLayout; auto* layout = new QGridLayout;
layout->setContentsMargins(2, 2, 2, 2);
layout->setSpacing(0);
m_search_address = new QLineEdit; m_search_address = new QLineEdit;
m_search_symbols = new QLineEdit; m_search_symbols = new QLineEdit;
m_code_view = new CodeViewWidget; m_code_view = new CodeViewWidget;

View File

@ -102,6 +102,7 @@ void JITWidget::CreateWidgets()
QWidget* widget = new QWidget; QWidget* widget = new QWidget;
auto* layout = new QVBoxLayout; auto* layout = new QVBoxLayout;
layout->setContentsMargins(2, 2, 2, 2);
widget->setLayout(layout); widget->setLayout(layout);
layout->addWidget(m_table_splitter); layout->addWidget(m_table_splitter);

View File

@ -26,7 +26,7 @@ MemoryViewWidget::MemoryViewWidget(QWidget* parent) : QTableWidget(parent)
{ {
horizontalHeader()->hide(); horizontalHeader()->hide();
verticalHeader()->hide(); verticalHeader()->hide();
verticalScrollBar()->setHidden(true); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setShowGrid(false); setShowGrid(false);
setFont(Settings::Instance().GetDebugFont()); setFont(Settings::Instance().GetDebugFont());

View File

@ -76,6 +76,9 @@ void MemoryWidget::CreateWidgets()
{ {
auto* layout = new QHBoxLayout; auto* layout = new QHBoxLayout;
layout->setContentsMargins(2, 2, 2, 2);
layout->setSpacing(0);
//// Sidebar //// Sidebar
// Search // Search
@ -105,6 +108,7 @@ void MemoryWidget::CreateWidgets()
search_layout->addWidget(m_find_next); search_layout->addWidget(m_find_next);
search_layout->addWidget(m_find_previous); search_layout->addWidget(m_find_previous);
search_layout->addWidget(m_result_label); search_layout->addWidget(m_result_label);
search_layout->setSpacing(1);
// Data Type // Data Type
auto* datatype_group = new QGroupBox(tr("Data Type")); auto* datatype_group = new QGroupBox(tr("Data Type"));
@ -122,6 +126,7 @@ void MemoryWidget::CreateWidgets()
datatype_layout->addWidget(m_type_u32); datatype_layout->addWidget(m_type_u32);
datatype_layout->addWidget(m_type_ascii); datatype_layout->addWidget(m_type_ascii);
datatype_layout->addWidget(m_type_float); datatype_layout->addWidget(m_type_float);
datatype_layout->setSpacing(1);
// MBP options // MBP options
auto* bp_group = new QGroupBox(tr("Memory breakpoint options")); auto* bp_group = new QGroupBox(tr("Memory breakpoint options"));
@ -146,10 +151,13 @@ void MemoryWidget::CreateWidgets()
bp_layout->addWidget(m_bp_read_only); bp_layout->addWidget(m_bp_read_only);
bp_layout->addWidget(m_bp_write_only); bp_layout->addWidget(m_bp_write_only);
bp_layout->addWidget(m_bp_log_check); bp_layout->addWidget(m_bp_log_check);
bp_layout->setSpacing(1);
// Sidebar // Sidebar
auto* sidebar = new QWidget; auto* sidebar = new QWidget;
auto* sidebar_layout = new QVBoxLayout; auto* sidebar_layout = new QVBoxLayout;
sidebar_layout->setSpacing(1);
sidebar->setLayout(sidebar_layout); sidebar->setLayout(sidebar_layout);
sidebar_layout->addWidget(m_search_address); sidebar_layout->addWidget(m_search_address);
@ -172,7 +180,7 @@ void MemoryWidget::CreateWidgets()
auto* sidebar_scroll = new QScrollArea; auto* sidebar_scroll = new QScrollArea;
sidebar_scroll->setWidget(sidebar); sidebar_scroll->setWidget(sidebar);
sidebar_scroll->setWidgetResizable(true); sidebar_scroll->setWidgetResizable(true);
sidebar_scroll->setFixedWidth(250); sidebar_scroll->setFixedWidth(190);
m_memory_view = new MemoryViewWidget(this); m_memory_view = new MemoryViewWidget(this);

View File

@ -87,6 +87,7 @@ void RegisterWidget::CreateWidgets()
QWidget* widget = new QWidget; QWidget* widget = new QWidget;
auto* layout = new QVBoxLayout; auto* layout = new QVBoxLayout;
layout->addWidget(m_table); layout->addWidget(m_table);
layout->setContentsMargins(2, 2, 2, 2);
widget->setLayout(layout); widget->setLayout(layout);
setWidget(widget); setWidget(widget);

View File

@ -74,10 +74,12 @@ WatchWidget::~WatchWidget()
void WatchWidget::CreateWidgets() void WatchWidget::CreateWidgets()
{ {
m_toolbar = new QToolBar; m_toolbar = new QToolBar;
m_toolbar->setContentsMargins(0, 0, 0, 0);
m_toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_table = new QTableWidget; m_table = new QTableWidget;
m_table->setContentsMargins(0, 0, 0, 0);
m_table->setColumnCount(5); m_table->setColumnCount(5);
m_table->verticalHeader()->setHidden(true); m_table->verticalHeader()->setHidden(true);
m_table->setContextMenuPolicy(Qt::CustomContextMenu); m_table->setContextMenuPolicy(Qt::CustomContextMenu);
@ -90,6 +92,8 @@ void WatchWidget::CreateWidgets()
m_save->setEnabled(false); m_save->setEnabled(false);
auto* layout = new QVBoxLayout; auto* layout = new QVBoxLayout;
layout->setContentsMargins(2, 2, 2, 2);
layout->setSpacing(0);
layout->addWidget(m_toolbar); layout->addWidget(m_toolbar);
layout->addWidget(m_table); layout->addWidget(m_table);