BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
JobPropertiesWidget Class Reference

Description

The JobPropertiesWidget class holds component editor for JobItem. Part of JobSelectorWidget, resides at lower left corner of JobView.

Definition at line 29 of file JobPropertiesWidget.h.

Inheritance diagram for JobPropertiesWidget:
[legend]
Collaboration diagram for JobPropertiesWidget:
[legend]

Public Member Functions

 JobPropertiesWidget (QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
 
 ~JobPropertiesWidget () override
 
QSize minimumSizeHint () const override
 
void setItem (JobItem *item)
 
QSize sizeHint () const override
 

Private Slots

void onCommentsEdited ()
 

Private Member Functions

void notifyJobPropertyChange ()
 

Private Attributes

QTextEdit * m_commentsEditor
 
JobItemm_item
 
JobPropertiesTableModelm_propertiesModel
 
QTreeView * m_propertiesView
 
QTabWidget * m_tabWidget
 

Constructor & Destructor Documentation

◆ JobPropertiesWidget()

JobPropertiesWidget::JobPropertiesWidget ( QWidget *  parent = nullptr,
Qt::WindowFlags  f = Qt::WindowFlags() 
)
explicit

Definition at line 39 of file JobPropertiesWidget.cpp.

40  : QWidget(parent, f)
41  , m_item(nullptr)
42 {
43  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
45 
46  auto* layout = new QVBoxLayout(this);
47  layout->setMargin(0);
48  layout->setSpacing(0);
49  layout->setContentsMargins(0, 0, 0, 0);
50 
51  m_tabWidget = new QTabWidget(this);
52  m_tabWidget->setTabPosition(QTabWidget::South);
53  layout->addWidget(m_tabWidget);
54 
55  m_propertiesView = new QTreeView(this);
56  m_propertiesView->setRootIsDecorated(false);
57  m_propertiesView->setAlternatingRowColors(true);
58  m_tabWidget->insertTab(JOB_PROPERTIES, m_propertiesView, "Job Properties");
61 
62  m_commentsEditor = new QTextEdit(this);
63  m_tabWidget->insertTab(JOB_MESSAGES, m_commentsEditor, "Messages");
64 
65  connect(m_commentsEditor, &QTextEdit::textChanged, this,
67 }
The JobPropertiesTableModel is a table model for the properties of a job except for the comment....
JobPropertiesTableModel * m_propertiesModel
const QString JobPropertiesWidgetName

References GUI::Constants::JobPropertiesWidgetName, m_commentsEditor, m_propertiesModel, m_propertiesView, m_tabWidget, and onCommentsEdited().

Here is the call graph for this function:

◆ ~JobPropertiesWidget()

JobPropertiesWidget::~JobPropertiesWidget ( )
override

Definition at line 69 of file JobPropertiesWidget.cpp.

70 {
71  if (m_item)
72  disconnect(m_item, nullptr, this, nullptr);
73 }

References m_item.

Member Function Documentation

◆ minimumSizeHint()

QSize JobPropertiesWidget::minimumSizeHint ( ) const
override

Definition at line 80 of file JobPropertiesWidget.cpp.

81 {
83 }
int PropertyPanelWidth()
Returns typical width of the vertical property panel.
Definition: StyleUtils.cpp:124

References GUI::Util::Style::PropertyPanelWidth().

Here is the call graph for this function:

◆ notifyJobPropertyChange()

void JobPropertiesWidget::notifyJobPropertyChange ( )
private

Definition at line 107 of file JobPropertiesWidget.cpp.

108 {
109  connect(m_item, &JobItem::jobCommentsChanged, this, [=](const QString&) {
110  if (m_item && m_item->getComments() != m_commentsEditor->toPlainText()) {
111  m_commentsEditor->blockSignals(true);
112  m_commentsEditor->setPlainText(m_item->getComments());
113  m_commentsEditor->blockSignals(false);
114  }
115  });
116 }
QString getComments() const
Definition: JobItem.cpp:190
void jobCommentsChanged(const QString &comments)

References JobItem::getComments(), JobItem::jobCommentsChanged(), m_commentsEditor, and m_item.

Referenced by setItem().

Here is the call graph for this function:

◆ onCommentsEdited

void JobPropertiesWidget::onCommentsEdited ( )
privateslot

Definition at line 122 of file JobPropertiesWidget.cpp.

123 {
124  if (m_item) {
125  m_item->blockSignals(true);
126  m_item->setComments(m_commentsEditor->toPlainText());
127  m_item->blockSignals(false);
128  }
129 }
void setComments(const QString &comments)
Definition: JobItem.cpp:195

References m_commentsEditor, m_item, and JobItem::setComments().

Referenced by JobPropertiesWidget().

Here is the call graph for this function:

◆ setItem()

void JobPropertiesWidget::setItem ( JobItem item)

Definition at line 85 of file JobPropertiesWidget.cpp.

86 {
87  if (m_item)
88  disconnect(m_item, nullptr, this, nullptr);
89  m_item = item;
91  if (m_item) {
92  if (m_item->isFailed())
93  m_tabWidget->tabBar()->setTabTextColor(JOB_MESSAGES, Qt::red);
94  else
95  m_tabWidget->tabBar()->setTabTextColor(JOB_MESSAGES, Qt::black);
96  m_commentsEditor->setText(m_item->getComments());
97 
99  } else
100  m_commentsEditor->clear();
101 }
bool isFailed() const
Definition: JobItem.cpp:144

References JobItem::getComments(), JobItem::isFailed(), m_commentsEditor, m_item, m_propertiesModel, m_tabWidget, notifyJobPropertyChange(), and JobPropertiesTableModel::setItem().

Referenced by JobSelectorWidget::onSelectedJobsChanged().

Here is the call graph for this function:

◆ sizeHint()

QSize JobPropertiesWidget::sizeHint ( ) const
override

Definition at line 75 of file JobPropertiesWidget.cpp.

References GUI::Util::Style::PropertyPanelWidth().

Here is the call graph for this function:

Member Data Documentation

◆ m_commentsEditor

QTextEdit* JobPropertiesWidget::m_commentsEditor
private

◆ m_item

JobItem* JobPropertiesWidget::m_item
private

◆ m_propertiesModel

JobPropertiesTableModel* JobPropertiesWidget::m_propertiesModel
private

Definition at line 48 of file JobPropertiesWidget.h.

Referenced by JobPropertiesWidget(), and setItem().

◆ m_propertiesView

QTreeView* JobPropertiesWidget::m_propertiesView
private

Definition at line 47 of file JobPropertiesWidget.h.

Referenced by JobPropertiesWidget().

◆ m_tabWidget

QTabWidget* JobPropertiesWidget::m_tabWidget
private

Definition at line 46 of file JobPropertiesWidget.h.

Referenced by JobPropertiesWidget(), and setItem().


The documentation for this class was generated from the following files: