167QHelpSearchQueryWidget::QHelpSearchQueryWidget(QWidget *parent)
169 , d(
new QHelpSearchQueryWidgetPrivate)
171 QVBoxLayout *vLayout =
new QVBoxLayout(
this);
172 vLayout->setContentsMargins({});
174 QHBoxLayout* hBoxLayout =
new QHBoxLayout;
175 d->m_searchLabel =
new QLabel(
this);
176 d->m_lineEdit =
new QLineEdit(
this);
177 d->m_lineEdit->setClearButtonEnabled(
true);
178 d->m_lineEdit->setCompleter(&d->m_searchCompleter);
179 d->m_lineEdit->installEventFilter(d);
180 d->m_prevQueryButton =
new QToolButton(
this);
181 d->m_prevQueryButton->setArrowType(Qt::LeftArrow);
182 d->m_prevQueryButton->setEnabled(
false);
183 d->m_nextQueryButton =
new QToolButton(
this);
184 d->m_nextQueryButton->setArrowType(Qt::RightArrow);
185 d->m_nextQueryButton->setEnabled(
false);
186 d->m_searchButton =
new QPushButton(
this);
187 hBoxLayout->addWidget(d->m_searchLabel);
188 hBoxLayout->addWidget(d->m_lineEdit);
189 hBoxLayout->addWidget(d->m_prevQueryButton);
190 hBoxLayout->addWidget(d->m_nextQueryButton);
191 hBoxLayout->addWidget(d->m_searchButton);
193 vLayout->addLayout(hBoxLayout);
195 connect(d->m_prevQueryButton, &QAbstractButton::clicked,
this, [
this] { d->prevQuery(); });
196 connect(d->m_nextQueryButton, &QAbstractButton::clicked,
this, [
this] { d->nextQuery(); });
197 connect(d->m_searchButton, &QAbstractButton::clicked,
this, &QHelpSearchQueryWidget::search);
198 connect(d->m_lineEdit, &QLineEdit::returnPressed,
this, &QHelpSearchQueryWidget::search);
201 connect(
this, &QHelpSearchQueryWidget::search,
this, [
this] { d->searchRequested(); });
202 setCompactMode(
true);
292void QHelpSearchQueryWidget::setCompactMode(
bool on)
294 if (d->m_compactMode != on) {
295 d->m_compactMode = on;
296 d->m_prevQueryButton->setVisible(!on);
297 d->m_nextQueryButton->setVisible(!on);
298 d->m_searchLabel->setVisible(!on);