Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qfilternamedialog.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
7#include <QtWidgets/qpushbutton.h>
8
10
11QFilterNameDialog::QFilterNameDialog(QWidget *parent)
13{
14 m_ui.setupUi(this);
15 connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked,
16 this, &QDialog::accept);
17 connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), &QAbstractButton::clicked,
18 this, &QDialog::reject);
19 connect(m_ui.lineEdit, &QLineEdit::textChanged, this, &QFilterNameDialog::updateOkButton);
20 m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true);
21}
22
23void QFilterNameDialog::setFilterName(const QString &filter)
24{
25 m_ui.lineEdit->setText(filter);
26 m_ui.lineEdit->selectAll();
27}
28
29void QFilterNameDialog::updateOkButton()
30{
31 m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDisabled(m_ui.lineEdit->text().isEmpty());
32}
33
34QT_END_NAMESPACE
QObject * parent
Definition qobject.h:74
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
Combined button and popup list for selecting options.