From f170552244f70cff464960e180e1086c87581157 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 9 Aug 2024 14:28:18 +0200 Subject: [PATCH] BinEditor: Use LayoutBuilder for toolbar Change-Id: Ibdddde7be1df94112013f59561955e54ec45052d Reviewed-by: Alessandro Portale --- src/plugins/bineditor/bineditorplugin.cpp | 27 ++++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 61d4c75205b..0f341423864 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -2179,27 +2180,27 @@ public: { setWidget(m_widget); setDuplicateSupported(true); + auto codecChooser = new CodecChooser(CodecChooser::Filter::SingleByte); codecChooser->prependNone(); - - auto l = new QHBoxLayout; - auto w = new QWidget; - l->setContentsMargins(0, 0, 5, 0); - l->addStretch(1); - l->addWidget(codecChooser); - l->addWidget(m_widget->addressEdit()); - w->setLayout(l); - - m_toolBar = new QToolBar; - m_toolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - m_toolBar->addWidget(w); - connect(codecChooser, &CodecChooser::codecChanged, m_widget, &BinEditorWidget::setCodec); const QVariant setting = ICore::settings()->value(C_ENCODING_SETTING); if (!setting.isNull()) codecChooser->setAssignedCodec(QTextCodec::codecForName(setting.toByteArray())); + using namespace Layouting; + auto w = Row { + customMargins(0, 0, 5, 0), + st, + codecChooser, + m_widget->addressEdit() + }.emerge(); + + m_toolBar = new QToolBar; + m_toolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + m_toolBar->addWidget(w); + m_undoAction = new QAction(Tr::tr("&Undo"), this); m_redoAction = new QAction(Tr::tr("&Redo"), this); m_copyAction = new QAction(this);