1 /* follow_stream_text.cpp
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #include <ui/qt/widgets/follow_stream_text.h>
12 #include <wireshark_application.h>
14 #include <QMouseEvent>
15 #include <QTextCursor>
18 // - Draw text by hand similar to ByteViewText. This would let us add
19 // extra information, e.g. a timestamp column and get rid of
20 // max_document_length_ in FollowStreamDialog.
22 FollowStreamText::FollowStreamText(QWidget *parent) :
23 QPlainTextEdit(parent)
25 setMouseTracking(true);
26 // setMaximumBlockCount(1);
27 QTextDocument *text_doc = document();
28 text_doc->setDefaultFont(wsApp->monospaceFont());
31 void FollowStreamText::mouseMoveEvent(QMouseEvent *event)
33 emit mouseMovedToTextCursorPosition(cursorForPosition(event->pos()).position());
34 QPlainTextEdit::mouseMoveEvent(event);
37 void FollowStreamText::mousePressEvent(QMouseEvent *event)
39 emit mouseClickedOnTextCursorPosition(cursorForPosition(event->pos()).position());
40 QPlainTextEdit::mousePressEvent(event);
43 void FollowStreamText::leaveEvent(QEvent *event)
45 emit mouseMovedToTextCursorPosition(-1);
46 QPlainTextEdit::leaveEvent(event);
55 * indent-tabs-mode: nil
58 * ex: set shiftwidth=4 tabstop=8 expandtab:
59 * :indentSize=4:tabSize=8:noTabs=true: