aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/console/consoleproxymodel.h
blob: 3b42c0523a3a8454920184b818c2eeb149f8ebb6 (plain)
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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include "consoleitem.h"

#include <QSortFilterProxyModel>
#include <QItemSelectionModel>

namespace Debugger::Internal {

class ConsoleProxyModel : public QSortFilterProxyModel
{
    Q_OBJECT
public:
    explicit ConsoleProxyModel(QObject *parent);

    void setShowLogs(bool show);
    void setShowWarnings(bool show);
    void setShowErrors(bool show);
    void selectEditableRow(const QModelIndex &index,
                               QItemSelectionModel::SelectionFlags command);
    void onRowsInserted(const QModelIndex &index, int start, int end);

signals:
    void scrollToBottom();
    void setCurrentIndex(const QModelIndex &index,
                         QItemSelectionModel::SelectionFlags command);

protected:
    bool filterAcceptsRow(int source_row,
                          const QModelIndex &source_parent) const override;

private:
    QFlags<ConsoleItem::ItemType> m_filter;
};

} // Debugger::Internal