MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / ErrorWidget

Method ErrorWidget

widgets/ErrorWidget.cpp:13–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace QodeAssist {
12
13ErrorWidget::ErrorWidget(const QString &errorMessage, QWidget *parent, int autoHideMs)
14 : QWidget(parent)
15 , m_errorMessage(errorMessage)
16 , m_autoHideTimer(nullptr)
17 , m_isHovered(false)
18{
19 setupColors();
20 setupIcon();
21
22 QFont errorFont = font();
23 errorFont.setPointSize(qMax(8, errorFont.pointSize() - 2));
24 setFont(errorFont);
25
26 setFixedSize(calculateSize());
27 setAttribute(Qt::WA_TranslucentBackground);
28 setMouseTracking(true);
29
30 if (autoHideMs > 0) {
31 m_autoHideTimer = new QTimer(this);
32 m_autoHideTimer->setSingleShot(true);
33 connect(m_autoHideTimer, &QTimer::timeout, this, [this]() {
34 if (!m_isHovered) {
35 emit dismissed();
36 deleteLater();
37 }
38 });
39 m_autoHideTimer->start(autoHideMs);
40 }
41}
42
43ErrorWidget::~ErrorWidget()
44{

Callers

nothing calls this directly

Calls 1

startMethod · 0.80

Tested by

no test coverage detected