aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/console/consoleitemmodel.h
blob: 8a6662b84a2bc847b1bce44e8e104e7b898424dd (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
40
41
42
43
44
// 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 <utils/treemodel.h>

#include <QItemSelectionModel>

QT_BEGIN_NAMESPACE
class QFont;
QT_END_NAMESPACE

namespace Debugger::Internal {

class ConsoleItemModel : public Utils::TreeModel<>
{
    Q_OBJECT
public:

    explicit ConsoleItemModel(QObject *parent = nullptr);

    void shiftEditableRow();

    void appendItem(ConsoleItem *item, int position = -1);

    int sizeOfFile(const QFont &font);
    int sizeOfLineNumber(const QFont &font);

    void clear();

    void setCanFetchMore(bool canFetchMore);
    bool canFetchMore(const QModelIndex &parent) const override;

signals:
    void selectEditableRow(const QModelIndex &index, QItemSelectionModel::SelectionFlags flags);

private:
    int m_maxSizeOfFileName = 0;
    bool m_canFetchMore = false;
};

} // Debugger::Internal