-
Notifications
You must be signed in to change notification settings - Fork 1
/
backtracewindow.cpp
executable file
·59 lines (54 loc) · 1.6 KB
/
backtracewindow.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "backtracewindow.h"
#include "gdb.h"
#include <cstdio>
extern GDB *gdb;
/**
* \brief Constructor for the \c BackTraceWindow class.
*
* The constructor calls the \c QFrame constructor to get things
* in order before customizing. It establishes a beveled border
* and then places its \c QListWidget in its layout.
*
* Its final action is to connect the \c sendBackTrace signal
* from the \c gdb thread to its \c receiveBackTrace slot.
*/
BackTraceWindow::BackTraceWindow(QWidget *parent)
: QFrame(parent)
{
setObjectName("Back trace");
setFrameStyle(QFrame::Panel | QFrame::Raised);
setLineWidth(4);
QHBoxLayout *layout = new QHBoxLayout();
layout->setContentsMargins(10, 10, 10, 10);
list = new QListWidget();
layout->addWidget(list);
setLayout(layout);
connect(gdb, SIGNAL(sendBackTrace(QStringList)), this,
SLOT(receiveBackTrace(QStringList)));
}
/**
* \fn BackTraceWindow::sizeHint
*
* This function gives a hint to the Qt layout engine on the minimum
* size required. The 50 rows is not likely to be enough, but at least
* the widget can be shrunk a lot.
*/
QSize BackTraceWindow::sizeHint() const
{
return QSize(200, 10);
}
/**
* \fn BackTraceWindow::receiveBackTrace
*
* This function is called with the \c gdb thread emits a signal providing
* new data to be displayed in the \c BackTraceWindow.
*
* \param results The results from the \c gdb \c backtrace command.
*/
void BackTraceWindow::receiveBackTrace(QStringList results)
{
trace = results;
level = results.length();
list->clear();
list->addItems(results);
}