MCPcopy Create free account
hub / github.com/YACReader/yacreader / YACReaderSearchLineEdit

Method YACReaderSearchLineEdit

custom_widgets/yacreader_search_line_edit.cpp:7–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <QToolButton>
6
7YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
8 : QLineEdit(parent), paddingLeft(0), paddingRight(0)
9{
10 clearButton = new QToolButton(this);
11 searchLabel = new QLabel(this);
12
13 clearButton->setIconSize(QSize(12, 12));
14
15 clearButton->setCursor(Qt::ArrowCursor);
16 clearButton->hide();
17 connect(clearButton, &QAbstractButton::clicked, this, &QLineEdit::clear);
18 connect(this, &QLineEdit::textChanged, this, &YACReaderSearchLineEdit::updateCloseButton);
19
20 int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
21 paddingLeft = 15 + frameWidth + 6 + 5;
22 paddingRight = 12 + frameWidth + 10;
23
24 QSize msz = minimumSizeHint();
25 setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
26 qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
27
28 setMaximumWidth(255);
29 setFixedHeight(26);
30
31 setPlaceholderText(tr("type to search"));
32
33 connect(this, &QLineEdit::textChanged, this, &YACReaderSearchLineEdit::processText);
34
35 initTheme(this);
36}
37
38void YACReaderSearchLineEdit::applyTheme(const Theme &theme)
39{

Callers

nothing calls this directly

Calls 2

hideMethod · 0.80
sizeHintMethod · 0.45

Tested by

no test coverage detected