⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 q3textedit.h

📁 奇趣公司比较新的qt/emd版本
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the Qt3Support module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef Q3TEXTEDIT_H#define Q3TEXTEDIT_H#include <Qt3Support/q3scrollview.h>#include <Qt3Support/q3stylesheet.h>#include <Qt3Support/q3mimefactory.h>#include <QtCore/qmap.h>QT_BEGIN_HEADERQT_MODULE(Qt3SupportLight)#ifndef QT_NO_TEXTEDIT// uncomment below to enable optimization mode - also uncomment the// optimDoAutoScroll() private slot since moc ignores #ifdefs..#define QT_TEXTEDIT_OPTIMIZATIONclass QPainter;class Q3TextDocument;class Q3TextCursor;class QKeyEvent;class QResizeEvent;class QMouseEvent;class QTimer;class Q3TextString;class QTextCommand;class Q3TextParagraph;class Q3TextFormat;class QFont;class QColor;class Q3TextEdit;class QTextBrowser;class Q3TextString;struct QUndoRedoInfoPrivate;class Q3PopupMenu;class Q3TextEditPrivate;class Q3SyntaxHighlighter;class Q3TextDrag;#ifdef QT_TEXTEDIT_OPTIMIZATIONclass Q3TextEditOptimPrivate{public:    // Note: no left-tag has any value for leftTag or parent, and    // no right-tag has any formatting flags set.    enum TagType { Color = 0, Format = 1 };    struct Tag {        TagType type:2;        bool bold:1;        bool italic:1;        bool underline:1;        int line;        int index;        Tag * leftTag; // ptr to left-tag in a left-right tag pair        Tag * parent;  // ptr to parent left-tag in a nested tag        Tag * prev;        Tag * next;        QString tag;    };    Q3TextEditOptimPrivate()    {        len = numLines = maxLineWidth = 0;        selStart.line = selStart.index = -1;        selEnd.line = selEnd.index = -1;        search.line = search.index = 0;        tags = lastTag = 0;    }    void clearTags()    {        Tag * itr = tags;        while (tags) {            itr  = tags;            tags = tags->next;            delete itr;        }        tags = lastTag = 0;        tagIndex.clear();    }    ~Q3TextEditOptimPrivate()    {        clearTags();    }    int len;    int numLines;    int maxLineWidth;    struct Selection {        int line;        int index;    };    Selection selStart, selEnd, search;    Tag * tags, * lastTag;    QMap<int, QString> lines;    QMap<int, Tag *> tagIndex;};#endifclass Q_COMPAT_EXPORT Q3TextEdit : public Q3ScrollView{    friend class Q3TextBrowser;    friend class Q3SyntaxHighlighter;    Q_OBJECT    Q_ENUMS(WordWrap WrapPolicy)    Q_FLAGS(AutoFormattingFlag)    Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)    Q_PROPERTY(QString text READ text WRITE setText)    Q_PROPERTY(QBrush paper READ paper WRITE setPaper)    Q_PROPERTY(bool linkUnderline READ linkUnderline WRITE setLinkUnderline)    Q_PROPERTY(QString documentTitle READ documentTitle)    Q_PROPERTY(int length READ length)    Q_PROPERTY(WordWrap wordWrap READ wordWrap WRITE setWordWrap)    Q_PROPERTY(int wrapColumnOrWidth READ wrapColumnOrWidth WRITE setWrapColumnOrWidth)    Q_PROPERTY(WrapPolicy wrapPolicy READ wrapPolicy WRITE setWrapPolicy)    Q_PROPERTY(bool hasSelectedText READ hasSelectedText)    Q_PROPERTY(QString selectedText READ selectedText)    Q_PROPERTY(int undoDepth READ undoDepth WRITE setUndoDepth)    Q_PROPERTY(bool overwriteMode READ isOverwriteMode WRITE setOverwriteMode)    Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false)    Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)    Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled)    Q_PROPERTY(int tabStopWidth READ tabStopWidth WRITE setTabStopWidth)    Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus)    Q_PROPERTY(AutoFormattingFlag autoFormatting READ autoFormatting WRITE setAutoFormatting)public:    enum WordWrap {        NoWrap,        WidgetWidth,        FixedPixelWidth,        FixedColumnWidth    };    enum WrapPolicy {        AtWordBoundary,        AtWhiteSpace = AtWordBoundary, // AtWhiteSpace is deprecated        Anywhere,        AtWordOrDocumentBoundary    };    enum AutoFormattingFlag {        AutoNone = 0,        AutoBulletList = 0x00000001,        AutoAll = 0xffffffff    };    Q_DECLARE_FLAGS(AutoFormatting, AutoFormattingFlag)    enum KeyboardAction {        ActionBackspace,        ActionDelete,        ActionReturn,        ActionKill,        ActionWordBackspace,        ActionWordDelete    };    enum CursorAction {        MoveBackward,        MoveForward,        MoveWordBackward,        MoveWordForward,        MoveUp,        MoveDown,        MoveLineStart,        MoveLineEnd,        MoveHome,        MoveEnd,        MovePgUp,        MovePgDown    };    enum VerticalAlignment {        AlignNormal,        AlignSuperScript,        AlignSubScript    };    enum TextInsertionFlags {        RedoIndentation = 0x0001,        CheckNewLines = 0x0002,        RemoveSelected = 0x0004    };    Q3TextEdit(const QString& text, const QString& context = QString(),               QWidget* parent=0, const char* name=0);    Q3TextEdit(QWidget* parent=0, const char* name=0);    virtual ~Q3TextEdit();    QString text() const;    QString text(int para) const;    Qt::TextFormat textFormat() const;    QString context() const;    QString documentTitle() const;    void getSelection(int *paraFrom, int *indexFrom,                    int *paraTo, int *indexTo, int selNum = 0) const;    virtual bool find(const QString &expr, bool cs, bool wo, bool forward = true,                       int *para = 0, int *index = 0);    int paragraphs() const;    int lines() const;    int linesOfParagraph(int para) const;    int lineOfChar(int para, int chr);    int length() const;    QRect paragraphRect(int para) const;    int paragraphAt(const QPoint &pos) const;    int charAt(const QPoint &pos, int *para) const;    int paragraphLength(int para) const;    Q3StyleSheet* styleSheet() const;#ifndef QT_NO_MIME    Q3MimeSourceFactory* mimeSourceFactory() const;#endif    QBrush paper() const;    bool linkUnderline() const;    int heightForWidth(int w) 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& pos, Qt::AnchorAttribute a = Qt::AnchorHref);    QSize sizeHint() const;    bool isReadOnly() const { return readonly; }    void getCursorPosition(int *parag, int *index) 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;    QFont currentFont() const;    int alignment() const;    VerticalAlignment verticalAlignment() const;    int undoDepth() const;    // do not use, will go away    virtual bool getFormat(int para, int index, QFont *font, QColor *color, VerticalAlignment *verticalAlignment);    // do not use, will go away    virtual bool getParagraphFormat(int para, QFont *font, QColor *color,                                     VerticalAlignment *verticalAlignment, int *alignment,                                     Q3StyleSheetItem::DisplayMode *displayMode,                                     Q3StyleSheetItem::ListStyle *listStyle,                                     int *listDepth);    bool isOverwriteMode() const { return overWrite; }    QColor paragraphBackgroundColor(int para) const;    bool isUndoRedoEnabled() const;    bool eventFilter(QObject *o, QEvent *e);    bool tabChangesFocus() const;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -