• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

kjsembed

  • kjsembed
  • examples
  • kjsconsole
numberedtextview.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
3 Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
4 Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
5 Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22
23#ifndef NUMBERED_TEXT_VIEW_H
24#define NUMBERED_TEXT_VIEW_H
25
26#include <QtGui/QFrame>
27#include <QtGui/QPixmap>
28#include <QtGui/QTextCursor>
29
30class QTextEdit;
31class QHBoxLayout;
32
36class NumberBar : public QWidget
37{
38 Q_OBJECT
39
40public:
41 NumberBar( QWidget *parent );
42 ~NumberBar();
43
44 void setCurrentLine( int lineno );
45 void setStopLine( int lineno );
46 void setBugLine( int lineno );
47
48 int currentLine() const;
49 int stopLine() const;
50 int bugLine() const;
51
52 void setTextEdit( QTextEdit *edit );
53 void paintEvent( QPaintEvent *ev );
54
55
56
57protected:
58 bool event( QEvent *ev );
59
60private:
61 QTextEdit *edit;
62 QPixmap stopMarker;
63 QPixmap currentMarker;
64 QPixmap bugMarker;
65 int m_stopLine;
66 int m_currentLine;
67 int m_bugLine;
68 QRect stopRect;
69 QRect currentRect;
70 QRect bugRect;
71};
72
76class NumberedTextView : public QFrame
77{
78 Q_OBJECT
79 Q_PROPERTY( QString text READ text WRITE setText )
80 Q_PROPERTY( int currentLine READ currentLine WRITE setCurrentLine )
81 Q_PROPERTY( int stopLine READ stopLine WRITE setStopLine )
82 Q_PROPERTY( int bugLine READ bugLine WRITE setBugLine )
83public:
84 NumberedTextView( QWidget *parent = 0 );
85 ~NumberedTextView();
86
88 QTextEdit *textEdit() const { return view; }
89
94 void setCurrentLine( int lineno );
95
100 void setStopLine( int lineno );
101
106 void setBugLine( int lineno );
107
108 int currentLine() const;
109 int stopLine() const;
110 int bugLine() const;
111
113 bool eventFilter( QObject *obj, QEvent *event );
114
115 QString text() const;
116 void setText( const QString &text );
117
118
119Q_SIGNALS:
124 void mouseHover( const QString &word );
125
131 void mouseHover( const QPoint &pos, const QString &word );
132
133protected Q_SLOTS:
135 void textChanged( int pos, int added, int removed );
136
137private:
138 QTextEdit *view;
139 NumberBar *numbers;
140 QHBoxLayout *box;
141 //int m_currentLine;
142 QTextCursor highlight;
143};
144
145
146#endif // NUMBERED_TEXT_VIEW_H
147
148
NumberBar
Definition: numberedtextview.h:37
NumberBar::setStopLine
void setStopLine(int lineno)
Definition: numberedtextview.cpp:53
NumberBar::stopLine
int stopLine() const
Definition: numberedtextview.cpp:68
NumberBar::setBugLine
void setBugLine(int lineno)
Definition: numberedtextview.cpp:58
NumberBar::paintEvent
void paintEvent(QPaintEvent *ev)
Definition: numberedtextview.cpp:87
NumberBar::bugLine
int bugLine() const
Definition: numberedtextview.cpp:73
NumberBar::currentLine
int currentLine() const
Definition: numberedtextview.cpp:63
NumberBar::setCurrentLine
void setCurrentLine(int lineno)
Definition: numberedtextview.cpp:48
NumberBar::setTextEdit
void setTextEdit(QTextEdit *edit)
Definition: numberedtextview.cpp:78
NumberBar::~NumberBar
~NumberBar()
Definition: numberedtextview.cpp:44
NumberBar::event
bool event(QEvent *ev)
Definition: numberedtextview.cpp:136
NumberedTextView
Displays a QTextEdit with line numbers.
Definition: numberedtextview.h:77
NumberedTextView::stopLine
int stopLine
Definition: numberedtextview.h:81
NumberedTextView::mouseHover
void mouseHover(const QPoint &pos, const QString &word)
Emitted when the mouse is hovered over the text edit component.
NumberedTextView::currentLine
int currentLine
Definition: numberedtextview.h:80
NumberedTextView::setBugLine
void setBugLine(int lineno)
Sets the line that should have the bug line indicator.
Definition: numberedtextview.cpp:200
NumberedTextView::mouseHover
void mouseHover(const QString &word)
Emitted when the mouse is hovered over the text edit component.
NumberedTextView::bugLine
int bugLine
Definition: numberedtextview.h:82
NumberedTextView::text
QString text
Definition: numberedtextview.h:79
NumberedTextView::eventFilter
bool eventFilter(QObject *obj, QEvent *event)
Definition: numberedtextview.cpp:262
NumberedTextView::setText
void setText(const QString &text)
Definition: numberedtextview.cpp:225
NumberedTextView::textChanged
void textChanged(int pos, int added, int removed)
Definition: numberedtextview.cpp:231
NumberedTextView::~NumberedTextView
~NumberedTextView()
Definition: numberedtextview.cpp:185
NumberedTextView::setCurrentLine
void setCurrentLine(int lineno)
Sets the line that should have the current line indicator.
Definition: numberedtextview.cpp:189
NumberedTextView::setStopLine
void setStopLine(int lineno)
Sets the line that should have the stop line indicator.
Definition: numberedtextview.cpp:195
NumberedTextView::textEdit
QTextEdit * textEdit() const
Returns the QTextEdit of the main view.
Definition: numberedtextview.h:88
QFrame
QObject
QWidget
parent
QObject * parent
Definition: qaction_binding.cpp:48
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kjsembed

Skip menu "kjsembed"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal