20constexpr int kExportCellWidth = 50;
21constexpr int kExportCellHeight = 40;
33 delegate->setPlotType(plotType);
34 view.setItemDelegate(delegate);
35 view.setShowGrid(
false);
36 view.setAlternatingRowColors(
true);
37 view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
38 view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
39 view.horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
40 view.verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
41 view.horizontalHeader()->setDefaultSectionSize(cellW);
42 view.verticalHeader()->setDefaultSectionSize(cellH);
46 const int contentW = view.horizontalHeader()->length() + view.verticalHeader()->width();
47 const int contentH = view.verticalHeader()->length() + view.horizontalHeader()->height();
48 view.resize(contentW, contentH);
55 return renderToPixmap(model, plotType, kExportCellWidth, kExportCellHeight).save(fileName);
61 QPrinter printer(QPrinter::HighResolution);
62 printer.setPageSize(QPageSize(QPageSize::A4));
63 printer.setPageOrientation(QPageLayout::Orientation::Landscape);
64 printer.setOutputFormat(QPrinter::PdfFormat);
65 printer.setOutputFileName(fileName);
69 if (!painter.begin(&printer)) {
74 const QPixmap pixmap =
renderToPixmap(model, plotType, kExportCellWidth, kExportCellHeight);
75 const QSize target = pixmap.size().scaled(painter.viewport().size(), Qt::KeepAspectRatio);
76 painter.drawPixmap(QRect(QPoint(0, 0), target), pixmap);
86 if (value ==
static_cast<int>(Status::Unknown)) {
return QLatin1Char(
'x'); }
87 if (value ==
static_cast<int>(Status::Error)) {
return QLatin1Char(
'E'); }
88 return (value == 0) ? QLatin1Char(
'0') : QLatin1Char(
'1');
94 for (
int row = 0; row < inputRowCount; ++row) {
95 for (
int col = 0; col < model->columnCount(); ++col) {
99 const auto *header = model->verticalHeaderItem(row);
100 out <<
" : \"" << (header ? header->text() : QString()) <<
"\"\n";
105 for (
int row = inputRowCount; row < model->rowCount(); ++row) {
106 for (
int col = 0; col < model->columnCount(); ++col) {
110 const auto *header = model->verticalHeaderItem(row);
111 out <<
" : \"" << (header ? header->text() : QString()) <<
"\"\n";
119 QTextStream out(&text);
121 out << model->rowCount() <<
"," << model->columnCount() <<
",\n";
123 for (
int row = 0; row < model->rowCount(); ++row) {
124 for (
int col = 0; col < model->columnCount(); ++col) {
125 out << model->
value(row, col) <<
",";
Common logging utilities, the Pandaception error type, and helper macros.
#define PANDACEPTION_WITH_CONTEXT(context, msg,...)
DolphinExporter: renders/serializes a SignalModel to images and text artifacts.
Central enumeration types for element types, groups, and signal status.
SignalDelegate: paints digital waveform graphics into table cells.
PlotType
Controls how signal cells are rendered in the waveform table.
SignalModel for the beWavedDolphin waveform table.
Item delegate that draws digital waveform graphics inside table cells.
QStandardItemModel subclass that makes all cells non-editable.
int value(int row, int col) const
Returns the logic value (0/1) of the cell at (row, col).
Model → artifact conversions for the beWavedDolphin export paths.
void exportToPdf(const SignalModel *model, const PlotType plotType, const QString &fileName)
QPixmap renderToPixmap(const SignalModel *model, const PlotType plotType, const int cellW, const int cellH)
void writeTruthTableText(QTextStream &out, const SignalModel *model, const int inputRowCount)
QString csvText(const SignalModel *model)
bool exportToPng(const SignalModel *model, const PlotType plotType, const QString &fileName)
static QChar cellChar(const int value)