Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
b2c76c86
Commit
b2c76c86
authored
Sep 04, 2020
by
Mathieu Tillet
Browse files
Tidy code and fix minor issues
parent
2c0cdeb5
Changes
6
Hide whitespace changes
Inline
Side-by-side
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentWidget.h
View file @
b2c76c86
...
...
@@ -160,7 +160,7 @@ public:
void
addTab
(
const
std
::
string
&
tabName
);
void
hideHelp
();
InstrumentWidgetPickTab
*
getPickTab
()
{
return
m_pickTab
;
};
bool
isIntegrable
()
const
{
return
m_s
hould
Integra
t
e
;
}
bool
isIntegrable
()
const
{
return
m_
i
sIntegra
bl
e
;
}
signals:
void
enableLighting
(
bool
/*_t1*/
);
...
...
@@ -315,7 +315,7 @@ protected:
std
::
vector
<
std
::
pair
<
std
::
string
,
bool
>>
m_stateOfTabs
;
/// Is the workspace monochromatic ?
bool
m_s
hould
Integra
t
e
;
bool
m_
i
sIntegra
bl
e
;
private:
/// ADS notification handlers
...
...
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/ProjectionSurface.h
View file @
b2c76c86
...
...
@@ -147,7 +147,7 @@ public:
/// Save settings for the projection surface to a project file
virtual
std
::
string
saveToProject
()
const
;
void
setCurrentTab
(
in
t
currentTab
)
{
m_currentTab
=
currentTab
;
}
void
setCurrentTab
(
QStr
in
g
currentTab
)
{
m_currentTab
=
currentTab
;
}
//-----------------------------------
// Mask methods
...
...
@@ -390,7 +390,7 @@ private:
/// Set when the picking image must be redrawn regardless of the interaction
/// mode
mutable
bool
m_redrawPicking
;
in
t
m_currentTab
;
QStr
in
g
m_currentTab
;
friend
class
InstrumentWidgetEncoder
;
friend
class
InstrumentWidgetDecoder
;
...
...
qt/widgets/instrumentview/src/InstrumentWidget.cpp
View file @
b2c76c86
...
...
@@ -159,14 +159,14 @@ InstrumentWidget::InstrumentWidget(const QString &wsName, QWidget *parent,
try
{
size_t
blockSize
=
m_instrumentActor
->
getWorkspace
()
->
blocksize
();
m_s
hould
Integra
t
e
=
m_
i
sIntegra
bl
e
=
(
blockSize
>
1
||
m_instrumentActor
->
getWorkspace
()
->
id
()
==
"EventWorkspace"
);
}
catch
(...)
{
m_s
hould
Integra
t
e
=
true
;
m_
i
sIntegra
bl
e
=
true
;
}
if
(
m_s
hould
Integra
t
e
)
{
if
(
m_
i
sIntegra
bl
e
)
{
m_xIntegration
=
new
XIntegrationControl
(
this
);
mainLayout
->
addWidget
(
m_xIntegration
);
connect
(
m_xIntegration
,
SIGNAL
(
changed
(
double
,
double
)),
this
,
...
...
@@ -306,7 +306,7 @@ void InstrumentWidget::init(bool resetGeometry, bool autoscaling,
new
InstrumentActor
(
m_workspaceName
,
autoscaling
,
scaleMin
,
scaleMax
));
}
if
(
m_s
hould
Integra
t
e
)
{
if
(
m_
i
sIntegra
bl
e
)
{
m_xIntegration
->
setTotalRange
(
m_instrumentActor
->
minBinValue
(),
m_instrumentActor
->
maxBinValue
());
m_xIntegration
->
setUnits
(
QString
::
fromStdString
(
...
...
@@ -356,7 +356,7 @@ void InstrumentWidget::resetSurface() {
* Select the tab to be displayed
*/
void
InstrumentWidget
::
selectTab
(
int
tab
)
{
getSurface
()
->
setCurrentTab
(
tab
);
getSurface
()
->
setCurrentTab
(
mControlsTab
->
tabText
(
tab
)
);
mControlsTab
->
setCurrentIndex
(
tab
);
}
...
...
@@ -581,7 +581,7 @@ void InstrumentWidget::tabChanged(int /*unused*/) {
updateInfoText
();
auto
surface
=
getSurface
();
if
(
surface
)
{
surface
->
setCurrentTab
(
getCurrentTab
());
surface
->
setCurrentTab
(
mControlsTab
->
tabText
(
getCurrentTab
())
)
;
}
}
...
...
@@ -894,7 +894,7 @@ void InstrumentWidget::setIntegrationRange(double xmin, double xmax) {
* python.
*/
void
InstrumentWidget
::
setBinRange
(
double
xmin
,
double
xmax
)
{
if
(
m_s
hould
Integra
t
e
)
{
if
(
m_
i
sIntegra
bl
e
)
{
m_xIntegration
->
setRange
(
xmin
,
xmax
);
}
}
...
...
@@ -1266,7 +1266,7 @@ void InstrumentWidget::createTabs(QSettings &settings) {
this
,
SLOT
(
executeAlgorithm
(
const
QString
&
,
const
QString
&
)));
m_maskTab
->
loadSettings
(
settings
);
if
(
m_s
hould
Integra
t
e
)
{
if
(
m_
i
sIntegra
bl
e
)
{
connect
(
m_xIntegration
,
SIGNAL
(
changed
(
double
,
double
)),
m_maskTab
,
SLOT
(
changedIntegrationRange
(
double
,
double
)));
}
...
...
qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp
View file @
b2c76c86
...
...
@@ -529,7 +529,7 @@ void InstrumentWidgetMaskTab::setActivity() {
* Can be used either to mask the picked pixel or its parent.
*/
void
InstrumentWidgetMaskTab
::
singlePixelPicked
(
size_t
pickID
)
{
auto
&
actor
=
m_instrWidget
->
getInstrumentActor
();
const
auto
&
actor
=
m_instrWidget
->
getInstrumentActor
();
const
auto
&
componentInfo
=
actor
.
componentInfo
();
if
(
!
componentInfo
.
isDetector
(
pickID
))
{
return
;
...
...
@@ -548,6 +548,7 @@ void InstrumentWidgetMaskTab::singlePixelPicked(size_t pickID) {
detectorsId
=
componentInfo
.
detectorsInSubtree
(
parent
);
}
storeDetectorMask
(
m_roi_on
->
isChecked
(),
detectorsId
);
}
else
if
(
m_grouping_on
->
isChecked
())
{
if
(
m_pixel
->
isChecked
())
{
Mantid
::
detid_t
detId
=
actor
.
getDetID
(
pickID
);
...
...
@@ -558,8 +559,9 @@ void InstrumentWidgetMaskTab::singlePixelPicked(size_t pickID) {
if
(
!
componentInfo
.
hasParent
(
pickID
))
{
return
;
}
auto
parent
=
componentInfo
.
parent
(
pickID
);
auto
dets
=
actor
.
getDetIDs
(
componentInfo
.
detectorsInSubtree
(
parent
));
const
auto
parent
=
componentInfo
.
parent
(
pickID
);
const
auto
dets
=
actor
.
getDetIDs
(
componentInfo
.
detectorsInSubtree
(
parent
));
m_detectorsToGroup
.
clear
();
for
(
auto
det
:
dets
)
m_detectorsToGroup
.
append
(
det
);
...
...
@@ -766,7 +768,6 @@ void InstrumentWidgetMaskTab::applyMaskToView() {
*/
void
InstrumentWidgetMaskTab
::
clearMask
()
{
clearShapes
();
m_instrWidget
->
getInstrumentActor
().
clearMasks
();
m_instrWidget
->
updateInstrumentView
();
enableApplyButtons
();
...
...
@@ -1221,15 +1222,17 @@ InstrumentWidgetMaskTab::addDoubleProperty(const QString &name) const {
void
InstrumentWidgetMaskTab
::
storeDetectorMask
(
bool
isROI
,
const
std
::
vector
<
size_t
>
&
onClickDets
)
{
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
m_pointer
->
setChecked
(
true
);
setActivity
();
m_instrWidget
->
updateInstrumentView
();
// to refresh the pick image
Mantid
::
API
::
IMaskWorkspace_sptr
wsFresh
;
const
auto
&
actor
=
m_instrWidget
->
getInstrumentActor
();
std
::
vector
<
size_t
>
dets
;
// get detectors covered by the shapes
m_instrWidget
->
getSurface
()
->
getMaskedDetectors
(
dets
);
if
(
onClickDets
.
size
()
==
0
)
{
// get detectors covered by the shapes
m_instrWidget
->
getSurface
()
->
getMaskedDetectors
(
dets
);
m_pointer
->
setChecked
(
true
);
setActivity
();
}
dets
.
insert
(
dets
.
end
(),
onClickDets
.
begin
(),
onClickDets
.
end
());
if
(
!
dets
.
empty
())
{
auto
wsMask
=
actor
.
getMaskWorkspace
();
...
...
@@ -1273,8 +1276,10 @@ void InstrumentWidgetMaskTab::storeDetectorMask(
m_instrWidget
->
updateInstrumentDetectors
();
}
}
// remove masking shapes
clearShapes
();
if
(
onClickDets
.
size
()
==
0
)
{
// remove masking shapes
clearShapes
();
}
QApplication
::
restoreOverrideCursor
();
}
...
...
qt/widgets/instrumentview/src/ProjectionSurface.cpp
View file @
b2c76c86
...
...
@@ -849,7 +849,7 @@ void ProjectionSurface::selectMultipleMasks(const QRect &rect) {
*/
void
ProjectionSurface
::
pickComponentAt
(
int
x
,
int
y
)
{
size_t
pickID
=
getPickID
(
x
,
y
);
if
(
m_currentTab
==
2
)
{
if
(
m_currentTab
==
"Draw"
)
{
emit
singleComponentPickedForMasking
(
pickID
);
}
else
{
emit
singleComponentPicked
(
pickID
);
...
...
qt/widgets/instrumentview/src/XIntegrationControl.cpp
View file @
b2c76c86
...
...
@@ -178,9 +178,6 @@ void XIntegrationScrollBar::updateMinMax() {
XIntegrationControl
::
XIntegrationControl
(
InstrumentWidget
*
instrWindow
)
:
QFrame
(
instrWindow
),
m_instrWindow
(
instrWindow
),
m_totalMinimum
(
0
),
m_totalMaximum
(
1
),
m_minimum
(
0
),
m_maximum
(
1
)
{
// if the integration control panel is hidden, most of the fields should not
// be declared
auto
*
layout
=
new
QHBoxLayout
();
m_minText
=
new
QLineEdit
(
this
);
m_minText
->
setMaximumWidth
(
100
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment