1 (edited by De-Backer 2020-11-01 19:51:25)

Topic: Codestyle Qet

Martin(e-mail) showed that there is a need for Code Style for Qet, which is there but hard to find.
He suggested the tool clang format.
https://doc.qt.io/qtcreator/creator-indenting-code.html

This topic will mainly be about installing clang in QT and usage.

Where that I further explain the usefulness of clang.

or watch this video:
https://www.youtube.com/watch?v=Cz36YveDI2E

I will complete this post later.

Edit:
- add clang file
- add code

-    QString txt=QTime::currentTime().toString("hh:mm:ss.zzz");
-    QByteArray dbs =txt.toLocal8Bit();
-    QByteArray localMsg = msg.toLocal8Bit();
-    const char *file = context.file ? context.file : "";
-    const char *function = context.function ? context.function : "";

to

+    QString     txt      = QTime::currentTime().toString("hh:mm:ss.zzz");
+    QByteArray  dbs      = txt.toLocal8Bit();
+    QByteArray  localMsg = msg.toLocal8Bit();
+    const char* file     = context.file ? context.file : "";
+    const char* function = context.function ? context.function : "";

- Qt Creator enable the plugin:
To enable the plugin, select Help > About Plugins > C++ > ClangFormat. Then select "Restart Now" to restart Qt Creator and load the plugin.

- update clang file
mod
IndentWidth 8->4
TabWidth 8-> 4
BreakConstructorInitializers BCIS_BeforeColon->BCIS_AfterColon
BreakInheritanceList BCIS_BeforeColon->BCIS_AfterColon
still to be tested

-add clang file in to git repo
https://git.tuxfamily.org/qet/qet.git/c … 351c3e737b

Post's attachments

Attachment icon clang-format 1.99 kb, 289 downloads since 2020-11-01