Skip to content
Snippets Groups Projects
Commit c73d4ac1 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

new class GroupBox

parent e5480983
No related branches found
No related tags found
1 merge request!2058GUI instrument editor: detector section made more compact
......@@ -26,16 +26,23 @@
#include "GUI/Support/Style/ApplicationSettings.h"
#include <QLabel>
void installGroup(QGroupBox* groupBox)
class GroupBox : public QGroupBox
{
auto* label = new QLabel(groupBox);
public:
GroupBox(const QString& title, QLayout* content_layout, QWidget* parent);
};
GroupBox::GroupBox(const QString& title, QLayout* content_layout, QWidget* parent)
: QGroupBox(parent)
{
auto* label = new QLabel(this);
label->setObjectName("GroupBoxToggler");
label->setText(groupBox->title());
label->setText(title);
label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
auto* contentArea = new QWidget(groupBox);
auto* contentArea = new QWidget(this);
contentArea->setObjectName("ContentArea");
contentArea->setLayout(groupBox->layout());
contentArea->setLayout(content_layout);
auto* mainLayout = new QVBoxLayout;
mainLayout->setSpacing(0);
......@@ -43,10 +50,11 @@ void installGroup(QGroupBox* groupBox)
mainLayout->setMenuBar(label);
mainLayout->addWidget(contentArea);
groupBox->setTitle(""); // title has been read above
groupBox->setLayout(mainLayout); // overwrites layout that has been read above
setTitle(""); // title has been read above
setLayout(mainLayout); // overwrites layout that has been read above
}
DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrItem)
: QGroupBox("Detector parameters", parent)
{
......@@ -68,8 +76,8 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrItem)
grid->setColumnStretch(2, 1);
// -- x-axis controls
auto* xAxisGroupBox = new QGroupBox("X axis", this);
auto* xAxisFormLayout = new QFormLayout(xAxisGroupBox);
auto* xAxisFormLayout = new QFormLayout;
auto* xAxisGroupBox = new GroupBox("X axis", xAxisFormLayout, this);
auto* xAxisNbinsSpinBox = new SafeSpinBox;
xAxisNbinsSpinBox->setRange(1, 65536);
......@@ -91,7 +99,6 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrItem)
emit dataChanged();
});
grid->addWidget(xAxisGroupBox, 1, 0);
installGroup(xAxisGroupBox);
// -- y-axis controls
......
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