diff options
Diffstat (limited to 'src/designer/src/lib/shared/qdesigner_tabwidget.cpp')
-rw-r--r-- | src/designer/src/lib/shared/qdesigner_tabwidget.cpp | 75 |
1 files changed, 25 insertions, 50 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp index 9325e386d..36d0c3798 100644 --- a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp +++ b/src/designer/src/lib/shared/qdesigner_tabwidget.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 "qdesigner_tabwidget_p.h" #include "qdesigner_command_p.h" @@ -49,6 +24,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace qdesigner_internal { // Store tab widget as drag source class MyMimeData : public QMimeData @@ -179,7 +156,7 @@ bool QTabWidgetEventFilter::eventFilter(QObject *o, QEvent *e) if (tabbar->tabRect(i).contains(m_pressPoint)) { if (i != tabbar->currentIndex()) { qdesigner_internal::SetPropertyCommand *cmd = new qdesigner_internal::SetPropertyCommand(fw); - cmd->init(m_tabWidget, QStringLiteral("currentIndex"), i); + cmd->init(m_tabWidget, u"currentIndex"_s, i); fw->commandHistory()->push(cmd); } break; @@ -381,39 +358,37 @@ QMenu *QTabWidgetEventFilter::addContextMenuActions(QMenu *popup) // ----------- QTabWidgetPropertySheet -static const char *currentTabTextKey = "currentTabText"; -static const char *currentTabNameKey = "currentTabName"; -static const char *currentTabIconKey = "currentTabIcon"; -static const char *currentTabToolTipKey = "currentTabToolTip"; -static const char *currentTabWhatsThisKey = "currentTabWhatsThis"; -static const char *tabMovableKey = "movable"; +static constexpr auto currentTabTextKey = "currentTabText"_L1; +static constexpr auto currentTabNameKey = "currentTabName"_L1; +static constexpr auto currentTabIconKey = "currentTabIcon"_L1; +static constexpr auto currentTabToolTipKey = "currentTabToolTip"_L1; +static constexpr auto currentTabWhatsThisKey = "currentTabWhatsThis"_L1; +static constexpr auto tabMovableKey = "movable"_L1; QTabWidgetPropertySheet::QTabWidgetPropertySheet(QTabWidget *object, QObject *parent) : QDesignerPropertySheet(object, parent), m_tabWidget(object) { - createFakeProperty(QLatin1String(currentTabTextKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue())); - createFakeProperty(QLatin1String(currentTabNameKey), QString()); - createFakeProperty(QLatin1String(currentTabIconKey), QVariant::fromValue(qdesigner_internal::PropertySheetIconValue())); + createFakeProperty(currentTabTextKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue())); + createFakeProperty(currentTabNameKey, QString()); + createFakeProperty(currentTabIconKey, QVariant::fromValue(qdesigner_internal::PropertySheetIconValue())); if (formWindowBase()) - formWindowBase()->addReloadableProperty(this, indexOf(QLatin1String(currentTabIconKey))); - createFakeProperty(QLatin1String(currentTabToolTipKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue())); - createFakeProperty(QLatin1String(currentTabWhatsThisKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue())); + formWindowBase()->addReloadableProperty(this, indexOf(currentTabIconKey)); + createFakeProperty(currentTabToolTipKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue())); + createFakeProperty(currentTabWhatsThisKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue())); // Prevent the tab widget's drag and drop handling from interfering with Designer's - createFakeProperty(QLatin1String(tabMovableKey), QVariant(false)); + createFakeProperty(tabMovableKey, QVariant(false)); } QTabWidgetPropertySheet::TabWidgetProperty QTabWidgetPropertySheet::tabWidgetPropertyFromName(const QString &name) { - using TabWidgetPropertyHash = QHash<QString, TabWidgetProperty>; - static TabWidgetPropertyHash tabWidgetPropertyHash; - if (tabWidgetPropertyHash.isEmpty()) { - tabWidgetPropertyHash.insert(QLatin1String(currentTabTextKey), PropertyCurrentTabText); - tabWidgetPropertyHash.insert(QLatin1String(currentTabNameKey), PropertyCurrentTabName); - tabWidgetPropertyHash.insert(QLatin1String(currentTabIconKey), PropertyCurrentTabIcon); - tabWidgetPropertyHash.insert(QLatin1String(currentTabToolTipKey), PropertyCurrentTabToolTip); - tabWidgetPropertyHash.insert(QLatin1String(currentTabWhatsThisKey), PropertyCurrentTabWhatsThis); - } + static const QHash<QString, TabWidgetProperty> tabWidgetPropertyHash = { + {currentTabTextKey, PropertyCurrentTabText}, + {currentTabNameKey, PropertyCurrentTabName}, + {currentTabIconKey, PropertyCurrentTabIcon}, + {currentTabToolTipKey, PropertyCurrentTabToolTip}, + {currentTabWhatsThisKey, PropertyCurrentTabWhatsThis} + }; return tabWidgetPropertyHash.value(name, PropertyTabWidgetNone); } |