Mailcommon

invalidfilterlistview.cpp
1/*
2 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "invalidfilterlistview.h"
8#include "invalidfilterlistitemdelegate.h"
9#include "invalidfilterlistmodel.h"
10using namespace MailCommon;
11
12InvalidFilterListView::InvalidFilterListView(QWidget *parent)
13 : QListView(parent)
14{
15 auto invalidFilterDelegate = new InvalidFilterListItemDelegate(this, this);
16
17 auto invalidFilterListModel = new InvalidFilterListModel(this);
18 connect(invalidFilterDelegate, &InvalidFilterListItemDelegate::showDetails, this, &InvalidFilterListView::showDetails);
19 // connect(this, SIGNAL(pressed(QModelIndex)), SIGNAL(hideInformationWidget()));
20 setModel(invalidFilterListModel);
21 setItemDelegate(invalidFilterDelegate);
22}
23
24InvalidFilterListView::~InvalidFilterListView() = default;
25
26void InvalidFilterListView::setInvalidFilters(const QList<MailCommon::InvalidFilterInfo> &lst)
27{
28 for (const MailCommon::InvalidFilterInfo &info : lst) {
29 model()->insertRow(0);
30 const QModelIndex index = model()->index(0, 0);
31 model()->setData(index, info.name(), Qt::DisplayRole);
32 model()->setData(index, info.information(), InvalidFilterListModel::InformationRole);
33 }
35}
36
37#include "moc_invalidfilterlistview.cpp"
The filter dialog.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
bool insertRow(int row, const QModelIndex &parent)
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
virtual void sort(int column, Qt::SortOrder order)
QAbstractItemModel * model() const const
DisplayRole
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:02:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.