From b265e0906c88d58f1999b52288a9a93ed483fbb9 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 11 Oct 2023 15:42:33 +0200 Subject: [PATCH] CompilerExplorer: Use StyledBar Change-Id: I9f80a025a6ed3a4732794b4715a25ce3b90f6d43 Reviewed-by: Marcus Tillmanns --- .../compilerexplorereditor.cpp | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/src/plugins/compilerexplorer/compilerexplorereditor.cpp b/src/plugins/compilerexplorer/compilerexplorereditor.cpp index 3942e668a64..6ca54b356ac 100644 --- a/src/plugins/compilerexplorer/compilerexplorereditor.cpp +++ b/src/plugins/compilerexplorer/compilerexplorereditor.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -201,6 +202,8 @@ SourceEditorWidget::SourceEditorWidget(const std::shared_ptr &se QUndoStack *undoStack) : m_sourceSettings(settings) { + auto toolBar = new StyledBar; + m_codeEditor = new CodeEditorWidget(m_sourceSettings, undoStack); connect(m_codeEditor, &CodeEditorWidget::gotFocus, this, &SourceEditorWidget::gotFocus); @@ -215,28 +218,32 @@ SourceEditorWidget::SourceEditorWidget(const std::shared_ptr &se m_codeEditor->setTextDocument(document); m_codeEditor->updateHighlighter(); - auto addCompilerButton = new QPushButton; + auto addCompilerButton = new QToolButton; addCompilerButton->setText(Tr::tr("Add Compiler")); connect(addCompilerButton, - &QPushButton::clicked, + &QToolButton::clicked, &settings->compilers, &AspectList::createAndAddItem); - auto removeSourceButton = new QPushButton; - removeSourceButton->setIcon(Utils::Icons::EDIT_CLEAR.icon()); + auto removeSourceButton = new QToolButton; + removeSourceButton->setIcon(Utils::Icons::CLOSE_TOOLBAR.icon()); removeSourceButton->setToolTip(Tr::tr("Remove Source")); - connect(removeSourceButton, &QPushButton::clicked, this, &SourceEditorWidget::remove); + connect(removeSourceButton, &QToolButton::clicked, this, &SourceEditorWidget::remove); // clang-format off using namespace Layouting; + Row { + settings->languageId, + addCompilerButton, + removeSourceButton, + customMargin({6, 0, 0, 0}), spacing(0), + }.attachTo(toolBar); + Column { - Row { - settings->languageId, - addCompilerButton, - removeSourceButton, - }, + toolBar, m_codeEditor, + noMargin(), spacing(0), }.attachTo(this); // clang-format on @@ -272,6 +279,8 @@ CompilerWidget::CompilerWidget(const std::shared_ptr &sourceSett m_delayTimer, qOverload<>(&QTimer::start)); + auto toolBar = new StyledBar; + m_asmEditor = new AsmEditorWidget(undoStack); m_asmDocument = QSharedPointer(new TextDocument); m_asmDocument->setFilePath("asm.asm"); @@ -281,7 +290,7 @@ CompilerWidget::CompilerWidget(const std::shared_ptr &sourceSett connect(m_asmEditor, &AsmEditorWidget::gotFocus, this, &CompilerWidget::gotFocus); - auto advButton = new QPushButton; + auto advButton = new QToolButton; QSplitter *splitter{nullptr}; auto advDlg = new QAction; @@ -297,13 +306,13 @@ CompilerWidget::CompilerWidget(const std::shared_ptr &sourceSett dlg->setGeometry(rect); }); - connect(advButton, &QPushButton::clicked, advDlg, &QAction::trigger); + connect(advButton, &QToolButton::clicked, advDlg, &QAction::trigger); advButton->setIcon(advDlg->icon()); - auto removeCompilerBtn = new QPushButton; - removeCompilerBtn->setIcon(Utils::Icons::EDIT_CLEAR.icon()); + auto removeCompilerBtn = new QToolButton; + removeCompilerBtn->setIcon(Utils::Icons::CLOSE_TOOLBAR.icon()); removeCompilerBtn->setToolTip(Tr::tr("Remove Compiler")); - connect(removeCompilerBtn, &QPushButton::clicked, this, &CompilerWidget::remove); + connect(removeCompilerBtn, &QToolButton::clicked, this, &CompilerWidget::remove); compile(m_sourceSettings->source()); @@ -312,17 +321,22 @@ CompilerWidget::CompilerWidget(const std::shared_ptr &sourceSett }); // clang-format off + + Row { + m_compilerSettings->compiler, + advButton, + removeCompilerBtn, + customMargin({6, 0, 0, 0}), spacing(0), + }.attachTo(toolBar); + Column { - Row { - m_compilerSettings->compiler, - advButton, - removeCompilerBtn, - }, + toolBar, Splitter { bindTo(&splitter), m_asmEditor, createTerminal() - } + }, + noMargin(), spacing(0), }.attachTo(this); // clang-format on