26 #include <QApplication>
27 #include <QHeaderView>
36 #define MAX_BUFFER_SIZE 10000
37 #define BUFFER_SIZE_FACTOR 1.3
40 QTableView(parent), newMessageCount(0), maxNewLogLevelType(eUNDEFINED)
45 this->setVerticalScrollMode(ScrollMode::ScrollPerPixel);
47 setObjectName(QString::fromUtf8(
"tableLog"));
48 QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Expanding);
49 sizePolicy2.setHorizontalStretch(10);
50 sizePolicy2.setVerticalStretch(10);
51 sizePolicy2.setHeightForWidth(sizePolicy().hasHeightForWidth());
52 setSizePolicy(sizePolicy2);
53 setSizeIncrement(QSize(1, 0));
54 setEditTriggers(QAbstractItemView::DoubleClicked);
55 setAlternatingRowColors(
true);
57 setGridStyle(Qt::SolidLine);
58 setSortingEnabled(
false);
60 setCornerButtonEnabled(
true);
62 setSelectionMode(QAbstractItemView::SingleSelection);
63 setSelectionBehavior(QAbstractItemView::SelectRows);
65 horizontalHeader()->setVisible(
true);
66 horizontalHeader()->setCascadingSectionResizes(
true);
67 horizontalHeader()->setDefaultSectionSize(100);
68 horizontalHeader()->setMinimumSectionSize(20);
69 horizontalHeader()->setStretchLastSection(
true);
70 verticalHeader()->setVisible(
false);
71 verticalHeader()->setDefaultSectionSize(20);
77 setColumnWidth(0, 90);
78 setColumnWidth(1, 90);
79 setColumnWidth(2, 90);
80 setColumnWidth(3, 60);
81 setColumnWidth(4, 700);
82 setColumnWidth(5, 150);
83 setColumnWidth(6, 200);
94 QAbstractItemModel* absmodel = qobject_cast<QAbstractItemModel*>(model());
96 SIGNAL(rowsAboutToBeInserted(QModelIndex,
int,
int)),
100 this, SIGNAL(doubleClicked(QModelIndex)),
this, SLOT(
doubleClickOnCell(QModelIndex)));
102 SIGNAL(dataChanged(QModelIndex, QModelIndex)),
105 connect(verticalScrollBar(), SIGNAL(valueChanged(
int)),
this, SLOT(
checkAutoScroll()));
127 setRowHidden(row,
true);
129 else if (isRowHidden(row) &&
contains)
131 setRowHidden(row,
false);
143 int rowCount = model()->rowCount();
145 for (
int i = startRow; i < rowCount; i++)
149 setRowHidden(i,
true);
153 qApp->processEvents();
172 int rowCount = model()->rowCount();
174 for (
int i = startRow; i < rowCount; i++)
180 setRowHidden(i,
false);
185 setRowHidden(i,
true);
189 qApp->processEvents();
248 if (verticalScrollBar()->
value() == verticalScrollBar()->maximum())
287 if (verticalScrollBar()->
value() == verticalScrollBar()->maximum())
301 auto fontHeight = QFontMetrics(font()).height();
303 for (
int i = start; i <= end && i < logModel->rowCount(); ++i)
306 auto index = model()->index(i, 4, parent);
307 auto stringRows = model()->data(
index).toString().split(
"\n").size();
310 setRowHeight(i, fontHeight * stringRows + 1);
353 if (end - start >= model()->rowCount() - 1)
363 int checkCounter = 0;
364 int tempSelectedSearchIndex = indexAt(QPoint(10, 10)).row();
366 if (selectedIndexes().size() > 0)
368 tempSelectedSearchIndex = selectedIndexes()[0].row();
371 int oldSelectedSearchIndex = tempSelectedSearchIndex;
376 if ((tempSelectedSearchIndex != oldSelectedSearchIndex || keepSelectionIfPossible) &&
377 getModel()->rowContainsString(tempSelectedSearchIndex,
380 selectRow(tempSelectedSearchIndex);
386 tempSelectedSearchIndex--;
390 tempSelectedSearchIndex++;
393 if (tempSelectedSearchIndex >= model()->rowCount())
395 tempSelectedSearchIndex = 0;
398 if (tempSelectedSearchIndex < 0)
400 tempSelectedSearchIndex = model()->rowCount() - 1;
406 if (checkCounter > model()->rowCount())
410 }
while (tempSelectedSearchIndex != oldSelectedSearchIndex);
423 QString fileWithLineNumber = model()->data(
index).toString();
424 std::string file = fileWithLineNumber.toStdString();
425 file.erase(file.rfind(
':'));
426 std::string line = fileWithLineNumber.toStdString();
427 line = line.erase(0, line.rfind(
':') + 1);
429 if (!std::filesystem::exists(file))
431 ARMARX_INFO <<
"File '" << file <<
"' does not exists - cannot open it.";