Skip to content
Snippets Groups Projects
Commit 05416287 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

reduce SessionItem exposure

parent 51944030
No related branches found
No related tags found
1 merge request!649Cleanup and a few corrections
......@@ -172,7 +172,7 @@ void GUI::Model::JobFunctions::copyRealDataItem(JobItem* jobItem, const RealData
// adapting the name to job name
realDataItemCopy->dataItem()->setFileName(
GUI::Model::FilenameUtils::jobReferenceFileName(jobItem->itemName()));
GUI::Model::FilenameUtils::jobReferenceFileName(jobItem->jobName()));
// #baimport ++ copy members of realDataItem?
......
......@@ -87,6 +87,16 @@ void JobItem::setIdentifier(const QString& identifier)
setItemValue(JobItem::P_IDENTIFIER, identifier);
}
QString JobItem::jobName() const
{
return itemName();
}
void JobItem::setJobName(const QString& name)
{
setItemName(name);
}
IntensityDataItem* JobItem::intensityDataItem()
{
return dynamic_cast<IntensityDataItem*>(getItem(T_OUTPUT));
......
......@@ -17,9 +17,9 @@
#include "GUI/Model/BaseItem/SessionItem.h"
#include "GUI/Model/Item/InstrumentItems.h"
#include "GUI/Model/Item/MaterialItems.h"
#include "GUI/Model/Item/MultiLayerItem.h"
#include "GUI/Model/Item/ParameterTreeItems.h"
#include "GUI/Model/Item/MaterialItems.h"
#include "GUI/Model/Model/SessionModel.h" // call to model() from templated fct
#include "GUI/Support/Data/JobStatus.h" // enum cannot be forward declared
#include "GUI/Support/Data/SimulationOptionsItem.h"
......@@ -64,6 +64,9 @@ public:
QString getIdentifier() const;
void setIdentifier(const QString& identifier);
QString jobName() const;
void setJobName(const QString& name);
IntensityDataItem* intensityDataItem();
DataItem* dataItem();
template <typename T> T* setDataType();
......
......@@ -55,7 +55,7 @@ QVariant JobListModel::data(const QModelIndex& index, int role) const
JobItem* item = jobs[index.row()];
if (role == Qt::DisplayRole)
return item->itemName();
return item->jobName();
return {};
}
......
......@@ -207,7 +207,7 @@ void JobListView::showContextMenu(const QPoint&)
std::sort(indexes.begin(), indexes.end(), row_ascending);
for (const QModelIndex& index : indexes) {
JobItem* job = m_model->jobForIndex(index);
QAction* action = m_equalizeMenu->addAction(QString("to ").append(job->itemName()));
QAction* action = m_equalizeMenu->addAction(QString("to ").append(job->jobName()));
connect(action, &QAction::triggered, this, [this, job] { equalizeSelectedToJob(job); });
}
m_equalizeMenu->setEnabled(true);
......
......@@ -49,9 +49,8 @@ void JobListViewDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
painter->setRenderHint(QPainter::Antialiasing, true);
QString text = item->itemName();
QRect textRect = getTextRect(option.rect);
painter->drawText(textRect, text);
painter->drawText(textRect, item->jobName());
drawCustomProjectBar(item, painter, option);
......
......@@ -83,7 +83,7 @@ QVariant JobPropertiesTableModel::data(const QModelIndex& index, int role) const
case Column::Value: {
switch (index.row()) {
case Row::Name:
return m_item->itemName();
return m_item->jobName();
case Row::Sample:
return m_item->sampleName();
case Row::Instrument:
......@@ -135,7 +135,7 @@ bool JobPropertiesTableModel::setData(const QModelIndex& index, const QVariant&
if (role != Qt::EditRole || index.column() != Column::Value || index.row() != Row::Name
|| !m_item)
return false;
m_item->setItemName(value.toString());
m_item->setJobName(value.toString());
emit dataChanged(index, index, {role});
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment