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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
|
// This is the SIP interface definition for QTextEdit.
//
// Copyright (c) 2007
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
//
// This file is part of PyQt.
//
// This copy of PyQt is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2, or (at your option) any later
// version.
//
// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// PyQt; see the file LICENSE. If not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%ExportedDoc
<Sect2><Title>QTextEdit (Qt v3+)</Title>
<FuncSynopsis>
<FuncDef>int <Function>charAt</Function></FuncDef>
<ParamDef>const QPoint &<Parameter>pos</Parameter></ParamDef>
<ParamDef>int *<Parameter>para</Parameter> = 0</ParamDef>
</FuncSynopsis>
<Para>
This takes only the <Literal>pos</Literal> parameter and returns a tuple of the
value returned via the <Literal>para</Literal> pointer and the int result.
</Para>
<FuncSynopsis>
<FuncDef>void <Function>del</Function></FuncDef>
<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
This has been renamed <Literal>delChar</Literal> in Python.
</Para>
<FuncSynopsis>
<FuncDef>virtual bool <Function>find</Function></FuncDef>
<ParamDef>const QString &<Parameter>expr</Parameter></ParamDef>
<ParamDef>bool <Parameter>cs</Parameter></ParamDef>
<ParamDef>bool <Parameter>wo</Parameter></ParamDef>
<ParamDef>bool <Parameter>forward</Parameter> = TRUE</ParamDef>
<ParamDef>int *<Parameter>para</Parameter> = 0</ParamDef>
<ParamDef>int *<Parameter>index</Parameter> = 0</ParamDef>
</FuncSynopsis>
<Para>
If the <Literal>para</Literal> and <Literal>index</Literal> parameters are
omitted then the bool result is returned. If both are supplied (as integers)
then a tuple of the bool result and the modified values of
<Literal>para</Literal> and <Literal>index</Literal> is returned.
</Para>
<FuncSynopsis>
<FuncDef>void <Function>getCursorPosition</Function></FuncDef>
<ParamDef>int *<Parameter>para</Parameter></ParamDef>
<ParamDef>int *<Parameter>index</Parameter></ParamDef>
</FuncSynopsis>
<Para>
This takes no parameters and returns a tuple of the values returned via the
<Literal>para</Literal> and <Literal>index</Literal> pointers.
</Para>
<FuncSynopsis>
<FuncDef>void <Function>getSelection</Function></FuncDef>
<ParamDef>int *<Parameter>paraFrom</Parameter></ParamDef>
<ParamDef>int *<Parameter>indexFrom</Parameter></ParamDef>
<ParamDef>int *<Parameter>paraTo</Parameter></ParamDef>
<ParamDef>int *<Parameter>indexTo</Parameter></ParamDef>
<ParamDef>int <Parameter>selNum</Parameter> = 0</ParamDef>
</FuncSynopsis>
<Para>
This takes only the <Literal>selNum</Literal> parameter and returns a tuple of
the <Literal>paraFrom</Literal>, <Literal>indexFrom</Literal>,
<Literal>paraTo</Literal> and <Literal>indexTo</Literal> values.
</Para>
</Sect2>
%End
%If (Qt_3_0_0 -)
// These aren't part of the public API in the Qt3 beta, so define them as
// opaque for the moment.
class QTextDocument;
class QTextCursor;
class QTextEdit : QScrollView
{
%TypeHeaderCode
#include <qtextedit.h>
%End
public:
enum WordWrap {
NoWrap,
WidgetWidth,
FixedPixelWidth,
FixedColumnWidth
};
enum WrapPolicy {
AtWordBoundary,
Anywhere,
AtWhiteSpace,
%If (Qt_3_1_0 -)
AtWordOrDocumentBoundary
%End
};
%If (Qt_3_1_0 -)
enum AutoFormatting {
AutoNone,
AutoBulletList,
AutoAll
};
%End
enum KeyboardAction {
ActionBackspace,
ActionDelete,
ActionReturn,
ActionKill,
%If (Qt_3_1_0 -)
ActionWordBackspace,
ActionWordDelete
%End
};
enum CursorAction {
MoveBackward,
MoveForward,
MoveWordBackward,
MoveWordForward,
MoveUp,
MoveDown,
MoveLineStart,
MoveLineEnd,
MoveHome,
MoveEnd,
MovePgUp,
MovePgDown
};
enum VerticalAlignment {
AlignNormal,
AlignSuperScript,
AlignSubScript
};
%If (Qt_3_1_0 -)
enum TextInsertionFlags {
RedoIndentation,
CheckNewLines,
RemoveSelected
};
%End
QTextEdit(const QString &,const QString & = QString::null,
QWidget * /TransferThis/ = 0,const char * = 0);
QTextEdit(QWidget * /TransferThis/ = 0,const char * = 0);
void setPalette(const QPalette &);
QString text() const;
QString text(int) const;
TextFormat textFormat() const;
QString context() const;
QString documentTitle() const;
void getSelection(int *,int *,int *,int *,int = 0) const;
// We implement find() as two separate methods as it's the easiest way
// to handle the somewhat strange Qt interface.
virtual bool find(const QString &,bool,bool,bool = 1);
virtual bool find(const QString &,bool,bool,bool,int * /In,Out/,
int * /In,Out/);
int paragraphs() const;
int lines() const;
int linesOfParagraph(int) const;
int lineOfChar(int,int);
int length() const;
QRect paragraphRect(int) const;
int paragraphAt(const QPoint &) const;
// Note that this is handwritten code because the generated code would
// return the values in the (correct but) reverse order.
SIP_PYTUPLE charAt(const QPoint &) const;
%MethodCode
int para, index;
Py_BEGIN_ALLOW_THREADS
index = sipCpp -> QTextEdit::charAt(*a0,¶);
Py_END_ALLOW_THREADS
sipRes = sipBuildResult(&sipIsErr,"(ii)",para,index);
%End
int paragraphLength(int) const;
QStyleSheet *styleSheet() const;
QMimeSourceFactory *mimeSourceFactory() const;
QBrush paper() const;
bool linkUnderline() const;
int heightForWidth(int) const;
bool hasSelectedText() const;
QString selectedText() const;
bool isUndoAvailable() const;
bool isRedoAvailable() const;
WordWrap wordWrap() const;
int wrapColumnOrWidth() const;
WrapPolicy wrapPolicy() const;
int tabStopWidth() const;
QString anchorAt(const QPoint &);
%If (Qt_3_1_0 -)
QString anchorAt(const QPoint &,AnchorAttribute);
%End
QSize sizeHint() const;
bool isReadOnly() const;
void getCursorPosition(int *,int *) const;
bool isModified() const;
bool italic() const;
bool bold() const;
bool underline() const;
QString family() const;
int pointSize() const;
QColor color() const;
QFont font() const;
%If (Qt_3_1_0 -)
QFont currentFont() const;
%End
int alignment() const;
int undoDepth() const;
// These are undocumented and marked as "don't use".
//virtual bool getFormat(int,int,QFont *,QColor *,VerticalAlignment *);
//virtual bool getParagraphFormat(int,QFont *,QColor *,
// VerticalAlignment *,int *,
// QStyleSheetItem::DisplayMode *,
// QStyleSheetItem::ListStyle *,
// int *);
bool isOverwriteMode() const;
QColor paragraphBackgroundColor(int) const;
bool isUndoRedoEnabled() const;
bool eventFilter(QObject *,QEvent *);
%If (Qt_3_1_0 -)
bool tabChangesFocus() const;
// Qt defines the following as uint rather than int because it uses the
// AutoFormatting enum as a set of flags. Because SIP implements enums
// as a subclass of int they are always signed. AutoAll is defined as
// 0xffffffff which Python converts to -1 and then fails to convert it
// to an unsigned. For the moment we just lie to SIP about the type
// and let the compiler handle it.
void setAutoFormatting(int);
int autoFormatting() const;
%End
%If (Qt_3_3_0 -)
QSyntaxHighlighter *syntaxHighlighter() const;
%End
public slots:
void setEnabled(bool);
virtual void setMimeSourceFactory(QMimeSourceFactory *);
virtual void setStyleSheet(QStyleSheet *);
virtual void scrollToAnchor(const QString &);
virtual void setPaper(const QBrush &);
virtual void setLinkUnderline(bool);
virtual void setWordWrap(WordWrap);
virtual void setWrapColumnOrWidth(int);
virtual void setWrapPolicy(WrapPolicy);
virtual void copy();
virtual void append(const QString &);
void setText(const QString &);
virtual void setText(const QString &,const QString &);
virtual void setTextFormat(TextFormat);
virtual void selectAll(bool = 1);
virtual void setTabStopWidth(int);
virtual void zoomIn(int);
virtual void zoomIn();
virtual void zoomOut(int);
virtual void zoomOut();
virtual void zoomTo(int);
virtual void sync();
virtual void setReadOnly(bool);
virtual void undo();
virtual void redo();
virtual void cut();
virtual void paste();
virtual void pasteSubType(const QCString &);
virtual void clear();
virtual void del() /PyName=delChar/;
virtual void indent();
virtual void setItalic(bool);
virtual void setBold(bool);
virtual void setUnderline(bool);
virtual void setFamily(const QString &);
virtual void setPointSize(int);
virtual void setColor(const QColor &);
virtual void setFont(const QFont &);
virtual void setVerticalAlignment(VerticalAlignment);
virtual void setAlignment(int);
virtual void setParagType(QStyleSheetItem::DisplayMode,
QStyleSheetItem::ListStyle);
virtual void setCursorPosition(int,int);
virtual void setSelection(int,int,int,int,int = 0);
virtual void setSelectionAttributes(int,const QColor &,bool);
virtual void setModified(bool);
virtual void resetFormat();
virtual void setUndoDepth(int);
// Marked as internal in the Qt3 beta.
// virtual void setFormat(QTextFormat *,int);
virtual void ensureCursorVisible();
virtual void placeCursor(const QPoint &,QTextCursor * = 0);
virtual void moveCursor(CursorAction,bool);
virtual void doKeyboardAction(KeyboardAction);
virtual void removeSelectedText(int = 0);
virtual void removeSelection(int = 0);
virtual void setCurrentFont(const QFont &);
virtual void setOverwriteMode(bool);
virtual void scrollToBottom();
%If (Qt_3_1_0 -)
void insert(const QString &,uint = CheckNewLines | RemoveSelected);
virtual void insert(const QString &,bool,bool = 1,bool = 1);
%End
%If (- Qt_3_1_0)
virtual void insert(const QString &,bool = 0,bool = 1,bool = 1);
%End
virtual void insertAt(const QString &,int,int);
virtual void removeParagraph(int);
virtual void insertParagraph(const QString &,int);
virtual void setParagraphBackgroundColor(int,const QColor &);
virtual void clearParagraphBackground(int);
virtual void setUndoRedoEnabled(bool);
%If (Qt_3_1_0 -)
void setTabChangesFocus(bool);
void polish();
%End
%If (Qt_3_2_0 -)
void setMaxLogLines(int);
int maxLogLines();
%End
signals:
void textChanged();
void selectionChanged();
void copyAvailable(bool);
void undoAvailable(bool);
void redoAvailable(bool);
void currentFontChanged(const QFont &);
void currentColorChanged(const QColor &);
void currentAlignmentChanged(int);
void currentVerticalAlignmentChanged(VerticalAlignment);
void cursorPositionChanged(QTextCursor *);
void cursorPositionChanged(int,int);
void returnPressed();
void modificationChanged(bool);
%If (Qt_3_1_0 -)
void clicked(int,int);
void doubleClicked(int,int);
%End
protected:
void repaintChanged();
void updateStyles();
void drawContents(QPainter *,int,int,int,int);
bool event(QEvent *);
void keyPressEvent(QKeyEvent *);
void resizeEvent(QResizeEvent *);
void viewportResizeEvent(QResizeEvent *);
void contentsMousePressEvent(QMouseEvent *);
void contentsMouseMoveEvent(QMouseEvent *);
void contentsMouseReleaseEvent(QMouseEvent *);
void contentsMouseDoubleClickEvent(QMouseEvent *);
void contentsWheelEvent(QWheelEvent *);
void imStartEvent(QIMEvent *);
void imComposeEvent(QIMEvent *);
void imEndEvent(QIMEvent *);
void contentsDragEnterEvent(QDragEnterEvent *);
void contentsDragMoveEvent(QDragMoveEvent *);
void contentsDragLeaveEvent(QDragLeaveEvent *);
void contentsDropEvent(QDropEvent *);
void contentsContextMenuEvent(QContextMenuEvent *);
bool focusNextPrevChild(bool);
QTextDocument *document() const;
QTextCursor *textCursor() const;
void setDocument(QTextDocument *);
virtual QPopupMenu *createPopupMenu(const QPoint &) /Factory/;
virtual QPopupMenu *createPopupMenu() /Factory/;
void drawCursor(bool);
void windowActivationChange(bool);
protected slots:
virtual void doChangeInterval();
%If (Qt_3_1_0 -)
void sliderReleased();
%End
private:
%If (Qt_3_1_0 -)
QTextEdit(const QTextEdit &);
%End
};
%End
|