diff options
Diffstat (limited to 'src/designer/src/components/signalsloteditor')
14 files changed, 98 insertions, 416 deletions
diff --git a/src/designer/src/components/signalsloteditor/connectdialog.cpp b/src/designer/src/components/signalsloteditor/connectdialog.cpp index bb59e0c1c..6f122b16c 100644 --- a/src/designer/src/components/signalsloteditor/connectdialog.cpp +++ b/src/designer/src/components/signalsloteditor/connectdialog.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "connectdialog_p.h" #include "signalslot_utils_p.h" @@ -42,9 +17,11 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + static QString realClassName(QDesignerFormEditorInterface *core, QWidget *widget) { - QString class_name = QLatin1String(widget->metaObject()->className()); + QString class_name = QLatin1StringView(widget->metaObject()->className()); const QDesignerWidgetDataBaseInterface *wdb = core->widgetDataBase(); const int idx = wdb->indexOfObject(widget); if (idx != -1) @@ -54,7 +31,7 @@ static QString realClassName(QDesignerFormEditorInterface *core, QWidget *widget static QString widgetLabel(QDesignerFormEditorInterface *core, QWidget *widget) { - return QString::fromUtf8("%1 (%2)") + return "%1 (%2)"_L1 .arg(qdesigner_internal::realObjectName(core, widget), realClassName(core, widget)); } @@ -73,8 +50,6 @@ ConnectDialog::ConnectDialog(QDesignerFormWindowInterface *formWindow, { m_ui.setupUi(this); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - connect(m_ui.signalList, &QListWidget::itemClicked, this, &ConnectDialog::selectSignal); connect(m_ui.slotList, &QListWidget::itemClicked, @@ -220,9 +195,7 @@ void ConnectDialog::populateSlotList(const QString &signal) QVariant variantFont = QVariant::fromValue(font); QListWidgetItem *curr = nullptr; - QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin(); - const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd(); - while (itMember != itMemberEnd) { + for (auto itMember = memberToClassName.cbegin(), itMemberEnd = memberToClassName.cend(); itMember != itMemberEnd; ++itMember) { const QString member = itMember.key(); QListWidgetItem *item = new QListWidgetItem(m_ui.slotList); item->setText(member); @@ -235,7 +208,6 @@ void ConnectDialog::populateSlotList(const QString &signal) item->setData(Qt::FontRole, variantFont); item->setData(Qt::ForegroundRole, QColor(Qt::red)); } - ++itMember; } if (curr) @@ -262,9 +234,7 @@ void ConnectDialog::populateSignalList() QVariant variantFont = QVariant::fromValue(font); QListWidgetItem *curr = nullptr; - QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin(); - const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd(); - while (itMember != itMemberEnd) { + for (auto itMember = memberToClassName.cbegin(), itMemberEnd = memberToClassName.cend(); itMember != itMemberEnd; ++itMember) { const QString member = itMember.key(); QListWidgetItem *item = new QListWidgetItem(m_ui.signalList); @@ -278,7 +248,6 @@ void ConnectDialog::populateSignalList() item->setData(Qt::FontRole, variantFont); item->setData(Qt::ForegroundRole, QColor(Qt::red)); } - ++itMember; } if (curr) { diff --git a/src/designer/src/components/signalsloteditor/connectdialog_p.h b/src/designer/src/components/signalsloteditor/connectdialog_p.h index 0cd600557..fe9fae32d 100644 --- a/src/designer/src/components/signalsloteditor/connectdialog_p.h +++ b/src/designer/src/components/signalsloteditor/connectdialog_p.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef CONNECTDIALOG_H #define CONNECTDIALOG_H @@ -86,7 +61,7 @@ private: const WidgetMode m_sourceMode; const WidgetMode m_destinationMode; QDesignerFormWindowInterface *m_formWindow; - Ui::ConnectDialog m_ui; + QT_PREPEND_NAMESPACE(Ui)::ConnectDialog m_ui; }; } diff --git a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp index c7a960ef3..f8db32ee3 100644 --- a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp +++ b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "signalslot_utils_p.h" @@ -42,7 +17,7 @@ QT_BEGIN_NAMESPACE -using ClassNameSignaturePair = QPair<QString, QString>; +using ClassNameSignaturePair = std::pair<QString, QString>; // Find all member functions that match a predicate on the signature string // using the member sheet and the fake methods stored in the widget diff --git a/src/designer/src/components/signalsloteditor/signalslot_utils_p.h b/src/designer/src/components/signalsloteditor/signalslot_utils_p.h index 7ab98c3d4..e7441f855 100644 --- a/src/designer/src/components/signalsloteditor/signalslot_utils_p.h +++ b/src/designer/src/components/signalsloteditor/signalslot_utils_p.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef SIGNALSLOTUTILS_P_H #define SIGNALSLOTUTILS_P_H diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor.cpp index 28bb2c736..76239f07e 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditor.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "signalsloteditor.h" #include "signalsloteditor_p.h" @@ -33,6 +8,7 @@ #include <metadatabase_p.h> #include <qdesigner_formwindowcommand_p.h> +#include <signalslotdialog_p.h> #include <QtDesigner/private/ui4_p.h> #include <QtDesigner/abstractformwindow.h> @@ -49,6 +25,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace qdesigner_internal { /******************************************************************************* @@ -76,13 +54,13 @@ DomConnection *SignalSlotConnection::toUi() const QPoint tp = endPointPos(EndPoint::Target); DomConnectionHint *hint = new DomConnectionHint; - hint->setAttributeType(QStringLiteral("sourcelabel")); + hint->setAttributeType(u"sourcelabel"_s); hint->setElementX(sp.x()); hint->setElementY(sp.y()); list.append(hint); hint = new DomConnectionHint; - hint->setAttributeType(QStringLiteral("destinationlabel")); + hint->setAttributeType(u"destinationlabel"_s); hint->setElementX(tp.x()); hint->setElementY(tp.y()); list.append(hint); @@ -373,6 +351,21 @@ void SignalSlotEditor::fromUi(const DomConnections *connections, QWidget *parent if (connections == nullptr) return; + // For old forms, that were saved before Qt 4 times, there was no <slots> + // section inside ui file. Currently, when we specify custom signals or slots + // for the form, we add them into the <slots> section. For all signals / slots + // inside <slots> section uic creates string-based connections. + // In order to fix old forms, we detect if a signal or slot used inside connection + // is a custom (fake) one, like it's being done inside SignalSlotDialog. + // In case of a fake signal / slot we register it inside meta data base, so that + // the next save will add a missing <slots> section. + QStringList existingSlots, existingSignals; + SignalSlotDialog::existingMethodsFromMemberSheet(m_form_window->core(), parent, + existingSlots, existingSignals); + QStringList fakeSlots, fakeSignals; + SignalSlotDialog::fakeMethodsFromMetaDataBase(m_form_window->core(), parent, + fakeSlots, fakeSignals); + setBackground(parent); clear(); const auto &list = connections->elementConnection(); @@ -397,33 +390,48 @@ void SignalSlotEditor::fromUi(const DomConnections *connections, QWidget *parent for (DomConnectionHint *hint : hints) { QString attr_type = hint->attributeType(); QPoint p = QPoint(hint->elementX(), hint->elementY()); - if (attr_type == QStringLiteral("sourcelabel")) + if (attr_type == "sourcelabel"_L1) sp = p; - else if (attr_type == QStringLiteral("destinationlabel")) + else if (attr_type == "destinationlabel"_L1) tp = p; } } + const QString sourceSignal = dom_con->elementSignal(); + if (source == parent && !existingSignals.contains(sourceSignal) + && !fakeSignals.contains(sourceSignal)) { + fakeSignals.append(sourceSignal); + } + + const QString destSlot = dom_con->elementSlot(); + if (destination == parent && !existingSlots.contains(destSlot) + && !fakeSlots.contains(destSlot)) { + fakeSlots.append(destSlot); + } + + SignalSlotConnection *con = new SignalSlotConnection(this); con->setEndPoint(EndPoint::Source, source, sp); con->setEndPoint(EndPoint::Target, destination, tp); - con->setSignal(dom_con->elementSignal()); - con->setSlot(dom_con->elementSlot()); + con->setSignal(sourceSignal); + con->setSlot(destSlot); addConnection(con); } + SignalSlotDialog::fakeMethodsToMetaDataBase(m_form_window->core(), parent, + fakeSlots, fakeSignals); } static bool skipWidget(const QWidget *w) { - const QString name = QLatin1String(w->metaObject()->className()); - if (name == QStringLiteral("QDesignerWidget")) + const QString name = QLatin1StringView(w->metaObject()->className()); + if (name == "QDesignerWidget"_L1) return true; - if (name == QStringLiteral("QLayoutWidget")) + if (name == "QLayoutWidget"_L1) return true; - if (name == QStringLiteral("qdesigner_internal::FormWindow")) + if (name == "qdesigner_internal::FormWindow"_L1) return true; - if (name == QStringLiteral("Spacer")) + if (name == "Spacer"_L1) return true; return false; } diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor.h b/src/designer/src/components/signalsloteditor/signalsloteditor.h index c235c1d94..6ce498908 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditor.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef SIGNALSLOTEDITOR_H #define SIGNALSLOTEDITOR_H diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_global.h b/src/designer/src/components/signalsloteditor/signalsloteditor_global.h index 4b087ac60..fbe025316 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_global.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_global.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef SIGNALSLOTEDITOR_GLOBAL_H #define SIGNALSLOTEDITOR_GLOBAL_H diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_p.h b/src/designer/src/components/signalsloteditor/signalsloteditor_p.h index 1a44c101a..70157a3b4 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_p.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_p.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef SIGNALSLOTEDITOR_P_H #define SIGNALSLOTEDITOR_P_H diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp index 60cfdfa6a..8b0b1f75a 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "signalsloteditor_plugin.h" #include "signalsloteditor_tool.h" @@ -36,7 +11,9 @@ QT_BEGIN_NAMESPACE -using namespace qdesigner_internal; +using namespace Qt::StringLiterals; + +namespace qdesigner_internal { SignalSlotEditorPlugin::SignalSlotEditorPlugin() = default; @@ -52,10 +29,10 @@ void SignalSlotEditorPlugin::initialize(QDesignerFormEditorInterface *core) Q_ASSERT(!isInitialized()); m_action = new QAction(tr("Edit Signals/Slots"), this); - m_action->setObjectName(QStringLiteral("__qt_edit_signals_slots_action")); + m_action->setObjectName(u"__qt_edit_signals_slots_action"_s); m_action->setShortcut(tr("F4")); - QIcon icon = QIcon::fromTheme(QStringLiteral("designer-edit-signals"), - QIcon(core->resourceLocation() + QStringLiteral("/signalslottool.png"))); + QIcon icon = QIcon::fromTheme(u"designer-edit-signals"_s, + QIcon(core->resourceLocation() + "/signalslottool.png"_L1)); m_action->setIcon(icon); m_action->setEnabled(false); @@ -112,6 +89,8 @@ void SignalSlotEditorPlugin::activeFormWindowChanged(QDesignerFormWindowInterfac m_action->setEnabled(formWindow != nullptr); } +} // namespace qdesigner_internal + QT_END_NAMESPACE #include "moc_signalsloteditor_plugin.cpp" diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h index fc4cabdcd..dc70c676d 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef SIGNALSLOTEDITOR_PLUGIN_H #define SIGNALSLOTEDITOR_PLUGIN_H diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp index ec828b017..9b5e72fbd 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "signalsloteditor_tool.h" #include "signalsloteditor.h" @@ -38,7 +13,7 @@ QT_BEGIN_NAMESPACE -using namespace qdesigner_internal; +namespace qdesigner_internal { SignalSlotEditorTool::SignalSlotEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent) : QDesignerFormWindowToolInterface(parent), @@ -107,4 +82,6 @@ void SignalSlotEditorTool::loadFromDom(DomUI *ui, QWidget *mainContainer) m_editor->fromUi(ui->elementConnections(), mainContainer); } +} // namespace qdesigner_internal + QT_END_NAMESPACE diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h index acd71f479..762738930 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef SIGNALSLOTEDITOR_TOOL_H #define SIGNALSLOTEDITOR_TOOL_H diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index 1ed2e9da2..1efc66064 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "signalsloteditorwindow.h" #include "signalsloteditor_p.h" @@ -67,6 +42,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + // Add suitable form widgets to a list of objects for the signal slot // editor. Prevent special widgets from showing up there. static void addWidgetToObjectList(const QWidget *w, QStringList &r) @@ -427,7 +404,7 @@ void InlineEditorModel::addTitle(const QString &title) const int cnt = rowCount(); insertRows(cnt, 1); QModelIndex cat_idx = index(cnt, 0); - setData(cat_idx, QString(title + QLatin1Char(':')), Qt::DisplayRole); + setData(cat_idx, QString(title + u':'), Qt::DisplayRole); setData(cat_idx, TitleItem, Qt::UserRole); QFont font = QApplication::font(); font.setBold(true); @@ -456,16 +433,13 @@ void InlineEditorModel::addTextList(const QMap<QString, bool> &text_list) QFont font = QApplication::font(); font.setItalic(true); QVariant fontVariant = QVariant::fromValue(font); - QMap<QString, bool>::ConstIterator it = text_list.constBegin(); - const QMap<QString, bool>::ConstIterator itEnd = text_list.constEnd(); - while (it != itEnd) { + for (auto it = text_list.cbegin(), itEnd = text_list.cend(); it != itEnd; ++it) { const QModelIndex text_idx = index(cnt++, 0); setData(text_idx, it.key(), Qt::DisplayRole); if (it.value()) { setData(text_idx, fontVariant, Qt::FontRole); setData(text_idx, QColor(Qt::red), Qt::ForegroundRole); } - ++it; } } @@ -645,7 +619,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, continue; // Mark deprecated members by passing bool=true. QMap<QString, bool> markedMemberList; - for (const QString &member : qAsConst(classInfo.m_memberList)) + for (const QString &member : std::as_const(classInfo.m_memberList)) markedMemberList.insert(member, false); inline_editor->addTitle(classInfo.m_className); inline_editor->addTextList(markedMemberList); @@ -707,11 +681,11 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor QToolBar *toolBar = new QToolBar; toolBar->setIconSize(QSize(22, 22)); - m_add_button->setIcon(createIconSet(QStringLiteral("plus.png"))); + m_add_button->setIcon(createIconSet("plus.png"_L1)); connect(m_add_button, &QAbstractButton::clicked, this, &SignalSlotEditorWindow::addConnection); toolBar->addWidget(m_add_button); - m_remove_button->setIcon(createIconSet(QStringLiteral("minus.png"))); + m_remove_button->setIcon(createIconSet("minus.png"_L1)); connect(m_remove_button, &QAbstractButton::clicked, this, &SignalSlotEditorWindow::removeConnection); toolBar->addWidget(m_remove_button); diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h index 4d7af91f8..07891d0cd 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Designer of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef SIGNALSLOTEDITORWINDOW_H #define SIGNALSLOTEDITORWINDOW_H |