Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
rsm
Commits
12b5db8e
Commit
12b5db8e
authored
Apr 17, 2020
by
Huff, Israel
Browse files
moved AptEnsDataModel and AptEnsWidget into seperate files and into AptEns namespace
parent
09160f9c
Pipeline
#97636
failed with stages
in 39 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rsmwidgets/examples/CMakeLists.txt
View file @
12b5db8e
SET
(
PORTAL_HEADERS
rsmportalexample.hh
aptenswidget.hh
aptensdatamodel.hh
)
QT5_WRAP_CPP
(
PORTAL_MOC_FILES
${
PORTAL_HEADERS
}
...
...
@@ -8,5 +10,8 @@ QT5_WRAP_CPP(PORTAL_MOC_FILES
TRIBITS_ADD_EXECUTABLE
(
rsmportalexample
NOEXEPREFIX
SOURCES rsmportalexample.cc
${
PORTAL_MOC_FILES
}
${
PORTAL_HEADERS
}
SOURCES
rsmportalexample.cc
aptenswidget.cc
${
PORTAL_MOC_FILES
}
${
PORTAL_HEADERS
}
)
rsmwidgets/examples/aptensdatamodel.hh
0 → 100644
View file @
12b5db8e
#ifndef RSM_RSMWIDGETSEXAMPLE_APTENSDATAMODEL_HH_
#define RSM_RSMWIDGETSEXAMPLE_APTENSDATAMODEL_HH_
#include
<QString>
#include
<QStringList>
namespace
AptEns
{
class
APTEnsDataModel
{
private:
double
mLatitude
=
0.
;
double
mLongitude
=
0.
;
double
mAltitude
=
0.
;
QString
mSoilType
=
""
;
QString
mFissionID
=
""
;
double
mTotalYield
=
0.
;
bool
mYieldDefEnsemble
=
false
;
unsigned
mNumYields
=
0
;
double
mMinYield
=
0.
;
double
mMaxYield
=
0.
;
QString
mYieldSampling
=
""
;
double
mHeightOfBurst
=
0.
;
bool
mHOBDefEnsemble
=
false
;
unsigned
mNumHOBs
=
0
;
double
mMinHOB
=
0.
;
double
mMaxHOB
=
0.
;
QString
mHOBSampling
=
""
;
QStringList
mMetFileSets
;
QStringList
mSetupCfgs
;
unsigned
mTurbEnsNum
=
0
;
unsigned
mMetEnsNum
=
0
;
public:
// getters
double
latitude
()
{
return
mLatitude
;
}
double
longitude
()
{
return
mLongitude
;
}
double
altitude
()
{
return
mAltitude
;
}
QString
soilType
()
{
return
mSoilType
;
}
QString
fissionID
()
{
return
mFissionID
;
}
double
totalYield
()
{
return
mTotalYield
;
}
bool
yieldDefEnsemble
()
{
return
mYieldDefEnsemble
;
}
unsigned
numYields
()
{
return
mNumYields
;
}
double
minYield
()
{
return
mMinYield
;
}
double
maxYield
()
{
return
mMaxYield
;
}
QString
yieldSampling
()
{
return
mYieldSampling
;
}
double
heightOfBurst
()
{
return
mHeightOfBurst
;
}
bool
hobDefEnsemble
()
{
return
mHOBDefEnsemble
;
}
unsigned
numHOBs
()
{
return
mNumHOBs
;
}
double
minHOB
()
{
return
mMinHOB
;
}
double
maxHOB
()
{
return
mMaxHOB
;
}
QString
hobSampling
()
{
return
mHOBSampling
;
}
QStringList
&
metFileSets
()
{
return
mMetFileSets
;
}
QStringList
&
setupCfgs
()
{
return
mSetupCfgs
;
}
unsigned
turbEnsNum
()
{
return
mTurbEnsNum
;
}
unsigned
metEnsNum
()
{
return
mMetEnsNum
;
}
// setters
void
setLatitude
(
double
a
)
{
mLatitude
=
a
;
}
void
setLongitude
(
double
a
)
{
mLongitude
=
a
;
}
void
setAltitude
(
double
a
)
{
mAltitude
=
a
;
}
void
setSoilType
(
QString
a
)
{
mSoilType
=
a
;
}
void
setFissionID
(
QString
a
)
{
mFissionID
=
a
;
}
void
setTotalYield
(
double
a
)
{
mTotalYield
=
a
;
}
void
setYieldDefEnsemble
(
bool
a
)
{
mYieldDefEnsemble
=
a
;
}
void
setNumYields
(
unsigned
a
)
{
mNumYields
=
a
;
}
void
setMinYield
(
double
a
)
{
mMinYield
=
a
;
}
void
setMaxYield
(
double
a
)
{
mMaxYield
=
a
;
}
void
setYieldSampling
(
QString
a
)
{
mYieldSampling
=
a
;
}
void
setHeightOfBurst
(
double
a
)
{
mHeightOfBurst
=
a
;
}
void
setHOBDefEnsemble
(
bool
a
)
{
mHOBDefEnsemble
=
a
;
}
void
setNumHOBs
(
unsigned
a
)
{
mNumHOBs
=
a
;
}
void
setMinHOB
(
double
a
)
{
mMinHOB
=
a
;
}
void
setMaxHOB
(
double
a
)
{
mMaxHOB
=
a
;
}
void
setHOBSampling
(
QString
a
)
{
mHOBSampling
=
a
;
}
void
setTurbEnsNum
(
unsigned
a
)
{
mTurbEnsNum
=
a
;
}
void
setMetEnsNum
(
unsigned
a
)
{
mMetEnsNum
=
a
;
}
};
}
// namespace AptEns
#endif // RSM_RSMWIDGETSEXAMPLE_APTENSDATAMODEL_HH_
rsmwidgets/examples/aptenswidget.cc
0 → 100644
View file @
12b5db8e
#include
"aptenswidget.hh"
#include
<QGridLayout>
#include
<QTimer>
using
namespace
AptEns
;
// ----------------------------------------------------------------------------
StyledLabel
::
StyledLabel
(
const
QString
&
title
,
QWidget
*
parent
)
:
QLabel
(
title
,
parent
)
{
setAlignment
(
Qt
::
AlignRight
);
}
// ----------------------------------------------------------------------------
CenterTitleGroupBox
::
CenterTitleGroupBox
(
const
QString
&
title
,
QWidget
*
parent
)
:
QGroupBox
(
title
,
parent
)
{
setStyleSheet
(
R"foo(
QGroupBox {
padding: 1.4em 0em 0em 0em;
}
QGroupBox::title {
subcontrol-origin: padding;
subcontrol-position: top center;
padding: 0.7em 0em 0em 0em;
}
)foo"
);
}
// ----------------------------------------------------------------------------
LeftTitleGroupBox
::
LeftTitleGroupBox
(
const
QString
&
title
,
QWidget
*
parent
)
:
QGroupBox
(
title
,
parent
)
{
setStyleSheet
(
R"foo(
QGroupBox {
padding: 0em 0em 0em 0em;
}
QGroupBox::title {
subcontrol-origin: padding;
subcontrol-position: top left;
padding: 0.7em 0em 0em 0em;
left: 1em;
}
)foo"
);
}
// ----------------------------------------------------------------------------
LineEditFocusSelectAll
::
LineEditFocusSelectAll
(
QWidget
*
parent
)
:
QLineEdit
(
parent
)
{
}
LineEditFocusSelectAll
::
LineEditFocusSelectAll
(
const
QString
&
text
,
QWidget
*
parent
)
:
QLineEdit
(
text
,
parent
)
{
}
void
LineEditFocusSelectAll
::
focusInEvent
(
QFocusEvent
*
event
)
{
QLineEdit
::
focusInEvent
(
event
);
QTimer
::
singleShot
(
0
,
this
,
&
QLineEdit
::
selectAll
);
}
// ----------------------------------------------------------------------------
APTEnsWidget
::
APTEnsWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
QGridLayout
*
layout
=
new
QGridLayout
(
this
);
mEventDefBox
=
new
CenterTitleGroupBox
(
"Event Definition"
,
this
);
mYieldEnsBox
=
new
CenterTitleGroupBox
(
"Yield Ensemble"
,
this
);
mHeightOfBurstEnsBox
=
new
CenterTitleGroupBox
(
"Height of Burst Ensemble"
,
this
);
mMeteorologyBox
=
new
CenterTitleGroupBox
(
"Meteorology"
,
this
);
mDispPhysEnsBox
=
new
CenterTitleGroupBox
(
"Dispersion Physics Ensemble"
,
this
);
mTurbEnsBox
=
new
CenterTitleGroupBox
(
"Turbulence Ensemble"
,
this
);
mMetEnsBox
=
new
CenterTitleGroupBox
(
"Meteorology Ensemble"
,
this
);
int
row
=
0
;
layout
->
addWidget
(
mEventDefBox
,
row
,
0
,
1
,
2
);
layout
->
addWidget
(
mYieldEnsBox
,
++
row
,
0
);
layout
->
addWidget
(
mHeightOfBurstEnsBox
,
row
,
1
);
layout
->
addWidget
(
mMeteorologyBox
,
++
row
,
0
,
1
,
2
);
layout
->
addWidget
(
mDispPhysEnsBox
,
++
row
,
0
,
1
,
2
);
layout
->
addWidget
(
mTurbEnsBox
,
++
row
,
0
);
layout
->
addWidget
(
mMetEnsBox
,
row
,
1
);
// build event definition box
QGridLayout
*
edLayout
=
new
QGridLayout
(
mEventDefBox
);
mLatLabel
=
new
StyledLabel
(
"Latitude"
,
mEventDefBox
);
mLonLabel
=
new
StyledLabel
(
"Longitude"
,
mEventDefBox
);
mAltLabel
=
new
StyledLabel
(
"Altitude"
,
mEventDefBox
);
mSoilTypeLabel
=
new
StyledLabel
(
"Soil Type"
,
mEventDefBox
);
mFissionIDLabel
=
new
StyledLabel
(
"Fission ID"
,
mEventDefBox
);
mLatLineEdit
=
new
LineEditFocusSelectAll
(
mEventDefBox
);
mLonLineEdit
=
new
LineEditFocusSelectAll
(
mEventDefBox
);
mAltLineEdit
=
new
LineEditFocusSelectAll
(
mEventDefBox
);
mSoilTypeComboBox
=
new
QComboBox
(
mEventDefBox
);
mFissionIDComboBox
=
new
QComboBox
(
mEventDefBox
);
mSoilTypeComboBox
->
setEditable
(
true
);
mSoilTypeComboBox
->
setInsertPolicy
(
QComboBox
::
NoInsert
);
mSoilTypeComboBox
->
addItem
(
"siliceous"
);
mSoilTypeComboBox
->
addItem
(
"calcareous"
);
mFissionIDComboBox
->
setEditable
(
true
);
mFissionIDComboBox
->
setInsertPolicy
(
QComboBox
::
NoInsert
);
mFissionIDComboBox
->
addItem
(
"u235fi"
);
mFissionIDComboBox
->
addItem
(
"u238fi"
);
mFissionIDComboBox
->
addItem
(
"pu239fi"
);
mFissionIDComboBox
->
addItem
(
"u235he"
);
mFissionIDComboBox
->
addItem
(
"u238he"
);
mFissionIDComboBox
->
addItem
(
"pu239he"
);
row
=
0
;
edLayout
->
addWidget
(
mLatLabel
,
row
,
0
);
edLayout
->
addWidget
(
mLatLineEdit
,
row
,
1
);
edLayout
->
addWidget
(
mLonLabel
,
row
,
2
);
edLayout
->
addWidget
(
mLonLineEdit
,
row
,
3
);
edLayout
->
addWidget
(
mAltLabel
,
++
row
,
0
);
edLayout
->
addWidget
(
mAltLineEdit
,
row
,
1
);
edLayout
->
addWidget
(
mSoilTypeLabel
,
row
,
2
);
edLayout
->
addWidget
(
mSoilTypeComboBox
,
row
,
3
);
edLayout
->
addWidget
(
mFissionIDLabel
,
++
row
,
0
);
edLayout
->
addWidget
(
mFissionIDComboBox
,
row
,
1
);
// build yield ensemble box
QGridLayout
*
yeLayout
=
new
QGridLayout
(
mYieldEnsBox
);
mTotalYieldLabel
=
new
StyledLabel
(
"Total Yield"
,
mYieldEnsBox
);
mTotalYieldLineEdit
=
new
LineEditFocusSelectAll
(
mYieldEnsBox
);
mYieldDefineEnsCheckBox
=
new
QCheckBox
(
"Define Ensemble"
,
mYieldEnsBox
);
mNumYieldsLabel
=
new
StyledLabel
(
"# of Yields"
,
mYieldEnsBox
);
mNumYieldsLineEdit
=
new
LineEditFocusSelectAll
(
mYieldEnsBox
);
mMinYieldLabel
=
new
StyledLabel
(
"Min Yield"
,
mYieldEnsBox
);
mMinYieldLineEdit
=
new
LineEditFocusSelectAll
(
mYieldEnsBox
);
mMaxYieldLabel
=
new
StyledLabel
(
"Max Yield"
,
mYieldEnsBox
);
mMaxYieldLineEdit
=
new
LineEditFocusSelectAll
(
mYieldEnsBox
);
mYieldSamplingLabel
=
new
StyledLabel
(
"Sampling"
,
mYieldEnsBox
);
mYieldSamplingComboBox
=
new
QComboBox
(
mYieldEnsBox
);
mYieldSamplingComboBox
->
addItem
(
"uniform"
);
mYieldSamplingComboBox
->
addItem
(
"gaussian"
);
row
=
0
;
yeLayout
->
addWidget
(
mTotalYieldLabel
,
row
,
0
);
yeLayout
->
addWidget
(
mTotalYieldLineEdit
,
row
,
1
);
yeLayout
->
addWidget
(
mYieldDefineEnsCheckBox
,
row
,
2
,
1
,
2
,
Qt
::
AlignRight
);
yeLayout
->
addWidget
(
mNumYieldsLabel
,
++
row
,
0
);
yeLayout
->
addWidget
(
mNumYieldsLineEdit
,
row
,
1
);
yeLayout
->
addWidget
(
mMinYieldLabel
,
row
,
2
);
yeLayout
->
addWidget
(
mMinYieldLineEdit
,
row
,
3
);
yeLayout
->
addWidget
(
mMaxYieldLabel
,
++
row
,
0
);
yeLayout
->
addWidget
(
mMaxYieldLineEdit
,
row
,
1
);
yeLayout
->
addWidget
(
mYieldSamplingLabel
,
row
,
2
);
yeLayout
->
addWidget
(
mYieldSamplingComboBox
,
row
,
3
);
// build height of burst ensemble box
QGridLayout
*
hobLayout
=
new
QGridLayout
(
mHeightOfBurstEnsBox
);
mHOBLabel
=
new
StyledLabel
(
"Height of Burst"
,
mHeightOfBurstEnsBox
);
mHOBLineEdit
=
new
LineEditFocusSelectAll
(
mHeightOfBurstEnsBox
);
mHOBDefineEnsCheckBox
=
new
QCheckBox
(
"Define Ensemble"
,
mHeightOfBurstEnsBox
);
mNumHOBsLabel
=
new
StyledLabel
(
"# of HoB"
,
mHeightOfBurstEnsBox
);
mNumHOBsLineEdit
=
new
LineEditFocusSelectAll
(
mHeightOfBurstEnsBox
);
mMinHOBLabel
=
new
StyledLabel
(
"Min HoB"
,
mHeightOfBurstEnsBox
);
mMinHOBLineEdit
=
new
LineEditFocusSelectAll
(
mHeightOfBurstEnsBox
);
mMaxHOBLabel
=
new
StyledLabel
(
"Max HoB"
,
mHeightOfBurstEnsBox
);
mMaxHOBLineEdit
=
new
LineEditFocusSelectAll
(
mHeightOfBurstEnsBox
);
mHOBSamplingLabel
=
new
StyledLabel
(
"Sampling"
,
mHeightOfBurstEnsBox
);
mHOBSamplingComboBox
=
new
QComboBox
(
mHeightOfBurstEnsBox
);
mHOBSamplingComboBox
->
addItem
(
"uniform"
);
mHOBSamplingComboBox
->
addItem
(
"gaussian"
);
row
=
0
;
hobLayout
->
addWidget
(
mHOBLabel
,
row
,
0
);
hobLayout
->
addWidget
(
mHOBLineEdit
,
row
,
1
);
hobLayout
->
addWidget
(
mHOBDefineEnsCheckBox
,
row
,
2
,
1
,
2
,
Qt
::
AlignRight
);
hobLayout
->
addWidget
(
mNumHOBsLabel
,
++
row
,
0
);
hobLayout
->
addWidget
(
mNumHOBsLineEdit
,
row
,
1
);
hobLayout
->
addWidget
(
mMinHOBLabel
,
row
,
2
);
hobLayout
->
addWidget
(
mMinHOBLineEdit
,
row
,
3
);
hobLayout
->
addWidget
(
mMaxHOBLabel
,
++
row
,
0
);
hobLayout
->
addWidget
(
mMaxHOBLineEdit
,
row
,
1
);
hobLayout
->
addWidget
(
mHOBSamplingLabel
,
row
,
2
);
hobLayout
->
addWidget
(
mHOBSamplingComboBox
,
row
,
3
);
// build meteorology box
QGridLayout
*
metLayout
=
new
QGridLayout
(
mMeteorologyBox
);
mMetFileSetsBox
=
new
LeftTitleGroupBox
(
"File Sets"
,
mMeteorologyBox
);
mMetFileSetsListWidget
=
new
QListWidget
(
mMetFileSetsBox
);
QGridLayout
*
metFSLayout
=
new
QGridLayout
(
mMetFileSetsBox
);
mMetAddSetButton
=
new
QPushButton
(
"Add Set"
,
mMeteorologyBox
);
mMetRemoveSetButton
=
new
QPushButton
(
"Remove Set"
,
mMeteorologyBox
);
mMetAddButton
=
new
QPushButton
(
"Add"
,
mMeteorologyBox
);
mMetRemoveButton
=
new
QPushButton
(
"Remove"
,
mMeteorologyBox
);
metFSLayout
->
addWidget
(
mMetFileSetsListWidget
);
row
=
0
;
metLayout
->
addWidget
(
mMetFileSetsBox
,
row
,
0
,
1
,
5
);
QWidget
*
metSpacer
=
new
QWidget
(
mMeteorologyBox
);
metSpacer
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Preferred
);
metLayout
->
addWidget
(
metSpacer
,
++
row
,
0
);
metLayout
->
addWidget
(
mMetAddSetButton
,
row
,
1
);
metLayout
->
addWidget
(
mMetRemoveSetButton
,
row
,
2
);
metLayout
->
addWidget
(
mMetAddButton
,
row
,
3
);
metLayout
->
addWidget
(
mMetRemoveButton
,
row
,
4
);
// dispersion physics ensemble box
QGridLayout
*
dpeLayout
=
new
QGridLayout
(
mDispPhysEnsBox
);
mSetupCfgsBox
=
new
LeftTitleGroupBox
(
"SETUP.CFG Files"
,
mDispPhysEnsBox
);
mSetupCfgsListWidget
=
new
QListWidget
(
mSetupCfgsBox
);
QGridLayout
*
dpeSFLayout
=
new
QGridLayout
(
mSetupCfgsBox
);
mSetupCfgsImportButton
=
new
QPushButton
(
"Add Set"
,
mDispPhysEnsBox
);
mSetupCfgsRemoveButton
=
new
QPushButton
(
"Remove Set"
,
mDispPhysEnsBox
);
dpeSFLayout
->
addWidget
(
mSetupCfgsListWidget
);
row
=
0
;
dpeLayout
->
addWidget
(
mSetupCfgsBox
,
row
,
0
,
1
,
5
);
QWidget
*
dpeSpacer
=
new
QWidget
(
mDispPhysEnsBox
);
dpeSpacer
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Preferred
);
dpeLayout
->
addWidget
(
dpeSpacer
,
++
row
,
0
);
dpeLayout
->
addWidget
(
mSetupCfgsImportButton
,
row
,
1
);
dpeLayout
->
addWidget
(
mSetupCfgsRemoveButton
,
row
,
2
);
// turbulence ensemble box
QGridLayout
*
teLayout
=
new
QGridLayout
(
mTurbEnsBox
);
mTurbEnsNumLabel
=
new
StyledLabel
(
"Number"
,
mTurbEnsBox
);
mTurbEnsNumLineEdit
=
new
LineEditFocusSelectAll
(
mTurbEnsBox
);
QWidget
*
teSpacer
=
new
QWidget
(
mTurbEnsBox
);
teSpacer
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Preferred
);
teLayout
->
addWidget
(
mTurbEnsNumLabel
,
0
,
0
);
teLayout
->
addWidget
(
mTurbEnsNumLineEdit
,
0
,
1
);
teLayout
->
addWidget
(
teSpacer
,
0
,
2
);
// meteorology ensemble box
QGridLayout
*
meLayout
=
new
QGridLayout
(
mMetEnsBox
);
mMetEnsNumLabel
=
new
StyledLabel
(
"Number"
,
mMetEnsBox
);
mMetEnsNumLineEdit
=
new
LineEditFocusSelectAll
(
mMetEnsBox
);
QWidget
*
meSpacer
=
new
QWidget
(
mMetEnsBox
);
meSpacer
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Preferred
);
meLayout
->
addWidget
(
mMetEnsNumLabel
,
0
,
0
);
meLayout
->
addWidget
(
mMetEnsNumLineEdit
,
0
,
1
);
meLayout
->
addWidget
(
meSpacer
,
0
,
2
);
readInputsFromDM
();
}
void
APTEnsWidget
::
readInputsFromDM
()
{
mLatLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
latitude
()));
mLonLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
longitude
()));
mAltLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
altitude
()));
// TODO: fission id
// TODO: soil type
mTotalYieldLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
totalYield
()));
mNumYieldsLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
numYields
()));
mMinYieldLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
minYield
()));
mMaxYieldLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
maxYield
()));
// TODO: sampling
mHOBLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
heightOfBurst
()));
mNumHOBsLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
numHOBs
()));
mMinHOBLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
minHOB
()));
mMaxHOBLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
maxHOB
()));
// TODO: sampling
mDataModel
.
metFileSets
().
append
(
"asdf"
);
mDataModel
.
metFileSets
().
append
(
"zxcv"
);
mMetFileSetsListWidget
->
addItems
(
mDataModel
.
metFileSets
());
mDataModel
.
setupCfgs
().
append
(
"sdfg"
);
mDataModel
.
setupCfgs
().
append
(
"xcvb"
);
mSetupCfgsListWidget
->
addItems
(
mDataModel
.
setupCfgs
());
mTurbEnsNumLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
turbEnsNum
()));
mMetEnsNumLineEdit
->
setText
(
QString
::
number
(
mDataModel
.
metEnsNum
()));
}
rsmwidgets/examples/aptenswidget.hh
0 → 100644
View file @
12b5db8e
#ifndef RSM_RSMWIDGETSEXAMPLE_APTENSWIDGET_HH_
#define RSM_RSMWIDGETSEXAMPLE_APTENSWIDGET_HH_
#include
<QCheckBox>
#include
<QComboBox>
#include
<QGroupBox>
#include
<QLabel>
#include
<QLineEdit>
#include
<QListWidget>
#include
<QPushButton>
#include
"aptensdatamodel.hh"
namespace
AptEns
{
class
StyledLabel
:
public
QLabel
{
public:
StyledLabel
(
const
QString
&
title
,
QWidget
*
parent
=
Q_NULLPTR
);
};
class
CenterTitleGroupBox
:
public
QGroupBox
{
public:
CenterTitleGroupBox
(
const
QString
&
title
,
QWidget
*
parent
=
Q_NULLPTR
);
};
class
LeftTitleGroupBox
:
public
QGroupBox
{
public:
LeftTitleGroupBox
(
const
QString
&
title
,
QWidget
*
parent
=
Q_NULLPTR
);
};
class
LineEditFocusSelectAll
:
public
QLineEdit
{
public:
LineEditFocusSelectAll
(
QWidget
*
parent
=
Q_NULLPTR
);
LineEditFocusSelectAll
(
const
QString
&
text
,
QWidget
*
parent
=
Q_NULLPTR
);
protected:
void
focusInEvent
(
QFocusEvent
*
event
)
override
;
};
class
APTEnsWidget
:
public
QWidget
{
Q_OBJECT
private:
APTEnsDataModel
mDataModel
;
CenterTitleGroupBox
*
mEventDefBox
;
CenterTitleGroupBox
*
mYieldEnsBox
;
CenterTitleGroupBox
*
mHeightOfBurstEnsBox
;
CenterTitleGroupBox
*
mMeteorologyBox
;
CenterTitleGroupBox
*
mDispPhysEnsBox
;
CenterTitleGroupBox
*
mTurbEnsBox
;
CenterTitleGroupBox
*
mMetEnsBox
;
StyledLabel
*
mLatLabel
;
StyledLabel
*
mLonLabel
;
StyledLabel
*
mAltLabel
;
StyledLabel
*
mSoilTypeLabel
;
StyledLabel
*
mFissionIDLabel
;
LineEditFocusSelectAll
*
mLatLineEdit
;
LineEditFocusSelectAll
*
mLonLineEdit
;
LineEditFocusSelectAll
*
mAltLineEdit
;
QComboBox
*
mSoilTypeComboBox
;
QComboBox
*
mFissionIDComboBox
;
StyledLabel
*
mTotalYieldLabel
;
LineEditFocusSelectAll
*
mTotalYieldLineEdit
;
// TODO: enable/disable all other controls in group box
QCheckBox
*
mYieldDefineEnsCheckBox
;
StyledLabel
*
mNumYieldsLabel
;
LineEditFocusSelectAll
*
mNumYieldsLineEdit
;
StyledLabel
*
mMinYieldLabel
;
LineEditFocusSelectAll
*
mMinYieldLineEdit
;
StyledLabel
*
mMaxYieldLabel
;
LineEditFocusSelectAll
*
mMaxYieldLineEdit
;
StyledLabel
*
mYieldSamplingLabel
;
QComboBox
*
mYieldSamplingComboBox
;
StyledLabel
*
mHOBLabel
;
LineEditFocusSelectAll
*
mHOBLineEdit
;
// TODO: enable/disable all other controls in group box
QCheckBox
*
mHOBDefineEnsCheckBox
;
StyledLabel
*
mNumHOBsLabel
;
LineEditFocusSelectAll
*
mNumHOBsLineEdit
;
StyledLabel
*
mMinHOBLabel
;
LineEditFocusSelectAll
*
mMinHOBLineEdit
;
StyledLabel
*
mMaxHOBLabel
;
LineEditFocusSelectAll
*
mMaxHOBLineEdit
;
StyledLabel
*
mHOBSamplingLabel
;
QComboBox
*
mHOBSamplingComboBox
;
LeftTitleGroupBox
*
mMetFileSetsBox
;
QListWidget
*
mMetFileSetsListWidget
;
QPushButton
*
mMetAddSetButton
;
QPushButton
*
mMetRemoveSetButton
;
QPushButton
*
mMetAddButton
;
QPushButton
*
mMetRemoveButton
;
LeftTitleGroupBox
*
mSetupCfgsBox
;
QListWidget
*
mSetupCfgsListWidget
;
QPushButton
*
mSetupCfgsImportButton
;
QPushButton
*
mSetupCfgsRemoveButton
;
StyledLabel
*
mTurbEnsNumLabel
;
LineEditFocusSelectAll
*
mTurbEnsNumLineEdit
;
StyledLabel
*
mMetEnsNumLabel
;
LineEditFocusSelectAll
*
mMetEnsNumLineEdit
;
void
readInputsFromDM
();
public:
APTEnsWidget
(
QWidget
*
parent
=
nullptr
);
public
slots
:
// void execOutputReady();
// void execFailed(QString message);
// void execFinished();
};
}
// namespace AptEns
#endif // RSM_RSMWIDGETSEXAMPLE_APTENSWIDGET_HH_
rsmwidgets/examples/rsmportalexample.cc
View file @
12b5db8e
...
...
@@ -13,7 +13,6 @@
#include
<QLabel>
#include
<QMessageBox>
#include
<QTabWidget>
#include
<QTimer>
#include
"radixbug/bug.hh"
using
namespace
rsm
;
...
...
@@ -420,282 +419,15 @@ void ExamplePortalWidget::execFinished()
execingCommandType
=
""
;
}
// ----------------------------------------------------------------------------
StyledLabel
::
StyledLabel
(
const
QString
&
title
,
QWidget
*
parent
)
:
QLabel
(
title
,
parent
)
{
setAlignment
(
Qt
::
AlignRight
);
}
// ----------------------------------------------------------------------------
CenterTitleGroupBox
::
CenterTitleGroupBox
(
const
QString
&
title
,
QWidget
*
parent
)
:
QGroupBox
(
title
,
parent
)
{
setStyleSheet
(
R"foo(
QGroupBox {
padding: 1.4em 0em 0em 0em;
}
QGroupBox::title {
subcontrol-origin: padding;
subcontrol-position: top center;
padding: 0.7em 0em 0em 0em;
}
)foo"
);
}
// ----------------------------------------------------------------------------
LeftTitleGroupBox
::
LeftTitleGroupBox
(
const
QString
&
title
,
QWidget
*
parent
)
:
QGroupBox
(
title
,
parent
)
{
setStyleSheet
(
R"foo(
QGroupBox {
padding: 0em 0em 0em 0em;
}
QGroupBox::title {
subcontrol-origin: padding;
subcontrol-position: top left;
padding: 0.7em 0em 0em 0em;
left: 1em;
}
)foo"
);
}
// ----------------------------------------------------------------------------
LineEditFocusSelectAll
::
LineEditFocusSelectAll
(
QWidget
*
parent
)
:
QLineEdit
(
parent
)
{
}
LineEditFocusSelectAll
::
LineEditFocusSelectAll
(
const
QString
&
text
,
QWidget
*
parent
)
:
QLineEdit
(
text
,
parent
)
{
}
void
LineEditFocusSelectAll
::
focusInEvent
(
QFocusEvent
*
event
)
{
QLineEdit
::
focusInEvent
(
event
);
QTimer
::
singleShot
(
0
,
this
,
&
QLineEdit
::
selectAll
);
}
// ----------------------------------------------------------------------------
APTEnsWidget
::
APTEnsWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
QGridLayout
*
layout
=
new
QGridLayout
(
this
);
mEventDefBox
=
new
CenterTitleGroupBox
(
"Event Definition"
,
this
);
mYieldEnsBox
=
new
CenterTitleGroupBox
(
"Yield Ensemble"
,
this
);
mHeightOfBurstEnsBox
=
new
CenterTitleGroupBox
(
"Height of Burst Ensemble"
,
this
);
mMeteorologyBox
=
new
CenterTitleGroupBox
(
"Meteorology"
,
this
);