aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/console/consoleview.h
blob: 0acbf97968bceb1034d10382f139665c924d688c (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
// 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 <utils/fileinprojectfinder.h>
#include <utils/itemviews.h>

namespace Debugger::Internal {

class ConsoleItemModel;

class ConsoleView : public Utils::TreeView
{
public:
    ConsoleView(ConsoleItemModel *model, QWidget *parent);

    void onScrollToBottom();
    void populateFileFinder();

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void resizeEvent(QResizeEvent *e) override;
    void drawBranches(QPainter *painter, const QRect &rect,
                      const QModelIndex &index) const override;
    void contextMenuEvent(QContextMenuEvent *event) override;
    void focusInEvent(QFocusEvent *event) override;

private:
    void onRowActivated(const QModelIndex &index);
    void copyToClipboard(const QModelIndex &index);
    bool canShowItemInTextEditor(const QModelIndex &index);

    ConsoleItemModel *m_model;
    Utils::FileInProjectFinder m_finder;
};

} // Debugger::Internal