MCPcopy Create free account
hub / github.com/aldelaro5/dolphin-memory-engine / paintEvent

Method paintEvent

Source/GUI/Widgets/AddressInputWidget.cpp:73–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void AddressInputWidget::paintEvent(QPaintEvent* const event)
74{
75 QLineEdit::paintEvent(event);
76
77 const QColor placeholderTextColor{palette().color(QPalette::PlaceholderText)};
78 const QColor textColor{palette().color(QPalette::Text)};
79 const QColor prefixColor{
80 (placeholderTextColor.red() + textColor.red()) / 2,
81 (placeholderTextColor.green() + textColor.green()) / 2,
82 (placeholderTextColor.blue() + textColor.blue()) / 2,
83 };
84
85 QStyleOptionFrame panel{};
86 initStyleOption(&panel);
87 const QRect contentsRect{style()->subElementRect(QStyle::SE_LineEditContents, &panel, this)};
88 const int x{contentsRect.x() + horizontalMargin - AddressInputWidget::calcPrefixWidth()};
89 const int y{(rect().height() + fontMetrics().tightBoundingRect("0x").height()) / 2};
90
91 QPainter painter(this);
92 painter.setPen(prefixColor);
93 painter.setFont(font());
94 painter.drawText(x, y, "0x");
95}
96
97int AddressInputWidget::calcPrefixWidth()
98{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected