summaryrefslogtreecommitdiffstats
path: root/src/designer/src/lib/uilib/formbuilderextra_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/designer/src/lib/uilib/formbuilderextra_p.h')
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra_p.h111
1 files changed, 24 insertions, 87 deletions
diff --git a/src/designer/src/lib/uilib/formbuilderextra_p.h b/src/designer/src/lib/uilib/formbuilderextra_p.h
index 94b0c2231..f55945e81 100644
--- a/src/designer/src/lib/uilib/formbuilderextra_p.h
+++ b/src/designer/src/lib/uilib/formbuilderextra_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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: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) 2020 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
#ifndef ABSTRACTFORMBUILDERPRIVATE_H
#define ABSTRACTFORMBUILDERPRIVATE_H
@@ -95,6 +59,8 @@ class QTextBuilder;
class QDESIGNER_UILIB_EXPORT QFormBuilderExtra
{
public:
+ Q_DISABLE_COPY_MOVE(QFormBuilderExtra);
+
QFormBuilderExtra();
~QFormBuilderExtra();
@@ -141,11 +107,14 @@ public:
// --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group
void registerButtonGroups(const DomButtonGroups *groups);
- using ButtonGroupEntry = QPair<DomButtonGroup *, QButtonGroup*>;
+ using ButtonGroupEntry = std::pair<DomButtonGroup *, QButtonGroup *>;
using ButtonGroupHash = QHash<QString, ButtonGroupEntry>;
const ButtonGroupHash &buttonGroups() const { return m_buttonGroups; }
ButtonGroupHash &buttonGroups() { return m_buttonGroups; }
+ static void getLayoutMargins(const QList<DomProperty*> &properties,
+ int *left, int *top, int *right, int *bottom);
+
// return stretch as a comma-separated list
static QString boxLayoutStretch(const QBoxLayout*);
// apply stretch
@@ -169,7 +138,7 @@ public:
static bool setGridLayoutColumnMinimumWidth(const QString &, QGridLayout *);
static void clearGridLayoutColumnMinimumWidth(QGridLayout *);
- static void setPixmapProperty(DomProperty *p, const QPair<QString, QString> &ip);
+ static void setPixmapProperty(DomProperty *p, const std::pair<QString, QString> &ip);
static QPalette loadPalette(const DomPalette *dom);
static void setupColorGroup(QPalette *palette, QPalette::ColorGroup colorGroup,
const DomColorGroup *group);
@@ -179,6 +148,9 @@ public:
static QBrush setupBrush(const DomBrush *brush);
static DomBrush *saveBrush(const QBrush &br);
+ static DomProperty *propertyByName(const QList<DomProperty*> &properties,
+ QAnyStringView needle);
+
QStringList m_pluginPaths;
QMap<QString, QDesignerCustomWidgetInterface*> m_customWidgets;
@@ -195,8 +167,7 @@ private:
void clearResourceBuilder();
void clearTextBuilder();
- using BuddyHash = QHash<QLabel*, QString>;
- BuddyHash m_buddies;
+ QHash<QLabel *, QString> m_buddies;
QHash<QString, CustomWidgetData> m_customWidgetDataHash;
@@ -218,58 +189,24 @@ struct QDESIGNER_UILIB_EXPORT QFormBuilderStrings {
static const QFormBuilderStrings &instance();
- const QString buddyProperty;
- const QString cursorProperty;
- const QString objectNameProperty;
- const QString trueValue;
- const QString falseValue;
- const QString horizontalPostFix;
- const QString separator;
- const QString defaultTitle;
- const QString titleAttribute;
- const QString labelAttribute;
- const QString toolTipAttribute;
- const QString whatsThisAttribute;
- const QString flagsAttribute;
- const QString iconAttribute;
- const QString pixmapAttribute;
- const QString textAttribute;
- const QString currentIndexProperty;
- const QString toolBarAreaAttribute;
- const QString toolBarBreakAttribute;
- const QString dockWidgetAreaAttribute;
- const QString marginProperty;
- const QString spacingProperty;
- const QString leftMarginProperty;
- const QString topMarginProperty;
- const QString rightMarginProperty;
- const QString bottomMarginProperty;
- const QString horizontalSpacingProperty;
- const QString verticalSpacingProperty;
- const QString sizeHintProperty;
- const QString sizeTypeProperty;
- const QString orientationProperty;
- const QString styleSheetProperty;
- const QString qtHorizontal;
- const QString qtVertical;
- const QString currentRowProperty;
- const QString tabSpacingProperty;
- const QString qWidgetClass;
- const QString lineClass;
- const QString geometryProperty;
- const QString scriptWidgetVariable;
- const QString scriptChildWidgetsVariable;
-
- using RoleNName = QPair<Qt::ItemDataRole, QString>;
+ static constexpr auto titleAttribute = QLatin1StringView("title");
+ static constexpr auto labelAttribute = QLatin1StringView("label");
+ static constexpr auto toolTipAttribute = QLatin1StringView("toolTip");
+ static constexpr auto whatsThisAttribute = QLatin1StringView("whatsThis");
+ static constexpr auto flagsAttribute = QLatin1StringView("flags");
+ static constexpr auto iconAttribute = QLatin1StringView("icon");
+ static constexpr auto textAttribute = QLatin1StringView("text") ;
+
+ using RoleNName = std::pair<Qt::ItemDataRole, QString>;
QList<RoleNName> itemRoles;
QHash<QString, Qt::ItemDataRole> treeItemRoleHash;
// first.first is primary role, first.second is shadow role.
// Shadow is used for either the translation source or the designer
// representation of the string value.
- using TextRoleNName = QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>;
+ using TextRoleNName = std::pair<std::pair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>;
QList<TextRoleNName> itemTextRoles;
- QHash<QString, QPair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash;
+ QHash<QString, std::pair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash;
};
#ifdef QFORMINTERNAL_NAMESPACE
}