[Development] New Qt example development guideline and revamping examples

A. Pönitz apoenitz at t-online.de
Thu Jan 19 19:15:42 CET 2023

On Thu, Jan 19, 2023 at 01:44:16PM +0000, Friedemann Kleint via
Development wrote:
> Hi,
> we also need to agree on whether the Qt library rules apply to the
> full extent; for example:
> - Do we use the modern string literals (u"bla"_s, previously, example
> code just constructed QString from ASCII and did not care about

I'd rather keep it concise, i.e. undecorated or _at most_ u"..."

The prefered "modern" decoration changes rather rapidly (I think the
previous incarnation barely survived a year in Qt base) and on the
application side there's practically no user-noticable benefit at
the price of serious developer time to stay "up to date". I wouldn't
encourage through the examples. So: -1

> - Should tr() be used for all user-facing messages (although examples
> mostly do not have translations set up)

On the pro side this solves the string decoration problem, on the
con side this uses the automatic class contexts which I don't think
are a good idea for larger application and also requires "weird"
Q_OBJECT / Q_DECLARE_TR_FUNCTION setup. So: +/- 0 on this one...

> - Do we use std::as_const to avoid detaching
> containers in loops (mostly missing for code ported from Q_FOREACH)


> Generally, when polishing examples, I found that member initialization
> greatly simplifies code.



More information about the Development mailing list