msidentificationtableproxymodel.h 2.62 KB
Newer Older
1
2

/*******************************************************************************
Renne Thomas's avatar
Renne Thomas committed
3
 * Copyright (c) 2019 Olivier Langella <olivier.langella@u-psud.fr>.
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 *
 * This file is part of XTPcpp.
 *
 *     XTPcpp is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     XTPcpp is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with XTPcpp.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Contributors:
Renne Thomas's avatar
Renne Thomas committed
21
 *     Thomas Renne <thomas.renne@u-psud.fr>. - initial API and
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 *implementation
 ******************************************************************************/

#pragma once

#include <QAbstractTableModel>
#include <QSortFilterProxyModel>
#include "../../../core/project.h"
#include "msidentificationtablemodel.h"
#include "../../widgets/massitemdelegate.h"

class MsIdentificationListWindow;

class MsIdentificationTableModel;

class MsIdentificationTableProxyModel : public QSortFilterProxyModel
{
  Q_OBJECT
  public:
Renne Thomas's avatar
Renne Thomas committed
41
42
43
  MsIdentificationTableProxyModel(
    MsIdentificationListWindow *m_msid_list_window,
    MsIdentificationTableModel *m_msid_table_model_p);
44
  virtual ~MsIdentificationTableProxyModel();
Renne Thomas's avatar
Renne Thomas committed
45
46
47
48
  bool filterAcceptsRow(int source_row,
                        const QModelIndex &source_parent) const override;
  bool filterAcceptsColumn(int source_column,
                           const QModelIndex &source_parent) const override;
Renne Thomas's avatar
Renne Thomas committed
49
50
  QVariant
  headerData(int section, Qt::Orientation orientation, int role) const override;
51
52
53
54
  QVariant data(const QModelIndex &index,
                int role = Qt::DisplayRole) const override;
  bool lessThan(const QModelIndex &left,
                const QModelIndex &right) const override;
Renne Thomas's avatar
Renne Thomas committed
55
56
  void setSearchOn(QString search_on);
  void setMsIdentificationSearchString(QString ms_id_search_string);
57

58
59
60
61
  void resteItemDelegates() const;

  public slots:
  void onTableClicked(const QModelIndex &index);
62
63

  private:
Renne Thomas's avatar
Renne Thomas committed
64
  std::vector<IdentificationDataSourceSp> m_identificationDataSourceSpList;
65
66
  MsIdentificationTableModel *m_msid_table_model_p;
  MsIdentificationListWindow *m_msid_list_window;
Renne Thomas's avatar
Renne Thomas committed
67
68
  QString m_ms_id_search_string;
  QString m_search_on = "ms identification";
69
70
71
  std::vector<bool> m_column_display;
  PercentItemDelegate *m_percent_delegate;
};