diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2022-06-21 16:33:56 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-06-25 14:15:58 +0000 |
commit | 6fde995f32e30c05640fc60d6bf754a4f78dbc2b (patch) | |
tree | 1f26560c9971846217b42c64c19132c3fb51c878 | |
parent | a27b24f71c91f3f4050272b5668d7a2effacd4b4 (diff) |
Update .clang-format and fix messed up style
- Make sure clang-format doesn't reformat SPDX-License-Identifier
(see https://code.qt.io/cgit/qt/qt5.git/commit/?id=6a4dab1134b10b432f69819018fef2044520e0ca )
- Fix C++ version to C++17
(see https://code.qt.io/cgit/qt/qt5.git/commit/?id=fe9efd359498dc342257908f6c9c2183e95fc05d )
- Update _clang_format to avoid adding a space in list-initialization
(see https://code.qt.io/cgit/qt/qt5.git/commit/?id=fc7251edfaf782f184030a5787fe3a88feef6083 )
- Disable indentation for preprocessing directives.
- Fix indentation of UIDelegatasManager macros and prevent formatting
them.
Change-Id: Ieb59c993ee715430ebc2830828e488b9f62ec727
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 155dd36a56912fd4ab4b447db38073900e53fc67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | .clang-format | 16 | ||||
-rw-r--r-- | src/webenginequick/ui_delegates_manager.cpp | 5 | ||||
-rw-r--r-- | src/webenginequick/ui_delegates_manager.h | 28 |
3 files changed, 31 insertions, 18 deletions
diff --git a/.clang-format b/.clang-format index 3399f428c..0d61b137a 100644 --- a/.clang-format +++ b/.clang-format @@ -11,7 +11,7 @@ # Webkit style was loosely based on the Qt style BasedOnStyle: WebKit -Standard: Cpp11 +Standard: c++17 # Column width is limited to 100 in accordance with Qt Coding Style. # https://wiki.qt.io/Qt_Coding_Style @@ -20,9 +20,10 @@ ColumnLimit: 100 # How much weight do extra characters after the line length limit have. # PenaltyExcessCharacter: 4 -# Disable reflow of qdoc comments: indentation rules are different. -# Translation comments are also excluded. -CommentPragmas: "^!|^:" +# Disable reflow of some specific comments +# qdoc comments: indentation rules are different. +# Translation comments and SPDX license identifiers are also excluded. +CommentPragmas: "^!|^:|^ SPDX-License-Identifier:" # We want a space between the type and the star for pointer types. PointerBindsToType: false @@ -84,12 +85,19 @@ ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCH # Break constructor initializers before the colon and after the commas. BreakConstructorInitializers: BeforeColon +# Avoids the addition of a space between an identifier and the +# initializer list in list-initialization. +SpaceBeforeCpp11BracedList: false + ################################################################################ # QtWebEngine specific changes to Qt style # We are using BeforeComma consistently so don't change it BreakConstructorInitializers: BeforeComma +# Disable indentation for preprocessing directives. Looks confusing at includes. +IndentPPDirectives: None + # Chromium macros MacroBlockBegin: "^\ IPC_BEGIN_MESSAGE_MAP|\ diff --git a/src/webenginequick/ui_delegates_manager.cpp b/src/webenginequick/ui_delegates_manager.cpp index 6751fec99..19dd04298 100644 --- a/src/webenginequick/ui_delegates_manager.cpp +++ b/src/webenginequick/ui_delegates_manager.cpp @@ -93,11 +93,14 @@ const char *defaultPropertyName(QObject *obj) #define COMPONENT_MEMBER_INIT(TYPE, COMPONENT) \ , COMPONENT##Component(0) +// clang-format off UIDelegatesManager::UIDelegatesManager(QQuickWebEngineView *view) : m_view(view) , m_toolTip(nullptr) , m_touchSelectionMenu(nullptr) - , m_autofillPopup(nullptr) FOR_EACH_COMPONENT_TYPE(COMPONENT_MEMBER_INIT, NO_SEPARATOR) + , m_autofillPopup(nullptr) + FOR_EACH_COMPONENT_TYPE(COMPONENT_MEMBER_INIT, NO_SEPARATOR) +// clang-format on { } diff --git a/src/webenginequick/ui_delegates_manager.h b/src/webenginequick/ui_delegates_manager.h index 7e05cf324..70e5ba00d 100644 --- a/src/webenginequick/ui_delegates_manager.h +++ b/src/webenginequick/ui_delegates_manager.h @@ -12,19 +12,20 @@ #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> -#define FOR_EACH_COMPONENT_TYPE(F, SEPARATOR) \ - F(Menu, menu) SEPARATOR F(MenuItem, menuItem) \ - SEPARATOR \ - F(MenuSeparator, menuSeparator) SEPARATOR F(AlertDialog, alertDialog) \ - SEPARATOR \ - F(ColorDialog, colorDialog) SEPARATOR F(ConfirmDialog, confirmDialog) \ - SEPARATOR \ - F(PromptDialog, promptDialog) SEPARATOR F(FilePicker, filePicker) \ - SEPARATOR \ - F(AuthenticationDialog, authenticationDialog) SEPARATOR F(ToolTip, toolTip) \ - SEPARATOR \ - F(TouchHandle, touchHandle) SEPARATOR F(TouchSelectionMenu, touchSelectionMenu) \ - SEPARATOR \ +// clang-format off +#define FOR_EACH_COMPONENT_TYPE(F, SEPARATOR) \ + F(Menu, menu) SEPARATOR \ + F(MenuItem, menuItem) SEPARATOR \ + F(MenuSeparator, menuSeparator) SEPARATOR \ + F(AlertDialog, alertDialog) SEPARATOR \ + F(ColorDialog, colorDialog) SEPARATOR \ + F(ConfirmDialog, confirmDialog) SEPARATOR \ + F(PromptDialog, promptDialog) SEPARATOR \ + F(FilePicker, filePicker) SEPARATOR \ + F(AuthenticationDialog, authenticationDialog) SEPARATOR \ + F(ToolTip, toolTip) SEPARATOR \ + F(TouchHandle, touchHandle) SEPARATOR \ + F(TouchSelectionMenu, touchSelectionMenu) SEPARATOR \ F(AutofillPopup, autofillPopup) SEPARATOR #define COMMA_SEPARATOR , @@ -33,6 +34,7 @@ TYPE #define MEMBER_DECLARATION(TYPE, COMPONENT) \ QQmlComponent *COMPONENT##Component +// clang-format on QT_BEGIN_NAMESPACE class QEvent; |