D26021: Display sub categories when searching

David Edmundson noreply at phabricator.kde.org
Wed Dec 18 10:26:25 GMT 2019


davidedmundson added inline comments.

INLINE COMMENTS

> MenuModel.cpp:102
> +            MenuItem *candidate = mi->parent();
> +            while ( candidate && candidate->parent() && candidate->parent()->parent() ) {
> +                candidate = candidate->parent();

More comments are needed throughout.

You forgot why we went to the second level of heirachy only 10 minutes after coding it when I asked :P

> MenuModel.cpp:108
>              }
> +            //if (mi->parent())  theData.setValue( mi->parent()->name() );
>              break;

can be deleted

> SidebarMode.cpp:263
>      KActionCollection *collection = nullptr;
> -    QPersistentModelIndex activeCategoryIndex;
> -    int activeCategory;
> -    int activeSubCategory;
> +    QPersistentModelIndex activeCategoryRowIndex;
> +    int activeCategoryRow = -1;

calling an int categoryRow makes sense, as the int refers to the row.

Calling an index CategoryRow doesn't.

> SidebarMode.cpp:400
>      if (showToolTips()) {
> -        d->subCategoryToolTipManager->requestToolTip(d->subCategoryModel->index(index, 0), rect.toRect());
> +        d->toolTipManager->setModel(const_cast<QAbstractItemModel *>(index.model()));
> +        d->toolTipManager->requestToolTip(index, rect.toRect());

please check validity, otherwise model is null and we'll crash.

also ..why make it const, only to cast it?

REPOSITORY
  R124 System Settings

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

To: mart, #plasma, #vdg
Cc: davidedmundson, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20191218/00594858/attachment-0001.html>


More information about the Plasma-devel mailing list