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*/
9 #include <ui/qt/widgets/follow_stream_text.h>
11 #include <wireshark_application.h>
13 #include <QMouseEvent>
14 #include <QTextCursor>
17 // - Draw text by hand similar to ByteViewText. This would let us add
18 // extra information, e.g. a timestamp column and get rid of
19 // max_document_length_ in FollowStreamDialog.
21 FollowStreamText::FollowStreamText(QWidget *parent) :
22 QPlainTextEdit(parent)
24 setMouseTracking(true);
25 // setMaximumBlockCount(1);
26 QTextDocument *text_doc = document();
27 text_doc->setDefaultFont(wsApp->monospaceFont());
30 void FollowStreamText::mouseMoveEvent(QMouseEvent *event)
32 emit mouseMovedToTextCursorPosition(cursorForPosition(event->pos()).position());
33 QPlainTextEdit::mouseMoveEvent(event);
36 void FollowStreamText::mousePressEvent(QMouseEvent *event)
38 emit mouseClickedOnTextCursorPosition(cursorForPosition(event->pos()).position());
39 QPlainTextEdit::mousePressEvent(event);
42 void FollowStreamText::leaveEvent(QEvent *event)
44 emit mouseMovedToTextCursorPosition(-1);
45 QPlainTextEdit::leaveEvent(event);
54 * indent-tabs-mode: nil
57 * ex: set shiftwidth=4 tabstop=8 expandtab:
58 * :indentSize=4:tabSize=8:noTabs=true: