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
5
6#include <QtWidgets/qpushbutton.h>
7
9
10QFilterNameDialog::QFilterNameDialog(QWidget *parent)
12{
13 m_ui.setupUi(this);
14 connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked,
15 this, &QDialog::accept);
16 connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), &QAbstractButton::clicked,
17 this, &QDialog::reject);
18 connect(m_ui.lineEdit, &QLineEdit::textChanged, this, &QFilterNameDialog::updateOkButton);
19 m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true);
20}
21
22void QFilterNameDialog::setFilterName(const QString &filter)
23{
24 m_ui.lineEdit->setText(filter);
25 m_ui.lineEdit->selectAll();
26}
27
28void QFilterNameDialog::updateOkButton()
29{
30 m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDisabled(m_ui.lineEdit->text().isEmpty());
31}
32
33QT_END_NAMESPACE
QObject * parent
Definition qobject.h:73
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
Combined button and popup list for selecting options.