BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
gui2::LoaderPreviewPanel Class Reference

Panel with settings for DataLoaderDialog. More...

Inheritance diagram for gui2::LoaderPreviewPanel:
[legend]
Collaboration diagram for gui2::LoaderPreviewPanel:
[legend]

Public Member Functions

 LoaderPreviewPanel (QWidget *parent=nullptr)
 
void clearPanel ()
 
std::vector< ColumnInfocolumnInfo () const
 
void showData (const ParserInterface *parser)
 Sets raw text to the TextView. More...
 

Private Attributes

ImportTableWidgetm_tableWidget {nullptr}
 
QTabWidget * m_tabWidget {nullptr}
 
ImportTextViewm_textView {nullptr}
 

Detailed Description

Panel with settings for DataLoaderDialog.

Located on its right side, contains text and table views.

Definition at line 34 of file loaderpreviewpanel.h.

Constructor & Destructor Documentation

◆ LoaderPreviewPanel()

gui2::LoaderPreviewPanel::LoaderPreviewPanel ( QWidget *  parent = nullptr)

Definition at line 32 of file loaderpreviewpanel.cpp.

33  : QWidget(parent)
34  , m_textView(new ImportTextView)
35  , m_tableWidget(new ImportTableWidget)
36  , m_tabWidget(new QTabWidget)
37 {
38  auto layout = new QVBoxLayout(this);
39  layout->setContentsMargins(0, 0, 0, 0);
40 
41  m_tabWidget->addTab(m_textView, "Text view");
42  m_tabWidget->addTab(m_tableWidget, "Table view");
43 
44  layout->addWidget(m_tabWidget);
45 }
ImportTableWidget * m_tableWidget

References m_tableWidget, m_tabWidget, and m_textView.

Member Function Documentation

◆ clearPanel()

void gui2::LoaderPreviewPanel::clearPanel ( )

Definition at line 68 of file loaderpreviewpanel.cpp.

69 {
70  m_textView->clear();
72 }
void setRawData(const std::vector< std::vector< std::string >> &table_data)

References m_tableWidget, m_textView, and gui2::ImportTableWidget::setRawData().

Referenced by gui2::DataLoaderDialog::onShowFilePreviewRequest().

Here is the call graph for this function:

◆ columnInfo()

std::vector< ColumnInfo > gui2::LoaderPreviewPanel::columnInfo ( ) const

Definition at line 63 of file loaderpreviewpanel.cpp.

64 {
65  return m_tableWidget->columnInfo();
66 }
std::vector< ColumnInfo > columnInfo() const

References gui2::ImportTableWidget::columnInfo(), and m_tableWidget.

Referenced by gui2::DataLoaderDialog::onParseAllRequest().

Here is the call graph for this function:

◆ showData()

void gui2::LoaderPreviewPanel::showData ( const ParserInterface parser)

Sets raw text to the TextView.

Definition at line 49 of file loaderpreviewpanel.cpp.

50 {
51  m_textView->clear();
52  for (size_t index = 0; index < parser->totalLineCount(); ++index) {
53  auto line_data = parser->getLine(index);
54  auto parts = parser->parseResults(index);
55  auto string_to_show = Utils::AddHtmlColorTagToParts(line_data, parts, blue, gray);
56  m_textView->appendHtml(QString::fromStdString(string_to_show));
57  }
58  m_textView->moveCursor(QTextCursor::Start);
59 
60  m_tableWidget->setRawData(parser->parsedData());
61 }
DAREFLCORE_EXPORT std::string AddHtmlColorTagToParts(const std::string &line, const std::vector< std::string > &parts, const std::string &color_parts, const std::string &color_rest)
Returns string representing original 'line', where 'parts' are surrounded with color tag.

References gui2::Utils::AddHtmlColorTagToParts(), gui2::ParserInterface::getLine(), m_tableWidget, m_textView, gui2::ParserInterface::parsedData(), gui2::ParserInterface::parseResults(), gui2::ImportTableWidget::setRawData(), and gui2::ParserInterface::totalLineCount().

Referenced by gui2::DataLoaderDialog::onShowFilePreviewRequest().

Here is the call graph for this function:

Member Data Documentation

◆ m_tableWidget

ImportTableWidget* gui2::LoaderPreviewPanel::m_tableWidget {nullptr}
private

Definition at line 48 of file loaderpreviewpanel.h.

Referenced by LoaderPreviewPanel(), clearPanel(), columnInfo(), and showData().

◆ m_tabWidget

QTabWidget* gui2::LoaderPreviewPanel::m_tabWidget {nullptr}
private

Definition at line 49 of file loaderpreviewpanel.h.

Referenced by LoaderPreviewPanel().

◆ m_textView

ImportTextView* gui2::LoaderPreviewPanel::m_textView {nullptr}
private

Definition at line 47 of file loaderpreviewpanel.h.

Referenced by LoaderPreviewPanel(), clearPanel(), and showData().


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