附录
文本编辑器代码
textedit.pro
TEMPLATE = app
TARGET = textedit
CONFIG +=qtwarn_o n
HEADERS = textedit.h
SOURCES = textedit.cpp
main .cpp
RESOURCES+= textedit.qrc build_all:!build_pass {
CONFIG -= build_all
CONFIG += release
}
# in stall
target.path= $$[QT_INSTALL_DEMOS]/textedit
*.docsources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html images
*.doc
sources.path= $$[QT_INSTALL_DEMOS]/textedit
INSTALLS += target sources
textedit.h
#ifndef TEXTEDIT』
#defi neTEXTEDIT_H
#i nclude QMai nWin dow
#in cludeQM ap
#in clude QPo in ter
QT_FORWARD_DECLARE_CLASS(QActio n)
QT_FORWARD_DECLARE_CLASS(QComboBox)
QT_FORWARD_DECLARE_CLASS(QFo ntComboBox)
QT_FORWARD_DECLARE_CLASS(QTextEdit)
QT_FORWARD_DECLARE_CLASS(QTextCharFormat)
QT_FORWARD_DECLARE_CLASS(QMe nu) classTextEdit: public QMainWindow
{
Q_OBJECT
public:
TextEdit(QWidget *pare nt = 0);
protected:
virtual void closeEvent(QCIoseEvente);
private:
void setupFileActions();
void setupEditActions();
void setupTextActions();
bool load(constQString f);
bool maybeSave();
void setCurrentFileName(consQString fileName);
private slots:
void fileNew();
void fileOpen();
bool fileSave();
bool fileSaveAs();
void filePrint();
void filePrintPreview();
void filePrintPdf();
void textBold();
void textUnderline();
void textItalic();
void textFamily(constQString f);
void textSize(constQString p);
void textStyle(intstylelndex);
void textColor();
void textAlign(QAction *a);
void currentCharFormatChanged(consQTextCharFormatformat);
void cursorPositi on Cha nged();
void clipboardDataChanged();
void about();
void printPreview(QPrinter*);
private:
void mergeFormatOnWordOrSelection(consQTextCharFormatformat);
void fontChanged(constQFontf);
void colorChanged(constQColor c);
void alignmentChanged(Qt::Alignmenta);
QActio n *acti on Save,
*act ion TextBold,
*act ion TextU nderl ine,
*act ion TextItalic,
*act ion TextColor,
*actio nAlig nLeft,
*actio nAlig nCen ter,
*act ion Alig nRight,
*act ion Alig nJ ustify,
*act ionUn do,
*act ion Redo,
*action Cut,
*act
您可能关注的文档
最近下载
- 部编版语文五年级下册第二单元教材解读大单元集体备课.pptx VIP
- 部编版语文五年级下册第一单元教材解读大单元集体备课.pptx VIP
- 车工 (数控车床)理论知识考核要素细目表四级.pdf VIP
- 本科课程《基础护理学》教案,第十二章给药.doc VIP
- 农村题材小品剧本村官.pdf VIP
- 小品剧本-小品《绰号》.docx VIP
- 小品剧本-小品《竞选》.docx VIP
- 本科课程基础护理学教给药教案(2025—2026学年).docx VIP
- LaserjetCP1025系列打印机打印质量故障排除手册.pdf VIP
- 年会小品剧本小品剧本:搞笑小品剧本《都是喝酒惹事》台词大全.docx VIP
原创力文档

文档评论(0)