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

Enable drag to resize function browser, data selector

Put the "additional widgets" in a QSplitter so their relative sizes can be
adjusted. This is useful when a complicated composite function with many
parameters is used, so that more can be seen without needing to scroll the
function browser.

Use stretch factor to ensure that the additional widgets get any extra space
when the window is resized.

re #15518
parent 57b9cf06
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ class QtEnumPropertyManager;
class QtProperty;
class QtBrowserItem;
class QVBoxLayout;
class QSplitter;
namespace Mantid {
namespace API {
......@@ -112,6 +113,8 @@ private:
const int nWorkspaces) const;
/// Layout for extra widgets
QVBoxLayout *m_additionalLayout;
/// Splitter for additional widgets
QSplitter *m_widgetSplitter;
/// Names of workspaces to fit
std::vector<std::string> m_workspacesToFit;
/// Label to use for simultaneous fits
......
......@@ -41,6 +41,7 @@
#include <QMessageBox>
#include <QAction>
#include <QLayout>
#include <QSplitter>
namespace {
Mantid::Kernel::Logger g_log("MuonFitPropertyBrowser");
......@@ -149,8 +150,14 @@ void MuonFitPropertyBrowser::init() {
auto parentLayout = qobject_cast<QVBoxLayout *>(w->layout());
if (parentLayout) {
const int index = parentLayout->count() - 2;
parentLayout->insertLayout(index, m_additionalLayout);
constexpr int stretchFactor = 10; // so these widgets get any extra space
parentLayout->insertLayout(index, m_additionalLayout, stretchFactor);
}
m_widgetSplitter = new QSplitter(w);
m_widgetSplitter->setOrientation(Qt::Vertical);
m_widgetSplitter->setSizePolicy(QSizePolicy::Policy::Expanding,
QSizePolicy::Policy::Expanding);
m_additionalLayout->addWidget(m_widgetSplitter);
}
/**
......@@ -469,8 +476,10 @@ void MuonFitPropertyBrowser::finishAfterSimultaneousFit(
* @param widget :: [input] Pointer to widget to add
*/
void MuonFitPropertyBrowser::addExtraWidget(QWidget *widget) {
if (m_additionalLayout) {
m_additionalLayout->addWidget(widget);
widget->setSizePolicy(QSizePolicy::Policy::Expanding,
QSizePolicy::Policy::Expanding);
if (m_additionalLayout && m_widgetSplitter) {
m_widgetSplitter->addWidget(widget);
}
}
......
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