D22147: Better use of Qt APIs in Plasma::Theme

Kai Uwe Broulik noreply at phabricator.kde.org
Fri Jun 28 19:33:28 BST 2019


broulik added inline comments.

INLINE COMMENTS

> svg.cpp:313
>          // and store them locally.
> -        QRegExp sizeHintedKeyExpr(CACHE_ID_NATURAL_SIZE(QStringLiteral("(\\d+)-(\\d+)-(.+)"), status, ratio));
> +        const QRegularExpression sizeHintedKeyExpr(CACHE_ID_NATURAL_SIZE(QStringLiteral("$(\\d+)-(\\d+)-(.+)^"), status, ratio));
>  

When you make it `static` it would only have to compile it once

> theme.cpp:106
> +        const auto it = ThemePrivate::themesRefCount.find(d->themeName);
> +        Q_ASSERT(it != ThemePrivate::themesRefCount.end());
> +        if (!it->deref()) {

Can we clean up all of this custom refcounting by using a `QSharedPointer`?

> theme.cpp:336
>  
>          d->keysToCache.insert(key, id);
>          d->idsToCache.insert(id, key);

So this code removes the item if already existing and then inserts it again? This thing is a `QHash` so `insert` will just override the existing one anyway, no need to remove it first.

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D22147

To: apol, #plasma, #frameworks
Cc: broulik, kde-frameworks-devel, LeGast00n, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190628/5cafc3e7/attachment.html>


More information about the Kde-frameworks-devel mailing list