watchwindow.h 3.14 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

con's avatar
con committed
26 27 28
#ifndef DEBUGGER_WATCHWINDOW_H
#define DEBUGGER_WATCHWINDOW_H

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

31
namespace Debugger {
con's avatar
con committed
32 33 34 35 36 37 38 39
namespace Internal {

/////////////////////////////////////////////////////////////////////
//
// WatchWindow
//
/////////////////////////////////////////////////////////////////////

40 41
enum WatchType { LocalsType, InspectType, WatchersType, ReturnType, TooltipType };

42
class WatchTreeView : public Utils::BaseTreeView
con's avatar
con committed
43 44 45 46
{
    Q_OBJECT

public:
47
    explicit WatchTreeView(WatchType type);
48
    WatchType type() const { return m_type; }
hjk's avatar
hjk committed
49

hjk's avatar
hjk committed
50
    void setModel(QAbstractItemModel *model);
51
    void rowActivated(const QModelIndex &index);
hjk's avatar
hjk committed
52
    void reset();
53

hjk's avatar
hjk committed
54
    void fillFormatMenu(QMenu *, const QModelIndex &mi);
55
    static void reexpand(QTreeView *view, const QModelIndex &idx);
hjk's avatar
hjk committed
56

con's avatar
con committed
57
public slots:
58
    void watchExpression(const QString &exp);
59
    void watchExpression(const QString &exp, const QString &name);
hjk's avatar
hjk committed
60
    void handleItemIsExpanded(const QModelIndex &idx);
con's avatar
con committed
61

62 63 64
signals:
    void currentIndexChanged(const QModelIndex &currentIndex);

65
private:
hjk's avatar
hjk committed
66 67 68
    void resetHelper();
    void expandNode(const QModelIndex &idx);
    void collapseNode(const QModelIndex &idx);
hjk's avatar
hjk committed
69
    Q_SLOT void adjustSlider(); // Used by single-shot timer.
hjk's avatar
hjk committed
70

71
    void showUnprintable(int base);
72
    void doItemsLayout();
73
    void keyPressEvent(QKeyEvent *ev);
con's avatar
con committed
74
    void contextMenuEvent(QContextMenuEvent *ev);
75 76 77
    void dragEnterEvent(QDragEnterEvent *ev);
    void dropEvent(QDropEvent *ev);
    void dragMoveEvent(QDragMoveEvent *ev);
78
    void mouseDoubleClickEvent(QMouseEvent *ev);
79
    bool event(QEvent *ev);
80
    void currentChanged(const QModelIndex &current, const QModelIndex &previous);
81

82
    void inputNewExpression();
con's avatar
con committed
83 84
    void editItem(const QModelIndex &idx);

85 86 87
    void setModelData(int role, const QVariant &value = QVariant(),
        const QModelIndex &index = QModelIndex());

88
    WatchType m_type;
89
    bool m_grabbing;
90
    int m_sliderPosition;
con's avatar
con committed
91 92 93 94 95 96
};

} // namespace Internal
} // namespace Debugger

#endif // DEBUGGER_WATCHWINDOW_H