2511-viewer-enh-2 #6

Merged
leonarski_f merged 13 commits from 2511-viewer-enh-2 into main 2025-11-16 12:35:00 +01:00
6 changed files with 26 additions and 12 deletions
Showing only changes of commit 7608b93a0f - Show all commits

View File

@@ -153,6 +153,9 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString
connect(toolBarDisplay, &JFJochViewerToolbarDisplay::setForeground, viewer,
&JFJochDiffractionImage::changeForeground);
connect(viewer, &JFJochDiffractionImage::autoForegroundChanged,
toolBarDisplay, &JFJochViewerToolbarDisplay::updateAutoForeground);
connect(toolBarDisplay, &JFJochViewerToolbarDisplay::setAutoForeground, viewer,
&JFJochDiffractionImage::setAutoForeground);

View File

@@ -15,7 +15,7 @@ JFJochViewerToolbarDisplay::JFJochViewerToolbarDisplay(QWidget *parent)
addWidget(foreground_slider);
auto_foreground_button = new QPushButton("Auto");
auto_foreground_button->setCheckable(true);
auto_foreground_button->setChecked(auto_foreground);
auto_foreground_button->setChecked(false);
addWidget(auto_foreground_button);
addWidget(new QLabel("&nbsp;&nbsp;<b>Color map</b>&nbsp;&nbsp;"));
@@ -40,11 +40,6 @@ JFJochViewerToolbarDisplay::JFJochViewerToolbarDisplay(QWidget *parent)
}
void JFJochViewerToolbarDisplay::foregroundSet(double val) {
if (auto_foreground) {
auto_foreground = false;
auto_foreground_button->setChecked(false);
emit setAutoForeground(false);
}
emit setForeground(static_cast<float>(val));
}
@@ -59,7 +54,10 @@ void JFJochViewerToolbarDisplay::colorComboBoxSet(int val) {
void JFJochViewerToolbarDisplay::autoForegroundButtonPressed() {
auto_foreground = !auto_foreground;
auto_foreground_button->setChecked(auto_foreground);
emit setAutoForeground(auto_foreground);
}
emit setAutoForeground(auto_foreground_button->isChecked());
}
void JFJochViewerToolbarDisplay::updateAutoForeground(bool val) {
QSignalBlocker blocker(auto_foreground_button);
auto_foreground_button->setChecked(val);
}

View File

@@ -28,6 +28,7 @@ signals:
public slots:
void updateForeground(float val);
void updateAutoForeground(bool val);
private slots:
void foregroundSet(double val);

View File

@@ -304,11 +304,12 @@ void JFJochDiffractionImage::loadImage(std::shared_ptr<const JFJochReaderImage>
void JFJochDiffractionImage::setAutoForeground(bool input) {
auto_fg = input;
if (image && auto_fg) {
// If auto_foreground is not set, then view stays with the current settings till these are explicitely changed
// If auto_foreground is not set, then view stays with the current settings till these are explicitly changed
foreground = image->GetAutoContrastValue();
emit foregroundChanged(foreground);
Redraw();
}
emit autoForegroundChanged(auto_fg);
}
void JFJochDiffractionImage::setResolutionRing(QVector<float> v) {
@@ -376,3 +377,9 @@ void JFJochDiffractionImage::highlightIceRings(bool input) {
highlight_ice_rings = input;
updateOverlay();
}
void JFJochDiffractionImage::changeForeground(float val) {
auto_fg = false;
emit autoForegroundChanged(false);
JFJochImage::changeForeground(val);
}

View File

@@ -43,6 +43,10 @@ private:
float ice_ring_width_Q_recipA = 0.01;
void mouseHover(QMouseEvent* event) override;
signals:
void autoForegroundChanged(bool input);
public slots:
void loadImage(std::shared_ptr<const JFJochReaderImage> image);
void setAutoForeground(bool input);
@@ -59,5 +63,6 @@ public slots:
void showSaturation(bool input);
void highlightIceRings(bool input);
void changeForeground(float val) override;
};

View File

@@ -73,7 +73,7 @@ private slots:
public slots:
void setFeatureColor(QColor input);
void setColorMap(int color_map);
void changeForeground(float val);
virtual void changeForeground(float val);
void changeBackground(float val);
void SetROIBox(QRect box);