Mantid
Loading...
Searching...
No Matches
ImageInfoWidget.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7
10
11#include <QAbstractScrollArea>
12#include <QHeaderView>
13#include <QTableWidget>
14
16
22 : IImageInfoWidget(parent), m_presenter(std::make_unique<ImageInfoPresenter>(this)) {
23 setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
24 setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
25 horizontalHeader()->hide();
26 verticalHeader()->hide();
27}
28
35void ImageInfoWidget::cursorAt(const double x, const double y, const double signal,
36 const QMap<QString, QString> &extraValues) {
37 m_presenter->cursorAt(x, y, signal, extraValues);
38}
39
45 if (info.empty())
46 return;
47
48 const auto itemCount(info.size());
49 setColumnCount(itemCount);
50 for (int i = 0; i < itemCount; ++i) {
51 auto header = new QTableWidgetItem(info.name(i));
52 header->setFlags(header->flags() & ~Qt::ItemIsEditable);
53 setItem(0, i, header);
54 auto value = new QTableWidgetItem(info.value(i));
55 value->setFlags(header->flags() & ~Qt::ItemIsEditable);
56 setItem(1, i, value);
57 }
58 horizontalHeader()->setMinimumSectionSize(50);
59 resizeColumnsToContents();
60}
61
67} // namespace MantidQt::MantidWidgets
double value
The value of the point.
Definition: FitMW.cpp:51
const QString & value(int index) const noexcept
const QString & name(int index) const noexcept
A table widget containing information about the pixel the mouse is over in an image.
void cursorAt(const double x, const double y, const double signal, const QMap< QString, QString > &extraValues) override
ImageInfoWidget(QWidget *parent=nullptr)
Constructor.
void setWorkspace(const Mantid::API::Workspace_sptr &ws) override
Set the workspace to probe for information.
void showInfo(const ImageInfoModel::ImageInfo &info) override
Display the information provided within the table cells.
std::unique_ptr< ImageInfoPresenter > m_presenter
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:20
STL namespace.