Skip to content
Snippets Groups Projects
Commit 8c81c9b5 authored by Tom Perkins's avatar Tom Perkins
Browse files

Enable adding widgets to MuonFitPropertyBrowser

Add an extra (empty) layout to MuonFitPropertyBrowser.
Expose this layout so that extra widgets can be placed there.
The widgets go after the buttons and tip, but before the browser.

Use case: want to put MuonFitDataSelector and FunctionBrowser there

re #15518
parent 2540f614
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ class QtStringPropertyManager;
class QtEnumPropertyManager;
class QtProperty;
class QtBrowserItem;
class QVBoxLayout;
namespace Mantid
{
......@@ -44,6 +45,8 @@ public:
void setWorkspaceName(const QString &wsName) override;
/// Called when the fit is finished
void finishHandle(const Mantid::API::IAlgorithm *alg) override;
/// Add an extra widget into the browser
void addExtraWidget(QWidget *widget);
public slots:
/// Perform the fit algorithm
......@@ -66,6 +69,8 @@ private:
void populateFunctionNames() override;
/// Check if the workspace can be used in the fit
bool isWorkspaceValid(Mantid::API::Workspace_sptr) const override;
/// Layout for extra widgets
QVBoxLayout *m_additionalLayout;
};
} // MantidQt
......
......@@ -38,6 +38,7 @@
#include <QSettings>
#include <QMessageBox>
#include <QAction>
#include <QLayout>
namespace MantidQt {
namespace MantidWidgets {
......@@ -132,6 +133,15 @@ void MuonFitPropertyBrowser::init() {
// Initialise the layout.
initLayout(w);
// Create an empty layout that can hold extra widgets
// and add it after the buttons but before the browser
m_additionalLayout = new QVBoxLayout();
auto parentLayout = qobject_cast<QVBoxLayout *>(w->layout());
if (parentLayout) {
const int index = parentLayout->count() - 2;
parentLayout->insertLayout(index, m_additionalLayout);
}
}
/**
......@@ -335,5 +345,15 @@ void MuonFitPropertyBrowser::finishHandle(const IAlgorithm *alg) {
FitPropertyBrowser::finishHandle(alg);
}
/**
* Adds an extra widget in between the fit buttons and the browser
* @param widget :: [input] Pointer to widget to add
*/
void MuonFitPropertyBrowser::addExtraWidget(QWidget *widget) {
if (m_additionalLayout) {
m_additionalLayout->addWidget(widget);
}
}
} // MantidQt
} // API
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment