[Interest] Random question Friday: Why no area() for Rects and Sizes?, path.join()?

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Sat Apr 13 10:27:56 CEST 2019

Il 12/04/19 17:09, Jason H ha scritto:
> I often miss Node and Python that has a path appender. This could have been tedious in the past but in C++11, QDir::join({parts, of, a, path, and, filename})  (declared as static QDir::join(const QStringList& parts);)
> I'm aware that Qt makes file path delimiters OS-agnostic, but I find myself missing the construct as a logical concept.  

It's non trivial in the presence of parts which design absolute paths, 
and, Qt should stop adding filesystem convenience APIs before having a 
serious discussion on its evolution (e.g. dropping QString in favour of 
a filesystem path class).

For instance, see the complicated (confusing?) behaviour of operator/ 
for std::filesystem::path:

> https://en.cppreference.com/w/cpp/filesystem/path/append

> Also consider:
> source ="file://"  + appPath+ "/" + filename


Use QUrl properly (QUrl::fromLocalFile, in this case).

My 2 c,
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190413/a1a85e33/attachment.bin>

More information about the Interest mailing list