diff options
Diffstat (limited to 'src/shared/findwidget/abstractfindwidget.cpp')
-rw-r--r-- | src/shared/findwidget/abstractfindwidget.cpp | 72 |
1 files changed, 20 insertions, 52 deletions
diff --git a/src/shared/findwidget/abstractfindwidget.cpp b/src/shared/findwidget/abstractfindwidget.cpp index f627f6b25..1944beaf1 100644 --- a/src/shared/findwidget/abstractfindwidget.cpp +++ b/src/shared/findwidget/abstractfindwidget.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only /*! \class AbstractFindWidget @@ -71,7 +35,9 @@ QT_BEGIN_NAMESPACE -static QIcon createIconSet(const QString &name) +using namespace Qt::StringLiterals; + +static QIcon afwCreateIconSet(const QString &name) { QStringList candidates = QStringList() << (QString::fromUtf8(":/qt-project.org/shared/images/") + name) @@ -81,7 +47,7 @@ static QIcon createIconSet(const QString &name) << (QString::fromUtf8(":/qt-project.org/shared/images/win/") + name); #endif - for (const QString &f : qAsConst(candidates)) { + for (const QString &f : std::as_const(candidates)) { if (QFile::exists(f)) return QIcon(f); } @@ -113,32 +79,32 @@ AbstractFindWidget::AbstractFindWidget(FindFlags flags, QWidget *parent) #endif m_toolClose = new QToolButton(this); - m_toolClose->setIcon(createIconSet(QLatin1String("closetab.png"))); + m_toolClose->setIcon(afwCreateIconSet("closetab.png"_L1)); m_toolClose->setAutoRaise(true); layOut->addWidget(m_toolClose); - connect(m_toolClose, SIGNAL(clicked()), SLOT(deactivate())); + connect(m_toolClose, &QAbstractButton::clicked, this, &AbstractFindWidget::deactivate); m_editFind = new QLineEdit(this); layOut->addWidget(m_editFind); - connect(m_editFind, SIGNAL(returnPressed()), SLOT(findNext())); - connect(m_editFind, SIGNAL(textChanged(QString)), SLOT(findCurrentText())); - connect(m_editFind, SIGNAL(textChanged(QString)), SLOT(updateButtons())); + connect(m_editFind, &QLineEdit::returnPressed, this, &AbstractFindWidget::findNext); + connect(m_editFind, &QLineEdit::textChanged, this, &AbstractFindWidget::findCurrentText); + connect(m_editFind, &QLineEdit::textChanged, this, &AbstractFindWidget::updateButtons); m_toolPrevious = new QToolButton(this); m_toolPrevious->setAutoRaise(true); m_toolPrevious->setText(tr("&Previous")); m_toolPrevious->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - m_toolPrevious->setIcon(createIconSet(QLatin1String("previous.png"))); + m_toolPrevious->setIcon(afwCreateIconSet("previous.png"_L1)); layOut->addWidget(m_toolPrevious); - connect(m_toolPrevious, SIGNAL(clicked()), SLOT(findPrevious())); + connect(m_toolPrevious, &QAbstractButton::clicked, this, &AbstractFindWidget::findPrevious); m_toolNext = new QToolButton(this); m_toolNext->setAutoRaise(true); m_toolNext->setText(tr("&Next")); m_toolNext->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - m_toolNext->setIcon(createIconSet(QLatin1String("next.png"))); + m_toolNext->setIcon(afwCreateIconSet("next.png"_L1)); layOut->addWidget(m_toolNext); - connect(m_toolNext, SIGNAL(clicked()), SLOT(findNext())); + connect(m_toolNext, &QAbstractButton::clicked, this, &AbstractFindWidget::findNext); if (flags & NarrowLayout) { QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Fixed); @@ -160,7 +126,8 @@ AbstractFindWidget::AbstractFindWidget(FindFlags flags, QWidget *parent) if (!(flags & NoCaseSensitive)) { m_checkCase = new QCheckBox(tr("&Case sensitive"), this); layOut->addWidget(m_checkCase); - connect(m_checkCase, SIGNAL(toggled(bool)), SLOT(findCurrentText())); + connect(m_checkCase, &QAbstractButton::toggled, + this, &AbstractFindWidget::findCurrentText); } else { m_checkCase = 0; } @@ -168,7 +135,8 @@ AbstractFindWidget::AbstractFindWidget(FindFlags flags, QWidget *parent) if (!(flags & NoWholeWords)) { m_checkWholeWords = new QCheckBox(tr("Whole &words"), this); layOut->addWidget(m_checkWholeWords); - connect(m_checkWholeWords, SIGNAL(toggled(bool)), SLOT(findCurrentText())); + connect(m_checkWholeWords, &QAbstractButton::toggled, + this, &AbstractFindWidget::findCurrentText); } else { m_checkWholeWords = 0; } @@ -203,7 +171,7 @@ AbstractFindWidget::~AbstractFindWidget() = default; */ QIcon AbstractFindWidget::findIconSet() { - return createIconSet(QLatin1String("searchfind.png")); + return afwCreateIconSet("searchfind.png"_L1); } /*! |