[Qt-creator] Formatting files without suffix as C++-Code

Eike Ziller Eike.Ziller at qt.io
Thu Nov 16 15:50:59 CET 2017


> On Nov 16, 2017, at 15:43, Wilhelm <wilhelm.meier at fh-kl.de> wrote:
> 
> Hi all,
> 
> we use some header-file without suffix, e.g. "utility" instead of
> "utility.h" as in the libstdc++. If you open a file without suffix .h or
> .cpp ... QtCreator doesn't format this file as code. Is the a way to set
> the formatting based on some other criteria than suffix?

You can try playing with the “pattern” and “magic header”s of the text/x-c++hdr mime type in Options > Environment > MIME Types.
That should work for opening them in the C++ style editor. Though note that we do not necessarily respect the magic headers in all other things that we do, for performance reasons (since it requires opening a file and reading part of it, which is slow if it needs to be done for _many_ files).

Br, Eike

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list