mytextedit.h

来自「跨平台,多数据库查看编辑和查询工具,平台支持windows,linux,数据库支」· C头文件 代码 · 共 53 行

H
53
字号
#ifndef MYTEXTEDIT_H
#define MYTEXTEDIT_H

#include "highlighter.h"
#include <QTextEdit>

class MyTextEdit : public QTextEdit
{
    Q_OBJECT

public:
    MyTextEdit(QWidget *parent=0);

    void newFile();
    bool loadFile(const QString &fileName);
    bool save();
    bool saveAs();
    bool saveFile(const QString &fileName);
    QString userFriendlyCurrentFile();
    QString currentFile() { return curFile; }    bool maybeSave();
    void setCurrentFile(const QString &fileName);
    QString strippedName(const QString &fullFileName);
    QString getSql();
    void setLightLine(bool bLight=false);
public slots:
    void setupHighlight(bool b=true);

protected:
    void closeEvent(QCloseEvent *event);
    void paintEvent ( QPaintEvent * event ) ;
    void hideEvent ( QHideEvent * event );
    void showEvent ( QHideEvent * event );

signals:
    void onShow(bool bShow);
private slots:
    void documentWasModified();
    void MyCursorPositionChanged();       

private:
	  //void resizeEvent ( QResizeEvent * event ) ;
    QString curFile;
    bool isUntitled;
    bool bLightLine;
    Highlighter *highlighter;
    QTextCursor prevTextCursor;   
    QWidget *viewportWidget;
    
};

#endif

⌨️ 快捷键说明

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