Mailcommon

invalidfilterlistview.cpp
1 /*
2  SPDX-FileCopyrightText: 2015-2022 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "invalidfilterlistview.h"
8 #include "invalidfilterlistitemdelegate.h"
9 #include "invalidfilterlistmodel.h"
10 using namespace MailCommon;
11 
12 InvalidFilterListView::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 
24 InvalidFilterListView::~InvalidFilterListView() = default;
25 
26 void InvalidFilterListView::setInvalidFilters(const QVector<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  }
34  model()->sort(Qt::DisplayRole);
35 }
DisplayRole
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Oct 1 2022 04:00:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.