27 #include <QMouseEvent>
29 #include <QVBoxLayout>
33 const QString SettingsGroup =
"IntensityDataCanvas/";
35 const QString SettingsKeyGradient = SettingsGroup +
"Gradient";
37 const QString SettingsKeyInterpolation = SettingsGroup +
"Interpolation";
44 , m_resetViewAction(nullptr)
45 , m_rotateDataAction(nullptr)
46 , m_savePlotAction(nullptr)
48 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
50 auto* layout =
new QVBoxLayout;
52 layout->setSpacing(0);
76 return QSize(500, 400);
81 return QSize(128, 128);
105 if (event->button() == Qt::RightButton)
106 emit customContextMenuRequested(event->globalPos());
118 if (!realDataItem || !realDataItem->isIntensityData())
123 if (realDataItem->rotationAffectsSetup()) {
124 const QString title(
"Rotate data");
125 const QString message(
"Rotation will break the link between the data and the instrument. "
126 "Detector masks or projections, if they exist, will be removed.");
128 "Do you wish to rotate the data?",
"Yes, please rotate",
129 "No, cancel data rotation"))
133 QApplication::setOverrideCursor(Qt::WaitCursor);
134 realDataItem->rotateData();
135 QApplication::restoreOverrideCursor();
151 "x,y,z axes range will be set to default");
183 settings.setValue(SettingsKeyInterpolation,
intensityDataItem()->isInterpolated());
193 if (settings.contains(SettingsKeyGradient)) {
195 QString persistentGradient = settings.value(SettingsKeyGradient).toString();
196 if (combo.
getValue() != persistentGradient) {
202 if (settings.contains(SettingsKeyInterpolation)) {
203 bool value = settings.value(SettingsKeyInterpolation).toBool();
Defines class ColorMapCanvas.
Defines class ComboProperty.
Defines class IntensityDataCanvas.
Defines class IntensityDataItem.
Defines class GUIHelpers functions.
Defines class ProjectDocument.
Defines class RealDataItem.
Defines class SavePlotAssistant.
SessionData * gSessionData
global pointer to the single instance
Defines struct SessionData.
The ColorMapCanvas class contains ColorMap for intensity data presentation, and provide control of fo...
void setItem(SessionItem *intensityDataItem) override
void setStatusLabelEnabled(bool flag)
QCustomPlot * customPlot()
Custom property to define list of string values with multiple selections. Intended for QVariant.
void setValue(const QString &name)
QSize minimumSizeHint() const override
QAction * m_savePlotAction
void onMousePress(QMouseEvent *event)
IntensityDataCanvas(QWidget *parent=nullptr)
QSize sizeHint() const override
QList< QAction * > actionList() override
void setItem(SessionItem *intensityItem) override
void onPropertyChanged(const QString &name)
Reads gradient/ interpolation settings from IntensityDataItem and writes to persistant project settin...
QAction * m_resetViewAction
void applyPersistentSettings()
Apply persistent settings (gradient, interpolation) to IntensityDataItem.
IntensityDataItem * intensityDataItem()
ColorMapCanvas * m_colorMap
void subscribeToItem() override
QAction * m_rotateDataAction
void setGradient(const ComboProperty &gradient)
void resetView()
Set axes viewport to original data.
void setInterpolated(bool interp)
ComboProperty getGradient() const
static bool isInterpolatedPropertyName(const QString &name)
static bool isGradientPropertyName(const QString &name)
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=nullptr)
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
Base class for a GUI data item.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
SessionItem * parentItem() const
Returns parent of this item.
static QMainWindow * mainWindow
void savePlot(const QString &dirname, QCustomPlot *plot, Datafield *output_data)
QString const & name(EShape k)
bool question(QWidget *parent, const QString &title, const QString &text, const QString &detailedText, const QString &yesText, const QString &noText)
std::optional< ProjectDocument * > projectDocument