4 #include "moc_ErrorListDialog.cpp"
13 : QDialog(parent, Qt::Widget | Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint),
17 setAttribute(Qt::WA_TranslucentBackground);
21 ui.TWErrorList->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeMode::Fixed);
22 ui.TWErrorList->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeMode::ResizeToContents);
39 ui.TWErrorList->clear();
40 ui.TWErrorList->setRowCount(0);
42 for (
auto& ErrorEntry : ErrorEntries)
47 const auto Row =
ui.TWErrorList->rowCount();
48 ui.TWErrorList->insertRow(Row);
50 ui.TWErrorList->setItem(Row, 0,
new QTableWidgetItem(Icon, ErrorEntry.Text));
51 ui.TWErrorList->item(Row, 0)->setToolTip(
"Double-click to go to item.");
52 ui.TWErrorList->item(Row, 0)->setData(Qt::ItemDataRole::UserRole, QVariant::fromValue(ErrorEntry.TreeWidgetItem));
53 ui.TWErrorList->setItem(Row, 1,
new QTableWidgetItem(ErrorEntry.Origin));
54 ui.TWErrorList->item(Row, 1)->setToolTip(
ui.TWErrorList->item(Row, 0)->toolTip());
55 ui.TWErrorList->item(Row, 1)->setData(Qt::ItemDataRole::UserRole, QVariant::fromValue(ErrorEntry.TreeWidgetItem));
58 if (ErrorEntries.empty())
60 ui.TWErrorList->insertRow(0);
62 ui.TWErrorList->item(0, 0)->setToolTip(
ui.TWErrorList->item(0, 0)->text());
79 QVector<QPointF> BalloonVertices;
80 const float Offset = 0;
81 BalloonVertices << QPointF(Offset, Offset)
82 << QPointF(width() - Offset, Offset)
83 << QPointF(width() - Offset, height() * 0.97)
84 << QPointF(width() * 0.04, height() * 0.97)
85 << QPointF(width() * 0.03, height() - Offset)
86 << QPointF(width() * 0.02, height() * 0.97)
87 << QPointF(Offset, height() * 0.97);
88 auto BalloonPolygon = QPolygonF(BalloonVertices);
90 QPainter painter(
this);
91 painter.setRenderHint(QPainter::Antialiasing,
true);
92 painter.setBrush(QBrush(
ui.TWErrorList->palette().color(QWidget::backgroundRole())));
93 painter.setPen(QPen(
ui.TWErrorList->palette().color(QWidget::foregroundRole())));
95 QRegion Mask(BalloonPolygon.toPolygon(), Qt::WindingFill);
96 painter.drawPolygon(BalloonPolygon);
99 ui.TWErrorList->horizontalHeader()->resizeSection(0, width() / 4 * 3);
104 if (!
ui.TWErrorList->hasFocus())
Implements a frame-less pop-up dialog to show errors and warning of DynExp::Object instances.
void ErrorEntryDoubleClicked(QTableWidgetItem *item)
QWidget * WidgetToOpenThisDialog
virtual void focusOutEvent(QFocusEvent *event) override
ErrorEntriesType CurrentErrorEntries
QTreeWidgetItem * GetSelectedEntry()
virtual void paintEvent(QPaintEvent *event) override
QTreeWidgetItem * SelectedTreeWidgetItem
bool ClosedByClickingOpenWidget
void SetErrorEntries(const ErrorEntriesType &ErrorEntries)
ErrorListDialog(QWidget *parent, QWidget *WidgetToOpenThisDialog)
std::vector< ErrorEntryType > ErrorEntriesType
bool HasBeenClosedByClickingOpenWidget() const noexcept
std::chrono::time_point< std::chrono::system_clock > LastCloseTime
Accumulates include statements to provide a precompiled header.
QTreeWidgetItem * TreeWidgetItem
Pointer to QTreeWidgetItem listed in main window's tree view. Do not dereference this pointer!...
Util::ErrorType ErrorType
bool operator==(const ErrorEntryType &Other) const