watchwindow.h 2.85 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
con's avatar
con committed
2
**
3 4
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
con's avatar
con committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
con's avatar
con committed
7
**
hjk's avatar
hjk committed
8 9 10 11
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
12 13 14
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
15
**
16 17 18 19 20 21 22
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
con's avatar
con committed
23
**
hjk's avatar
hjk committed
24
****************************************************************************/
hjk's avatar
hjk committed
25

hjk's avatar
hjk committed
26
#pragma once
con's avatar
con committed
27

28
#include <utils/basetreeview.h>
con's avatar
con committed
29

30
namespace Debugger {
con's avatar
con committed
31 32
namespace Internal {

33 34
enum WatchType { LocalsType, InspectType, WatchersType, ReturnType, TooltipType };

35
class WatchTreeView : public Utils::BaseTreeView
con's avatar
con committed
36 37 38 39
{
    Q_OBJECT

public:
40
    explicit WatchTreeView(WatchType type);
41
    WatchType type() const { return m_type; }
hjk's avatar
hjk committed
42

hjk's avatar
hjk committed
43
    void setModel(QAbstractItemModel *model);
44
    void rowActivated(const QModelIndex &index);
hjk's avatar
hjk committed
45
    void reset();
46

hjk's avatar
hjk committed
47
    void fillFormatMenu(QMenu *, const QModelIndex &mi);
48
    static void reexpand(QTreeView *view, const QModelIndex &idx);
hjk's avatar
hjk committed
49

50
    void watchExpression(const QString &exp);
51
    void watchExpression(const QString &exp, const QString &name);
hjk's avatar
hjk committed
52
    void handleItemIsExpanded(const QModelIndex &idx);
con's avatar
con committed
53

54 55 56
signals:
    void currentIndexChanged(const QModelIndex &currentIndex);

57
private:
hjk's avatar
hjk committed
58 59 60
    void resetHelper();
    void expandNode(const QModelIndex &idx);
    void collapseNode(const QModelIndex &idx);
hjk's avatar
hjk committed
61
    void adjustSlider();
hjk's avatar
hjk committed
62

63
    void showUnprintable(int base);
64
    void doItemsLayout();
65
    void keyPressEvent(QKeyEvent *ev);
con's avatar
con committed
66
    void contextMenuEvent(QContextMenuEvent *ev);
67 68 69
    void dragEnterEvent(QDragEnterEvent *ev);
    void dropEvent(QDropEvent *ev);
    void dragMoveEvent(QDragMoveEvent *ev);
70
    void mouseDoubleClickEvent(QMouseEvent *ev);
71
    bool event(QEvent *ev);
72
    void currentChanged(const QModelIndex &current, const QModelIndex &previous);
73

74
    void inputNewExpression();
con's avatar
con committed
75 76
    void editItem(const QModelIndex &idx);

77 78 79
    void setModelData(int role, const QVariant &value = QVariant(),
        const QModelIndex &index = QModelIndex());

80
    WatchType m_type;
81
    bool m_grabbing;
82
    int m_sliderPosition;
con's avatar
con committed
83 84 85 86
};

} // namespace Internal
} // namespace Debugger