Cppcheck - HTML report - digiKam-nl-search-more-criteria-rev-e2466e0973

# Cppcheck report - digiKam-nl-search-more-criteria-rev-e2466e0973: ../../core/libs/widgets/history/itemfiltershistorytreeitem.cpp

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    /* ============================================================
     *
     * This file is a part of digiKam project
     * https://www.digikam.org
     *
     * Date        : 2010-06-23
     * Description : widget for displaying an item in view with used filters on current image
     *
     * SPDX-FileCopyrightText: 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
     *
     * SPDX-License-Identifier: GPL-2.0-or-later
     *
     * ============================================================ */

    #include "itemfiltershistorytreeitem.h"

    namespace Digikam
    {

    class Q_DECL_HIDDEN ItemFiltersHistoryTreeItem::Private
    {
    public:

        Private() = default;

        QList<ItemFiltersHistoryTreeItem*> childItems;
        QList<QVariant>                    itemData;
        ItemFiltersHistoryTreeItem*        parentItem   = nullptr;
        bool                               disabled     = false;
    };

    ItemFiltersHistoryTreeItem::ItemFiltersHistoryTreeItem(const QList<QVariant>& data,
                                                           ItemFiltersHistoryTreeItem* const parent)
        : d(new Private)
    {
        d->parentItem = parent;
        d->itemData   = data;
    }

    ItemFiltersHistoryTreeItem::ItemFiltersHistoryTreeItem(const QString& data,
                                                           ItemFiltersHistoryTreeItem* const parent)
        : d(new Private)
    {
        d->parentItem = parent;
        d->itemData.append(data);
    }

    ItemFiltersHistoryTreeItem::ItemFiltersHistoryTreeItem(const ItemFiltersHistoryTreeItem& other)
        : d(new Private(*other.d))
    {
    }

    ItemFiltersHistoryTreeItem::~ItemFiltersHistoryTreeItem()
    {
        qDeleteAll(d->childItems);
        delete d;
    }

    void ItemFiltersHistoryTreeItem::appendChild(ItemFiltersHistoryTreeItem* const item)
    {
        d->childItems.append(item);
    }

    ItemFiltersHistoryTreeItem* ItemFiltersHistoryTreeItem::child(int row) const<--- Shadow argument
    {
        return d->childItems.value(row);
    }

    int ItemFiltersHistoryTreeItem::childCount() const
    {
        return d->childItems.count();
    }

    int ItemFiltersHistoryTreeItem::columnCount() const
    {
        return d->itemData.count();
    }

    QVariant ItemFiltersHistoryTreeItem::data(int column) const
    {
        return d->itemData.value(column);
    }

    ItemFiltersHistoryTreeItem* ItemFiltersHistoryTreeItem::parent() const
    {
        return d->parentItem;
    }

    int ItemFiltersHistoryTreeItem::row() const
    {
        if (d->parentItem)
        {
            return d->parentItem->d->childItems.indexOf(const_cast<ItemFiltersHistoryTreeItem*>(this));
        }

        return 0;
    }

    void ItemFiltersHistoryTreeItem::removeChild(int row)<--- Shadow argument
    {
        delete child(row);
        d->childItems.removeAt(row);
    }

    bool ItemFiltersHistoryTreeItem::isDisabled() const
    {
        return d->disabled;
    }

    void ItemFiltersHistoryTreeItem::setDisabled(bool disabled) const
    {
        d->disabled = disabled;
    }

    } // namespace Digikam