├── app.rc
├── app.ico
├── qt_zh_CN.qm
├── widgets.qm
├── auto_line.png
├── qm.qrc
├── images.qrc
├── README.md
├── aboutdialog.h
├── aboutdialog.cpp
├── gotodialog.h
├── finddialog.h
├── replacedialog.h
├── main.cpp
├── gotodialog.cpp
├── notepad.pro
├── finddialog.cpp
├── replacedialog.cpp
├── gotodialog.ui
├── aboutdialog.ui
├── mainwindow.h
├── replacedialog.ui
├── finddialog.ui
├── mainwindow.ui
├── mainwindow.cpp
└── notepad.pro.user
/app.rc:
--------------------------------------------------------------------------------
1 | IDI_ICON1 ICON DISCARDABLE "app.ico"
--------------------------------------------------------------------------------
/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/llf137224350/notepad/HEAD/app.ico
--------------------------------------------------------------------------------
/qt_zh_CN.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/llf137224350/notepad/HEAD/qt_zh_CN.qm
--------------------------------------------------------------------------------
/widgets.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/llf137224350/notepad/HEAD/widgets.qm
--------------------------------------------------------------------------------
/auto_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/llf137224350/notepad/HEAD/auto_line.png
--------------------------------------------------------------------------------
/qm.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | qt_zh_CN.qm
4 | widgets.qm
5 |
6 |
7 |
--------------------------------------------------------------------------------
/images.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | app.ico
4 | auto_line.png
5 |
6 |
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # - 说明
2 | 通过Qt实现windows下记事本下的所有功能,是用户在linux等平台上获得一致的操作体验。
3 | * 1.实现windows下记事本除开页面设置外的所有功能。
4 | * 2.支持拖拽文本进入窗口打开
5 | * 3.在windows下记事本的功能上增加实施字数统计功能
6 | * 4.提示文本是否已保存
7 | * 5.详情地址 https://bbs.deepin.org/forum.php?mod=viewthread&tid=142810&extra=
8 |
9 | # 注:由于开发环境在windows下,windows下一切正常,但在linux下运行时可能存在部分异常。
10 |
--------------------------------------------------------------------------------
/aboutdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef ABOUTNOTEPADDIALOG_H
2 | #define ABOUTNOTEPADDIALOG_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class AboutDialog;
8 | }
9 |
10 | class AboutDialog : public QDialog
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit AboutDialog(QWidget *parent = 0);
16 | ~AboutDialog();
17 |
18 | private slots:
19 | void on_okButton_clicked();
20 |
21 | private:
22 | Ui::AboutDialog *ui;
23 | };
24 |
25 | #endif // ABOUTDDIALOG_H
26 |
--------------------------------------------------------------------------------
/aboutdialog.cpp:
--------------------------------------------------------------------------------
1 | #include "aboutdialog.h"
2 | #include "ui_aboutdialog.h"
3 |
4 | AboutDialog::AboutDialog(QWidget *parent) :
5 | QDialog(parent),
6 | ui(new Ui::AboutDialog)
7 | {
8 | ui->setupUi(this);
9 | setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
10 | setWindowTitle("关于\"记事本\"");
11 |
12 | }
13 |
14 | AboutDialog::~AboutDialog()
15 | {
16 | delete ui;
17 | }
18 |
19 | void AboutDialog::on_okButton_clicked()
20 | {
21 | this->close();
22 | }
23 |
--------------------------------------------------------------------------------
/gotodialog.h:
--------------------------------------------------------------------------------
1 | #ifndef GOTODIALOG_H
2 | #define GOTODIALOG_H
3 |
4 | #include
5 | #include
6 |
7 | namespace Ui {
8 | class GoToDialog;
9 | }
10 |
11 | class GoToDialog : public QDialog
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit GoToDialog(QWidget *parent = 0);
17 | ~GoToDialog();
18 | signals:
19 | void goToLine(QString);
20 |
21 | private slots:
22 | void on_cancelButton_clicked();
23 |
24 | void on_okButton_clicked();
25 |
26 | private:
27 | Ui::GoToDialog *ui;
28 | void showMessage(QString title);
29 | };
30 |
31 | #endif // GOTODIALOG_H
32 |
--------------------------------------------------------------------------------
/finddialog.h:
--------------------------------------------------------------------------------
1 | #ifndef FINDDIALOG_H
2 | #define FINDDIALOG_H
3 |
4 | #include
5 | #include
6 |
7 | namespace Ui {
8 | class FindDialog;
9 | }
10 |
11 | class FindDialog : public QDialog
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit FindDialog(QWidget *parent = 0);
17 | ~FindDialog();
18 | signals:
19 | void find(QString,bool,bool);
20 | private slots:
21 | void on_pushButton_2_clicked();
22 |
23 | void on_findButton_clicked();
24 | //文本改变
25 | void textChangeSlot();
26 |
27 | private:
28 | Ui::FindDialog *ui;
29 | //显示消息
30 | void showMessage(QString title);
31 | };
32 |
33 | #endif // FINDDIALOG_H
34 |
--------------------------------------------------------------------------------
/replacedialog.h:
--------------------------------------------------------------------------------
1 | #ifndef REPLACEDIALOG_H
2 | #define REPLACEDIALOG_H
3 |
4 | #include
5 | #include
6 |
7 | namespace Ui {
8 | class ReplaceDialog;
9 | }
10 |
11 | class ReplaceDialog : public QDialog
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit ReplaceDialog(QWidget *parent = 0);
17 | ~ReplaceDialog();
18 | signals:
19 | void find(QString,bool);
20 | void replace(QString,QString,bool,bool);
21 | private slots:
22 | void on_cancelButton_clicked();
23 | //文本改变
24 | void textChangeSlot();
25 | void on_findButton_clicked();
26 |
27 | void on_replaceButton_clicked();
28 |
29 | void on_replaceAllButton_clicked();
30 |
31 | private:
32 | Ui::ReplaceDialog *ui;
33 |
34 | };
35 |
36 | #endif // REPLACEDIALOG_H
37 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | int main(int argc, char *argv[])
8 | {
9 | QApplication a(argc, argv);
10 | //设置编码为utf-8
11 | QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf-8"));
12 |
13 | //加载Qt标准对话框的中文翻译文件
14 | QTranslator translator;
15 | if (translator.load(QString(":/qt_zh_CN"))){
16 | a.installTranslator(&translator);
17 | }
18 | QTranslator translator1;
19 | if (translator1.load(QString(":/widgets"))){
20 | a.installTranslator(&translator1);
21 | }
22 | QSettings setting("config.ini",QSettings::IniFormat);//生成配置文件
23 | setting.beginGroup("config");//beginGroup与下面endGroup 相对应,“config”是标记
24 | if(setting.value("status_bar").isNull())
25 | setting.setValue("status_bar",QVariant("1"));
26 | if(setting.value("auto_go_line").isNull())
27 | setting.setValue("auto_go_line",QVariant("1"));
28 | setting.endGroup();
29 |
30 | MainWindow w;
31 | QDesktopWidget *desktop=QApplication::desktop();
32 | //居中显示
33 | w.move((desktop->width()-w.width())/2,(desktop->height()-w.height())/2);
34 | w.show();
35 | return a.exec();
36 | }
37 |
--------------------------------------------------------------------------------
/gotodialog.cpp:
--------------------------------------------------------------------------------
1 | #include "gotodialog.h"
2 | #include "ui_gotodialog.h"
3 |
4 | GoToDialog::GoToDialog(QWidget *parent) :
5 | QDialog(parent),
6 | ui(new Ui::GoToDialog)
7 | {
8 | ui->setupUi(this);
9 | setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
10 | setWindowTitle("转到指定行");
11 |
12 | }
13 |
14 | GoToDialog::~GoToDialog()
15 | {
16 | delete ui;
17 | }
18 |
19 | void GoToDialog::on_cancelButton_clicked()
20 | {
21 | this->close();
22 | }
23 |
24 | void GoToDialog::on_okButton_clicked()
25 | {
26 | QString value = ui->lineEdit->text().trimmed();
27 | if(value.isEmpty()){
28 | this->showMessage("请输入要跳到的行数");
29 | return;
30 | }
31 | QRegExp rx("(\\d+)");
32 | if(!rx.exactMatch(value)){
33 | this->showMessage("请输入正整数");
34 | return;
35 | }
36 | emit goToLine(value);
37 |
38 | }
39 | void GoToDialog::showMessage(QString title){
40 | QMessageBox box(QMessageBox::Question,"记事本 - 跳行",title);
41 | box.setIcon(QMessageBox::NoIcon);
42 | box.setStandardButtons (QMessageBox::Ok);
43 | box.setButtonText (QMessageBox::Ok,QString("确定"));
44 | box.setWindowFlags( Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint );
45 | box.exec();
46 | }
47 |
--------------------------------------------------------------------------------
/notepad.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2017-07-16T16:14:20
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui printsupport
8 |
9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10 |
11 | TARGET = notepad
12 | TEMPLATE = app
13 |
14 | # The following define makes your compiler emit warnings if you use
15 | # any feature of Qt which as been marked as deprecated (the exact warnings
16 | # depend on your compiler). Please consult the documentation of the
17 | # deprecated API in order to know how to port your code away from it.
18 | DEFINES += QT_DEPRECATED_WARNINGS
19 |
20 | # You can also make your code fail to compile if you use deprecated APIs.
21 | # In order to do so, uncomment the following line.
22 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
24 |
25 |
26 | SOURCES += \
27 | main.cpp \
28 | mainwindow.cpp \
29 | gotodialog.cpp \
30 | finddialog.cpp \
31 | replacedialog.cpp \
32 | aboutdialog.cpp
33 |
34 | HEADERS += \
35 | mainwindow.h \
36 | gotodialog.h \
37 | finddialog.h \
38 | replacedialog.h \
39 | aboutdialog.h
40 |
41 | FORMS += \
42 | mainwindow.ui \
43 | gotodialog.ui \
44 | finddialog.ui \
45 | replacedialog.ui \
46 | aboutdialog.ui
47 |
48 | RC_FILE = app.rc
49 |
50 | RESOURCES += \
51 | images.qrc \
52 | qm.qrc
53 |
--------------------------------------------------------------------------------
/finddialog.cpp:
--------------------------------------------------------------------------------
1 | #include "finddialog.h"
2 | #include "ui_finddialog.h"
3 |
4 | FindDialog::FindDialog(QWidget *parent) :
5 | QDialog(parent),
6 | ui(new Ui::FindDialog)
7 | {
8 | ui->setupUi(this);
9 | setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
10 | setWindowTitle("查找");
11 |
12 | connect(ui->lineEdit,SIGNAL(textChanged(QString)),this,SLOT(textChangeSlot()));
13 |
14 | ui->findButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
15 | ui->radioUpButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U));
16 | ui->radioDownButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
17 | ui->checkBox->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
18 |
19 | }
20 |
21 | FindDialog::~FindDialog()
22 | {
23 | delete ui;
24 | }
25 | void FindDialog::showMessage(QString title){
26 | QMessageBox box(QMessageBox::Question,"记事本 - 查找",title);
27 | box.setIcon(QMessageBox::NoIcon);
28 | box.setStandardButtons (QMessageBox::Ok);
29 | box.setButtonText (QMessageBox::Ok,QString("确定"));
30 | box.setWindowFlags( Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint );
31 | box.exec();
32 | }
33 |
34 | void FindDialog::on_pushButton_2_clicked()
35 | {
36 | this->close();
37 |
38 | }
39 |
40 | void FindDialog::on_findButton_clicked()
41 | {
42 | bool checkbox = ui->checkBox->isChecked();
43 | QString value = ui->lineEdit->text().trimmed();
44 | bool isUp = false;
45 | if(ui->radioUpButton->isChecked()){
46 | isUp = true;
47 | }
48 | if(value.isEmpty()){
49 | this->showMessage("请输入查找关键字");
50 | return;
51 | }
52 | //回调事件
53 | emit this->find(value,checkbox,isUp);
54 | }
55 |
56 | void FindDialog::textChangeSlot(){
57 | if(ui->lineEdit->text().trimmed().isEmpty()){
58 | ui->findButton->setEnabled(false);
59 | }else{
60 | ui->findButton->setEnabled(true);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/replacedialog.cpp:
--------------------------------------------------------------------------------
1 | #include "replacedialog.h"
2 | #include "ui_replacedialog.h"
3 |
4 | ReplaceDialog::ReplaceDialog(QWidget *parent) :
5 | QDialog(parent),
6 | ui(new Ui::ReplaceDialog)
7 | {
8 | ui->setupUi(this);
9 | setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
10 | setWindowTitle("替换");
11 |
12 | connect(ui->findEdit,SIGNAL(textChanged(QString)),this,SLOT(textChangeSlot()));
13 |
14 |
15 | ui->findButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
16 | ui->replaceButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
17 | ui->replaceAllButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
18 | ui->checkBox->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
19 | }
20 |
21 | ReplaceDialog::~ReplaceDialog()
22 | {
23 | delete ui;
24 | }
25 |
26 | void ReplaceDialog::on_cancelButton_clicked()
27 | {
28 | this->close();
29 | }
30 | //文本改变
31 | void ReplaceDialog::textChangeSlot(){
32 | if(ui->findEdit->text().trimmed().isEmpty()){
33 | ui->findButton->setEnabled(false);
34 | ui->replaceButton->setEnabled(false);
35 | ui->replaceAllButton->setEnabled(false);
36 | }else{
37 | ui->findButton->setEnabled(true);
38 | ui->replaceButton->setEnabled(true);
39 | ui->replaceAllButton->setEnabled(true);
40 | }
41 | }
42 |
43 | void ReplaceDialog::on_findButton_clicked()
44 | {
45 | bool checkbox = ui->checkBox->isChecked();
46 | QString value = ui->findEdit->text().trimmed();
47 | //回调事件
48 | emit this->find(value,checkbox);
49 | }
50 |
51 | void ReplaceDialog::on_replaceButton_clicked()
52 | {
53 | bool checkbox = ui->checkBox->isChecked();
54 | QString target = ui->findEdit->text().trimmed();
55 | QString value = ui->replaceEdit->text().trimmed();
56 | //回调事件
57 | emit this->replace(target,value,checkbox,false);
58 | }
59 |
60 | void ReplaceDialog::on_replaceAllButton_clicked()
61 | {
62 | bool checkbox = ui->checkBox->isChecked();
63 | QString target = ui->findEdit->text().trimmed();
64 | QString value = ui->replaceEdit->text().trimmed();
65 | //回调事件
66 | emit this->replace(target,value,checkbox,true);
67 | }
68 |
--------------------------------------------------------------------------------
/gotodialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | GoToDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 293
10 | 130
11 |
12 |
13 |
14 |
15 | 293
16 | 130
17 |
18 |
19 |
20 |
21 | 293
22 | 130
23 |
24 |
25 |
26 | Dialog
27 |
28 |
29 |
30 | :/app.ico
31 |
32 |
33 |
34 |
35 |
36 | 13
37 | 12
38 | 61
39 | 20
40 |
41 |
42 |
43 | 行号:
44 |
45 |
46 |
47 |
48 |
49 | 14
50 | 40
51 | 265
52 | 31
53 |
54 |
55 |
56 | 1
57 |
58 |
59 |
60 |
61 |
62 | 205
63 | 85
64 | 75
65 | 31
66 |
67 |
68 |
69 | 取消
70 |
71 |
72 |
73 |
74 |
75 | 120
76 | 85
77 | 75
78 | 31
79 |
80 |
81 |
82 |
83 | 0
84 | 23
85 |
86 |
87 |
88 | 确定
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/aboutdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | AboutDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 422
10 | 284
11 |
12 |
13 |
14 |
15 | 422
16 | 284
17 |
18 |
19 |
20 |
21 | 422
22 | 284
23 |
24 |
25 |
26 | Dialog
27 |
28 |
29 |
30 | :/app.ico:/app.ico
31 |
32 |
33 |
34 |
35 | 330
36 | 240
37 | 75
38 | 31
39 |
40 |
41 |
42 | 确定
43 |
44 |
45 |
46 |
47 |
48 | 0
49 | 0
50 | 421
51 | 91
52 |
53 |
54 |
55 | QFrame::NoFrame
56 |
57 |
58 | QFrame::Plain
59 |
60 |
61 | <html><head/><body><p><span style=" font-size:36pt; color:#0077c8;">记事本</span></p></body></html>
62 |
63 |
64 | Qt::AlignCenter
65 |
66 |
67 |
68 |
69 |
70 | 20
71 | 74
72 | 381
73 | 20
74 |
75 |
76 |
77 | QFrame::HLine
78 |
79 |
80 | QFrame::Raised
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | 20
90 | 110
91 | 381
92 | 101
93 |
94 |
95 |
96 | QFrame::Plain
97 |
98 |
99 | <html><head/><body><p>版本:V 1.0.0</p><p>软件借鉴了Windows下记事本简洁清晰的设计风格,保留了一致的用户体验。</p></body></html>
100 |
101 |
102 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
103 |
104 |
105 | true
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 | #include "QMessageBox"
6 | #include "QtDebug"
7 | #include "QTranslator"
8 | #include "QFileDialog"
9 | #include "QFile"
10 | #include "QDir"
11 | #include "QTextStream"
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include "aboutdialog.h"
26 | #include "gotodialog.h"
27 | #include "finddialog.h"
28 | #include "replacedialog.h"
29 |
30 | namespace Ui {
31 | class MainWindow;
32 | }
33 |
34 | class MainWindow : public QMainWindow
35 | {
36 | Q_OBJECT
37 |
38 | public:
39 | explicit MainWindow(QWidget *parent = 0);
40 | ~MainWindow();
41 |
42 | void replace(QString value, bool isChecked);
43 |
44 | private:
45 | Ui::MainWindow *ui;
46 | private slots:
47 | //新文件槽函数
48 | void newFileSolt();
49 | //退出软件槽函数
50 | void exitAppSlot();
51 | //打开文件槽函数
52 | void openFileSlot();
53 | //文本变化槽函数
54 | void textChangeSlot();
55 | //保存文件槽函数
56 | void saveFileSlot();
57 | //另存
58 | void saveOtherFileSlot();
59 | //打印
60 | void doPrintSlot();
61 | //编辑
62 | void editSolt();
63 | //撤销
64 | void undoSolt();
65 | //剪切
66 | void cutSolt();
67 | //复制
68 | void copySolt();
69 | //粘贴
70 | void pasteSolt();
71 | //删除
72 | void deleteSolt();
73 | //转到
74 | void goToSlot();
75 | //到某一行
76 | void goToLineSlot(QString line);
77 | //查找
78 | void findSlot();
79 | //查找下一个
80 | void findNextSlot();
81 | //查找
82 | void find(QString value,bool isChecked,bool isUp);
83 | //替换
84 | void replaceSlot();
85 | //查找 - 替换
86 | void findForReplaceSlot(QString value,bool isChecked);
87 | //替换或者全替换
88 | void doReplaceSlot(QString target,QString value,bool isChecked,bool isReplaceAll);
89 | //全选
90 | void selectAllSlot();
91 | //时间或者日期
92 | void timeOrDateSlot();
93 | //自动换行
94 | void autoLineSlot();
95 | //字体选择
96 | void fontChooseSlot();
97 | //光标变化
98 | void cursorChangeSlot();
99 | //状态栏
100 | void statusBarSlot();
101 | //帮助
102 | void helpSlot();
103 | //关于
104 | void aboutSlot();
105 |
106 |
107 |
108 | private:
109 | QString fileName;//文件路径
110 | QString fileContent;//读到的文件内容
111 | bool autoLine;//自动换行
112 | bool statusBar;//显示状态栏
113 | QLabel *change;//行和列
114 | GoToDialog goToDialot;//跳转对话框
115 | FindDialog findDialog;//查找
116 | ReplaceDialog replaceDialog;//替换
117 | bool isFirstFind;
118 | QSettings *setting;//配置文件
119 | //保存文本到文件
120 | void saveTextToFile();
121 | //读取文件
122 | void readFile();
123 | //显示提示消息
124 | void showMessage(QString);
125 | //拖动文件进入窗口
126 | void dragEnterEvent(QDragEnterEvent *e);
127 | //释放对方时,执行的操作
128 | void dropEvent(QDropEvent *e);
129 | //初始化一下参数
130 | void init();
131 | //关联信号和草
132 | void conn();
133 | //设置快捷键
134 | void setShortcut();
135 | //关闭事件
136 | void closeEvent(QCloseEvent *event);
137 | };
138 |
139 | #endif // MAINWINDOW_H
140 |
--------------------------------------------------------------------------------
/replacedialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | ReplaceDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 405
10 | 200
11 |
12 |
13 |
14 |
15 | 405
16 | 200
17 |
18 |
19 |
20 |
21 | 405
22 | 200
23 |
24 |
25 |
26 | Dialog
27 |
28 |
29 |
30 | :/app.ico
31 |
32 |
33 |
34 |
35 | false
36 |
37 |
38 |
39 | 304
40 | 10
41 | 91
42 | 31
43 |
44 |
45 |
46 | 查找下一个(F)
47 |
48 |
49 |
50 |
51 | false
52 |
53 |
54 |
55 | 304
56 | 50
57 | 91
58 | 31
59 |
60 |
61 |
62 | 替换(R)
63 |
64 |
65 |
66 |
67 | false
68 |
69 |
70 |
71 | 304
72 | 90
73 | 91
74 | 31
75 |
76 |
77 |
78 | 全部替换(A)
79 |
80 |
81 |
82 |
83 |
84 | 304
85 | 130
86 | 91
87 | 31
88 |
89 |
90 |
91 | 取消
92 |
93 |
94 |
95 |
96 |
97 | 10
98 | 20
99 | 54
100 | 12
101 |
102 |
103 |
104 | 查找内容:
105 |
106 |
107 |
108 |
109 |
110 | 70
111 | 9
112 | 221
113 | 31
114 |
115 |
116 |
117 |
118 |
119 |
120 | 10
121 | 61
122 | 54
123 | 12
124 |
125 |
126 |
127 | 替换为:
128 |
129 |
130 |
131 |
132 |
133 | 70
134 | 50
135 | 221
136 | 31
137 |
138 |
139 |
140 |
141 |
142 |
143 | 10
144 | 160
145 | 101
146 | 16
147 |
148 |
149 |
150 | 区分大小写(C)
151 |
152 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/finddialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | FindDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 415
10 | 132
11 |
12 |
13 |
14 |
15 | 415
16 | 132
17 |
18 |
19 |
20 |
21 | 415
22 | 132
23 |
24 |
25 |
26 | Dialog
27 |
28 |
29 |
30 | :/app.ico:/app.ico
31 |
32 |
33 |
34 |
35 | 10
36 | 20
37 | 54
38 | 12
39 |
40 |
41 |
42 | 查找内容
43 |
44 |
45 |
46 |
47 |
48 | 70
49 | 9
50 | 231
51 | 31
52 |
53 |
54 |
55 |
56 |
57 | false
58 |
59 |
60 |
61 | 314
62 | 10
63 | 91
64 | 31
65 |
66 |
67 |
68 | 查找下一个(N)
69 |
70 |
71 | false
72 |
73 |
74 |
75 |
76 |
77 | 314
78 | 50
79 | 91
80 | 31
81 |
82 |
83 |
84 | 取消
85 |
86 |
87 |
88 |
89 |
90 | 10
91 | 93
92 | 101
93 | 16
94 |
95 |
96 |
97 | 区分大小写(C)
98 |
99 |
100 |
101 |
102 |
103 | 140
104 | 60
105 | 161
106 | 61
107 |
108 |
109 |
110 | 方向
111 |
112 |
113 |
114 |
115 | 0
116 | 20
117 | 168
118 | 41
119 |
120 |
121 |
122 | -
123 |
124 |
125 | Qt::Horizontal
126 |
127 |
128 |
129 | 40
130 | 20
131 |
132 |
133 |
134 |
135 | -
136 |
137 |
138 | Qt::Horizontal
139 |
140 |
141 |
142 | 40
143 | 20
144 |
145 |
146 |
147 |
148 | -
149 |
150 |
151 | 向上(U)
152 |
153 |
154 |
155 | -
156 |
157 |
158 | Qt::Horizontal
159 |
160 |
161 |
162 | 40
163 | 20
164 |
165 |
166 |
167 |
168 | -
169 |
170 |
171 | 向下(D)
172 |
173 |
174 | true
175 |
176 |
177 |
178 | -
179 |
180 |
181 | Qt::Horizontal
182 |
183 |
184 |
185 | 40
186 | 20
187 |
188 |
189 |
190 |
191 | -
192 |
193 |
194 | Qt::Horizontal
195 |
196 |
197 |
198 | 40
199 | 20
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
--------------------------------------------------------------------------------
/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 1038
10 | 712
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 | :/app.ico:/app.ico
19 |
20 |
21 |
22 |
23 | 0
24 |
25 |
26 | 0
27 |
28 |
29 | 0
30 |
31 |
32 | 0
33 |
34 |
35 | 0
36 |
37 | -
38 |
39 |
40 |
41 |
42 |
43 | QFrame::NoFrame
44 |
45 |
46 | QTextEdit::WidgetWidth
47 |
48 |
49 |
50 |
51 |
52 |
120 |
121 |
122 | gdf g
123 |
124 |
125 |
126 |
127 | 新建(&N)
128 |
129 |
130 |
131 |
132 | 打开(&O)
133 |
134 |
135 |
136 |
137 | 保存(&S)
138 |
139 |
140 |
141 |
142 | 另存为(&A)
143 |
144 |
145 |
146 |
147 | 页面设置(&U)
148 |
149 |
150 |
151 |
152 | 打印(&P)
153 |
154 |
155 |
156 |
157 | 退出(&X)
158 |
159 |
160 |
161 |
162 | 撤销(&U)
163 |
164 |
165 |
166 |
167 | 剪切(&T)
168 |
169 |
170 |
171 |
172 | 复制(&C)
173 |
174 |
175 |
176 |
177 | 粘贴(&P)
178 |
179 |
180 |
181 |
182 | 删除(&L)
183 |
184 |
185 |
186 |
187 | 查找(&F)
188 |
189 |
190 |
191 |
192 | 查找下一个(&N)
193 |
194 |
195 |
196 |
197 | 替换(&R)
198 |
199 |
200 |
201 |
202 | 转到(&G)
203 |
204 |
205 |
206 |
207 | 全选(&A)
208 |
209 |
210 |
211 |
212 | 时间/日期(&D)
213 |
214 |
215 |
216 |
217 |
218 | :/iamges/auto_line.png
219 | :/auto_line.png:/iamges/auto_line.png
220 |
221 |
222 | 自动换行(&W)
223 |
224 |
225 |
226 |
227 | 字体(&F)
228 |
229 |
230 |
231 |
232 |
233 | :/iamges/auto_line.png
234 | :/auto_line.png:/iamges/auto_line.png
235 |
236 |
237 |
238 | 状态栏(&S)
239 |
240 |
241 |
242 |
243 | 查看帮助(&H)
244 |
245 |
246 |
247 |
248 | 关于记事本(&A)
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
--------------------------------------------------------------------------------
/mainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include "ui_mainwindow.h"
3 |
4 |
5 | MainWindow::MainWindow(QWidget *parent) :
6 | QMainWindow(parent),
7 | ui(new Ui::MainWindow)
8 | {
9 | ui->setupUi(this);
10 |
11 | this->init(); //进行初始化
12 |
13 | this->conn(); //连接信号与槽
14 |
15 | this->setShortcut(); //设置快捷键
16 |
17 | //是否传入了文件路径
18 | QStringList arguments = QCoreApplication::arguments();
19 | if(arguments.length() > 1){
20 | fileName = arguments[1];
21 | this->readFile();
22 | }
23 |
24 | }
25 |
26 | MainWindow::~MainWindow()
27 | {
28 | delete ui;
29 | }
30 | //初始化一下参数
31 | void MainWindow::init(){
32 | this->setWindowTitle("无标题 - 记事本");
33 | setting = new QSettings("config.ini",QSettings::IniFormat);
34 | //初始化默认值
35 | autoLine = true;//是否自动换行
36 | statusBar = true;//是否显示状态栏
37 | isFirstFind = true;//是否第一次搜索 替换时用
38 | ui->textEdit->setAcceptDrops(false); //设置文本输入框不接受鼠标放下
39 | this->setAcceptDrops(true); //设置窗口接受鼠标放下
40 |
41 | setting->beginGroup("config");//beginGroup与下面endGroup 相对应,“config”是标记
42 | QString family =setting->value("family").toString();
43 | if(!family.isEmpty()){//设置了字体
44 | QFont font;
45 | font.setFamily(family);
46 | font.setPointSize(setting->value("point_size").toInt());
47 | font.setItalic(setting->value("italic").toBool());
48 | font.setBold(setting->value("bold").toBool());
49 | font.setOverline(setting->value("overline").toBool());
50 | font.setUnderline(setting->value("underline").toBool());
51 | ui->textEdit->setFont(font);
52 | }
53 | statusBar = setting->value("status_bar").toInt() == 1?true : false;//获取存储的值
54 | autoLine = setting->value("auto_go_line").toInt() == 1?true : false;
55 | setting->endGroup();
56 |
57 | //设置是否显示状态栏
58 | ui->statusBar->setVisible(statusBar);
59 | //是否显示显示状态栏勾中图标
60 | ui->actionStatusBar->setIconVisibleInMenu(statusBar);
61 | //设置QTextEdit自动换行
62 | ui->actionAutoLine->setIconVisibleInMenu(autoLine);
63 | if(autoLine){
64 | ui->textEdit->setLineWrapMode(QTextEdit::WidgetWidth);
65 | }else{
66 | ui->textEdit->setLineWrapMode(QTextEdit::NoWrap);
67 | }
68 | //设置状态栏
69 | ui->statusBar->setStyleSheet(QString("QStatusBar::item{border: 0px}")); // 设置不显示label的边框
70 | ui->statusBar->setSizeGripEnabled(false); //设置是否显示右边的大小控制点
71 | change = new QLabel("第 1 行,第 1 列 字数 0 ", this);
72 | ui->statusBar->addPermanentWidget(change); //显示永久信息
73 | //查找和查找下一个不可用
74 | ui->actionFind->setEnabled(false);
75 | ui->actionFindNext->setEnabled(false);
76 | ui->actionRevoke->setEnabled(false);
77 |
78 | }
79 | //关联信号和草
80 | void MainWindow::conn(){
81 | //添加处理 文件
82 | connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newFileSolt()));
83 | connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(exitAppSlot()));
84 | connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(openFileSlot()));
85 | connect(ui->textEdit,SIGNAL(textChanged()),this,SLOT(textChangeSlot()));
86 | connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(saveFileSlot()));
87 | connect(ui->actionOtherSave,SIGNAL(triggered()),this,SLOT(saveOtherFileSlot()));
88 | connect(ui->actionPrint,SIGNAL(triggered()),this,SLOT(doPrintSlot()));
89 | //添加处理 编辑
90 | connect(ui->menuEdit,SIGNAL(aboutToShow()),this,SLOT(editSolt()));
91 | connect(ui->actionRevoke,SIGNAL(triggered()),this,SLOT(undoSolt()));
92 | connect(ui->actionCut,SIGNAL(triggered()),this,SLOT(cutSolt()));
93 | connect(ui->actionCopy,SIGNAL(triggered()),this,SLOT(copySolt()));
94 | connect(ui->actionPaste,SIGNAL(triggered()),this,SLOT(pasteSolt()));
95 | connect(ui->actionDelete,SIGNAL(triggered()),this,SLOT(deleteSolt()));
96 |
97 | connect(ui->actionGoTO,SIGNAL(triggered()),this,SLOT(goToSlot()));
98 | connect(&goToDialot, SIGNAL(goToLine(QString)), this,SLOT(goToLineSlot(QString)));
99 | connect(ui->actionFind,SIGNAL(triggered()),this,SLOT(findSlot()));
100 | connect(&findDialog, SIGNAL(find(QString,bool,bool)), this,SLOT(find(QString,bool,bool)));
101 | connect(ui->actionFindNext,SIGNAL(triggered()),this,SLOT(findNextSlot()));
102 | connect(ui->actionReplace,SIGNAL(triggered()),this,SLOT(replaceSlot()));
103 | connect(&replaceDialog, SIGNAL(find(QString,bool)), this,SLOT(findForReplaceSlot(QString,bool)));
104 | connect(&replaceDialog, SIGNAL(replace(QString,QString,bool,bool)), this,SLOT(doReplaceSlot(QString,QString,bool,bool)));
105 |
106 | connect(ui->actionTimeOrDate,SIGNAL(triggered()),this,SLOT(timeOrDateSlot()));
107 | connect(ui->actionSelectAll,SIGNAL(triggered()),this,SLOT(selectAllSlot()));
108 |
109 | //格式
110 | connect(ui->actionAutoLine,SIGNAL(triggered()),this,SLOT(autoLineSlot()));
111 | connect(ui->actionFont,SIGNAL(triggered()),this,SLOT(fontChooseSlot()));
112 | connect(ui->textEdit,SIGNAL(cursorPositionChanged()),this,SLOT(cursorChangeSlot()));
113 | //查看
114 | connect(ui->actionStatusBar,SIGNAL(triggered()),this,SLOT(statusBarSlot()));
115 | //帮助
116 | connect(ui->actionHelp,SIGNAL(triggered()),this,SLOT(helpSlot()));
117 | connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(aboutSlot()));
118 |
119 | }
120 | //设置快捷键
121 | void MainWindow::setShortcut(){
122 | //快捷键
123 | ui->actionNew->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
124 | ui->actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
125 | ui->actionSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
126 | ui->actionOtherSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
127 | ui->actionPrint->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
128 |
129 | ui->actionRevoke->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
130 | ui->actionCut->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
131 | ui->actionCopy->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
132 | ui->actionPaste->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
133 | ui->actionFind->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
134 | ui->actionFindNext->setShortcut(QKeySequence(Qt::Key_F3));
135 | ui->actionReplace->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
136 | ui->actionDelete->setShortcut(QKeySequence(Qt::Key_Delete));
137 | ui->actionGoTO->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
138 | ui->actionSelectAll->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
139 | ui->actionTimeOrDate->setShortcut(QKeySequence(Qt::Key_F5));
140 | }
141 |
142 | //新建文件槽函数
143 | void MainWindow::newFileSolt(){
144 | //文档已经修改
145 | if(ui->textEdit->document()->isModified()&& !ui->textEdit->document()->isEmpty() && fileContent != ui->textEdit->document()->toPlainText()){
146 | QMessageBox box(QMessageBox::Question,"记事本","是否将更改保存到 无标题");
147 | box.setIcon(QMessageBox::NoIcon);
148 | box.setStandardButtons (QMessageBox::Ok|QMessageBox::Ignore|QMessageBox::Cancel);
149 | box.setButtonText (QMessageBox::Ok,QString("保存"));
150 | box.setButtonText (QMessageBox::Ignore,QString("不保存"));
151 | box.setButtonText (QMessageBox::Cancel,QString("取消"));
152 | int result = box.exec();
153 | if(result == QMessageBox::Ok){
154 | if(fileName.isEmpty()){//新建
155 | //弹出保存文件对话框
156 | fileName = QFileDialog::getSaveFileName(this, tr("打开文件"),QDir::homePath(),tr("文本文件 (*.*);;"));
157 | if(!fileName.isEmpty()){
158 | //保存文件
159 | this->saveTextToFile();
160 | }
161 | }else{//读取的文本
162 | this->saveTextToFile();
163 | }
164 | ui->textEdit->clear();
165 | setWindowTitle("无标题 - 记事本");
166 | }else if(result == QMessageBox::Ignore){
167 | //不保存
168 | ui->textEdit->clear();
169 | setWindowTitle("无标题 - 记事本");
170 | ui->statusBar->showMessage("");
171 | }
172 | }else{
173 | //文档未修改
174 | ui->textEdit->clear();
175 | setWindowTitle("无标题 - 记事本");
176 | }
177 | //路径置空
178 | fileName = "";
179 | }
180 |
181 | //退出应用槽函数
182 | void MainWindow::exitAppSlot(){
183 | //文档已经修改
184 | if(ui->textEdit->document()->isModified()&& !ui->textEdit->document()->isEmpty() && fileContent != ui->textEdit->document()->toPlainText()){
185 | QMessageBox box(QMessageBox::Question,"记事本","是否将更改保存到 无标题");
186 | box.setIcon(QMessageBox::NoIcon);
187 | box.setStandardButtons (QMessageBox::Ok|QMessageBox::Ignore|QMessageBox::Cancel);
188 | box.setButtonText (QMessageBox::Ok,QString("保存"));
189 | box.setButtonText (QMessageBox::Ignore,QString("不保存"));
190 | box.setButtonText (QMessageBox::Cancel,QString("取消"));
191 | int result = box.exec();
192 | if(result == QMessageBox::Ok){
193 | if(fileName.isEmpty()){//新建
194 | //弹出保存文件对话框
195 | fileName = QFileDialog::getSaveFileName(this, tr("打开文件"),QDir::homePath(),tr("文本文件 (*.*);;"));
196 | if(!fileName.isEmpty()){
197 | //保存文件
198 | this->saveTextToFile();
199 | }
200 | }else{//读取的文本
201 | this->saveTextToFile();
202 | }
203 |
204 | }else if(result == QMessageBox::Ignore){
205 | //不保存 关闭
206 | this->close();
207 | }
208 | }else{
209 | this->close();
210 | }
211 | }
212 | //另存文件槽函数
213 | void MainWindow::saveOtherFileSlot(){
214 | //弹出保存文件对话框
215 | fileName = QFileDialog::getSaveFileName(this, tr("打开文件"),QDir::homePath(),tr("文本文件 (*.*);;"));
216 | if(!fileName.isEmpty()){
217 | //保存文件
218 | this->saveTextToFile();
219 | }
220 | }
221 | //保存文件槽函数
222 | void MainWindow::saveFileSlot(){
223 | //判断是新建还是读取的文本
224 | if(fileName.isEmpty()){//新建
225 | //弹出保存文件对话框
226 | fileName = QFileDialog::getSaveFileName(this, tr("打开文件"),QDir::homePath(),tr("文本文件 (*.*);;"));
227 | if(!fileName.isEmpty()){
228 | //保存文件
229 | this->saveTextToFile();
230 | }
231 | }else{//读取的文本
232 | this->saveTextToFile();
233 | }
234 | }
235 | //保存文件
236 | void MainWindow::saveTextToFile(){
237 | QFile file(fileName);
238 | if (file.open(QIODevice::WriteOnly)){
239 | QTextStream out(&file);
240 | out << ui->textEdit->document()->toPlainText();
241 | file.close();
242 | this->setWindowTitle(fileName.mid(fileName.lastIndexOf('/')+1)+" - 记事本");
243 | fileContent = ui->textEdit->document()->toPlainText();
244 | ui->statusBar->showMessage("已保存",3000);
245 | }else{
246 | QMessageBox box(QMessageBox::Question,"提示","保存文件失败!");
247 | box.setIcon(QMessageBox::Warning);
248 | box.setStandardButtons (QMessageBox::Ok);
249 | box.setButtonText (QMessageBox::Ok,QString("确定"));
250 | box.exec();
251 | }
252 |
253 | }
254 | //打开文件槽函数
255 | void MainWindow::openFileSlot(){
256 | //文档已经修改
257 | if(ui->textEdit->document()->isModified() && !ui->textEdit->document()->isEmpty() && fileContent != ui->textEdit->document()->toPlainText()){
258 | QMessageBox box(QMessageBox::Question,"记事本","是否将更改保存到 无标题");
259 | box.setIcon(QMessageBox::NoIcon);
260 | box.setStandardButtons (QMessageBox::Ok|QMessageBox::Ignore|QMessageBox::Cancel);
261 | box.setButtonText (QMessageBox::Ok,QString("保存"));
262 | box.setButtonText (QMessageBox::Ignore,QString("不保存"));
263 | box.setButtonText (QMessageBox::Cancel,QString("取消"));
264 | int result = box.exec();
265 | if(result == QMessageBox::Ok){
266 | //保存文件
267 | this->saveTextToFile();
268 | }else if(result == QMessageBox::Ignore){
269 | //不保存
270 | //打开文件
271 | fileName = QFileDialog::getOpenFileName(this, tr("打开文件"),QDir::homePath(),tr("文本文件 (*.*);;"));
272 | this->readFile();
273 | }
274 | }else{
275 | fileName = QFileDialog::getOpenFileName(this, tr("打开文件"),QDir::homePath(),tr("文本文件 (*.*);;"));
276 | this->readFile();
277 | }
278 | }
279 | //真正打开文件
280 | void MainWindow::readFile(){
281 |
282 | //得到路径不为空
283 | if(!fileName.isEmpty()){
284 | QFile *file = new QFile;
285 | file->setFileName(fileName);
286 |
287 | bool isOpen = file->open(QIODevice::ReadOnly);
288 | if(isOpen){
289 | ui->textEdit->clear();
290 | QTextStream in(file);
291 |
292 | while (!in.atEnd()) {
293 | ui->textEdit->append(in.readLine());
294 | //光标移动到开始位置
295 | ui->textEdit->moveCursor(QTextCursor::Start);
296 | }
297 | //已读完
298 | fileContent = ui->textEdit->document()->toPlainText();
299 |
300 | if(fileName.lastIndexOf("\\") != -1){
301 | //设置标题
302 | this->setWindowTitle(fileName.mid(fileName.lastIndexOf('\\')+1)+" - 记事本");
303 | }else{
304 | //设置标题
305 | this->setWindowTitle(fileName.mid(fileName.lastIndexOf('/')+1)+" - 记事本");
306 | }
307 |
308 | file->close();
309 | ui->statusBar->showMessage("");
310 | }else{
311 | QMessageBox box(QMessageBox::Question,"提示","打开文件失败!");
312 | box.setIcon(QMessageBox::Warning);
313 | box.setStandardButtons (QMessageBox::Ok);
314 | box.setButtonText (QMessageBox::Ok,QString("确定"));
315 | box.exec();
316 | }
317 | }
318 | }
319 | //文本 变化槽函数
320 | void MainWindow::textChangeSlot(){
321 | ui->statusBar->showMessage("");
322 | if(ui->textEdit->document()->isEmpty()){
323 | if(fileName.isEmpty()){//没有保存到文件
324 | this->setWindowTitle("无标题 - 记事本");
325 |
326 | }else{//有文件
327 | this->setWindowTitle(fileName.mid(fileName.lastIndexOf('/')+1)+" - 记事本 *");
328 | if( fileContent != ui->textEdit->document()->toPlainText())
329 | ui->statusBar->showMessage("未保存");
330 | }
331 | }else if(ui->textEdit->document()->isModified()){
332 | if(fileName.isEmpty()){//没有保存到文件
333 | this->setWindowTitle("无标题 - 记事本 *");
334 | if( fileContent != ui->textEdit->document()->toPlainText())
335 | ui->statusBar->showMessage("未保存");
336 | }else{//有文件
337 | this->setWindowTitle(fileName.mid(fileName.lastIndexOf('/')+1)+" - 记事本 *");
338 | if( fileContent != ui->textEdit->document()->toPlainText())
339 | ui->statusBar->showMessage("未保存");
340 | }
341 | if(fileContent == ui->textEdit->document()->toPlainText()){
342 | this->setWindowTitle(fileName.mid(fileName.lastIndexOf('/')+1)+" - 记事本");
343 | }
344 | }
345 | if(ui->textEdit->document()->isEmpty()){
346 | ui->actionFind->setEnabled(false);
347 | ui->actionFindNext->setEnabled(false);
348 | }else{
349 | ui->actionFind->setEnabled(true);
350 | ui->actionFindNext->setEnabled(true);
351 | }
352 | //撤销可用
353 | ui->actionRevoke->setEnabled(true);
354 | }
355 |
356 | // 打印槽函数
357 | void MainWindow::doPrintSlot()
358 | {
359 | // 创建打印机对象
360 | QPrinter printer;
361 | // 创建打印对话框
362 | QPrintDialog dlg(&printer, this);
363 | //如果编辑器中有选中区域,则打印选中区域
364 | if (ui->textEdit->textCursor().hasSelection())
365 | dlg.addEnabledOption(QAbstractPrintDialog::PrintSelection);
366 | // 如果在对话框中按下了打印按钮,则执行打印操作
367 | if (dlg.exec() == QDialog::Accepted) {
368 | ui->textEdit->print(&printer);
369 | }
370 | }
371 | // 撤销槽函数
372 | void MainWindow::editSolt()
373 | {
374 | QTextCursor cursor= ui->textEdit->textCursor();
375 | if(cursor.hasSelection()){
376 | //剪切复制删除可用
377 | ui->actionCut->setEnabled(true);
378 | ui->actionCopy->setEnabled(true);
379 | ui->actionDelete->setEnabled(true);
380 |
381 | }else{
382 | //剪切复制删除不可用
383 | ui->actionCut->setEnabled(false);
384 | ui->actionCopy->setEnabled(false);
385 | ui->actionDelete->setEnabled(false);
386 |
387 | }
388 | }
389 | // 撤销槽函数
390 | void MainWindow::undoSolt()
391 | {
392 | ui->textEdit->undo();
393 | }
394 | //剪切
395 | void MainWindow::cutSolt()
396 | {
397 | ui->textEdit->cut();
398 | }
399 | //复制
400 | void MainWindow::copySolt()
401 | {
402 | ui->textEdit->copy();
403 | }
404 | //粘贴
405 | void MainWindow::pasteSolt()
406 | {
407 | ui->textEdit->paste();
408 | }
409 | //删除
410 | void MainWindow::deleteSolt()
411 | {
412 | QTextCursor cursor= ui->textEdit->textCursor();
413 | if(cursor.hasSelection()){
414 | cursor.deleteChar();
415 | }
416 | }
417 | //全选
418 | void MainWindow::selectAllSlot()
419 | {
420 | ui->textEdit->selectAll();
421 | }
422 | //时间和日期
423 | void MainWindow::timeOrDateSlot()
424 | {
425 | QDateTime time = QDateTime::currentDateTime();//获取系统现在的时间
426 | ui->textEdit->append(time.toString("hh:mm yyyy-MM-dd"));
427 | }
428 | //自动换行
429 | void MainWindow::autoLineSlot(){
430 | if(autoLine){
431 | ui->textEdit->setLineWrapMode(QTextEdit::NoWrap);
432 | autoLine = false;
433 |
434 | }else{
435 | ui->textEdit->setLineWrapMode(QTextEdit::WidgetWidth);
436 | autoLine = true;
437 | }
438 | ui->actionAutoLine->setIconVisibleInMenu(autoLine);
439 |
440 | setting->beginGroup("config");//beginGroup与下面endGroup 相对应,“config”是标记
441 | setting->setValue("auto_go_line",QVariant(autoLine?"1":"0"));
442 | setting->endGroup();
443 | }
444 | //字体选择对话框
445 | void MainWindow::fontChooseSlot(){
446 | QFont textFont= ui->textEdit->font();
447 | bool ok;
448 | QFont font = QFontDialog::getFont(&ok, textFont,this,tr("字体选择"));
449 | if (ok) {
450 | ui->textEdit->setFont(font);
451 |
452 | setting->beginGroup("config");//beginGroup与下面endGroup 相对应,“config”是标记
453 | setting->setValue("family",QVariant(font.family()));
454 | setting->setValue("point_size",QVariant(font.pointSize()));
455 | setting->setValue("italic",QVariant(font.italic() == true ?"1":"0"));
456 | setting->setValue("bold",QVariant(font.bold()== true ?"1":"0"));
457 | setting->setValue("overline",QVariant(font.overline()== true ?"1":"0"));
458 | setting->setValue("underline",QVariant(font.underline()== true ?"1":"0"));
459 | setting->endGroup();
460 | }
461 |
462 | }
463 | //光标变化
464 | void MainWindow::cursorChangeSlot(){
465 | QTextCursor cursor = ui->textEdit->textCursor();
466 | int column = cursor.columnNumber()+1;
467 | int block = cursor.blockNumber()+1;
468 | int count = ui->textEdit->document()->toPlainText().length();
469 | change->setText("第 "+QString::number(block)+" 行,第 "+QString::number(column)+" 列 字数 "+QString::number(count)+" ");
470 | }
471 | //状态栏
472 | void MainWindow::statusBarSlot(){
473 |
474 | statusBar = !statusBar;
475 | ui->actionStatusBar->setIconVisibleInMenu(statusBar);
476 | ui->statusBar->setVisible(statusBar);
477 |
478 | setting->beginGroup("config");//beginGroup与下面endGroup 相对应,“config”是标记
479 | setting->setValue("status_bar",QVariant(statusBar?"1":"0"));
480 | setting->endGroup();
481 | }
482 | //关于记事本
483 | void MainWindow::aboutSlot(){
484 | AboutDialog aboutDialog;
485 |
486 | aboutDialog.exec();
487 | }
488 | //跳转
489 | void MainWindow::goToSlot(){
490 |
491 | goToDialot.exec();
492 | }
493 | void MainWindow::goToLineSlot(QString line){
494 | QTextCursor cursor = ui->textEdit->textCursor();
495 | if(line.toInt() > cursor.blockNumber()+1){
496 | QMessageBox box(QMessageBox::Question,"记事本 - 跳行","行数超过了总行数");
497 | box.setIcon(QMessageBox::NoIcon);
498 | box.setStandardButtons (QMessageBox::Ok);
499 | box.setButtonText (QMessageBox::Ok,QString("确定"));
500 | box.setWindowFlags( Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint );
501 | box.exec();
502 | return;
503 | }
504 | goToDialot.close();
505 | int position = ui->textEdit->document()->findBlockByLineNumber(line.toInt()-1 ).position();
506 | cursor.setPosition(position,QTextCursor::MoveAnchor);
507 | ui->textEdit->setTextCursor( cursor );
508 | }
509 | //帮助
510 | void MainWindow::helpSlot(){
511 | QDesktopServices::openUrl(QUrl("https://go.microsoft.com/fwlink/?LinkId=834783"));
512 | }
513 | //查找槽函数
514 | void MainWindow::findSlot(){
515 | ui->textEdit->moveCursor(QTextCursor::Start);
516 | findDialog.exec();
517 | }
518 | //查找槽函数
519 | void MainWindow::findNextSlot(){
520 | QTextCursor tc= ui->textEdit->textCursor();
521 | if(tc.selectedText().isEmpty()){
522 | findDialog.exec();
523 | }else{
524 | find(tc.selectedText(),false,false);
525 | }
526 | }
527 | //查找
528 | void MainWindow::find(QString value,bool isChecked,bool isUp){
529 | if(isUp){
530 | if(!isChecked){
531 | if(!ui->textEdit->find(value,QTextDocument::FindBackward)){
532 | showMessage("找不到\""+value+"\"");
533 | }
534 | }else{
535 | if(!ui->textEdit->find(value,QTextDocument::FindBackward|QTextDocument::FindCaseSensitively)){
536 | showMessage("找不到\""+value+"\"");
537 | }
538 | }
539 | }else{
540 | if(!isChecked){
541 | if(!ui->textEdit->find(value)){
542 | showMessage("找不到\""+value+"\"");
543 | }
544 | }else{
545 | if(!ui->textEdit->find(value,QTextDocument::FindCaseSensitively)){
546 | showMessage("找不到\""+value+"\"");
547 | }
548 | }
549 | }
550 | QPalette palette = ui->textEdit->palette();
551 | palette.setColor(QPalette::Highlight,palette.color(QPalette::Active,QPalette::Highlight));
552 | ui->textEdit->setPalette(palette);
553 | }
554 | //替换
555 | void MainWindow::replaceSlot(){
556 | isFirstFind = true;
557 | replaceDialog.exec();
558 | }
559 | //进行替换
560 | void MainWindow::replace(QString value, bool isChecked)
561 | {
562 | QTextCursor cursor = ui->textEdit->textCursor();
563 | //替换单个值
564 | cursor.insertText(value);
565 | //光标移动到前一位
566 | ui->textEdit->moveCursor(cursor.PreviousCharacter);
567 | //是否区分大小写 查找替换后的值高亮
568 | if(!isChecked){
569 | ui->textEdit->find(value);
570 | }else{
571 | ui->textEdit->find(value,QTextDocument::FindCaseSensitively);
572 | }
573 | }
574 |
575 | void MainWindow::doReplaceSlot(QString target,QString value,bool isChecked,bool isReplaceAll){
576 | if(isFirstFind){
577 | ui->textEdit->moveCursor(QTextCursor::Start);
578 | isFirstFind = false;
579 | }
580 | if(!isChecked){
581 | if(!ui->textEdit->find(target)){
582 | showMessage("找不到\""+target+"\"");
583 | return;
584 | }
585 | }else{
586 | if(!ui->textEdit->find(target,QTextDocument::FindCaseSensitively)){
587 | showMessage("找不到\""+target+"\"");
588 | return;
589 | }
590 | }
591 | //选中高亮
592 | QPalette palette = ui->textEdit->palette();
593 | palette.setColor(QPalette::Highlight,palette.color(QPalette::Active,QPalette::Highlight));
594 | ui->textEdit->setPalette(palette);
595 | //替换
596 | if(isReplaceAll){
597 | if(!ui->textEdit->textCursor().atEnd()){
598 | replace(value,isChecked);
599 | doReplaceSlot(target,value,isChecked,isReplaceAll);
600 | }
601 | }else{
602 | replace(value, isChecked);
603 | }
604 | }
605 | //查找
606 | void MainWindow::findForReplaceSlot(QString value,bool isChecked){
607 | if(isFirstFind){
608 | ui->textEdit->moveCursor(QTextCursor::Start);
609 | isFirstFind = false;
610 | }
611 |
612 | this->find(value,isChecked,false);
613 | }
614 | void MainWindow::showMessage(QString title){
615 | QMessageBox box(QMessageBox::Question,"记事本 - 查找",title);
616 | box.setIcon(QMessageBox::NoIcon);
617 | box.setStandardButtons (QMessageBox::Ok);
618 | box.setButtonText (QMessageBox::Ok,QString("确定"));
619 | box.setWindowFlags( Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint );
620 | box.exec();
621 | }
622 | //拖动文件进入窗口
623 | void MainWindow::dragEnterEvent(QDragEnterEvent *even)
624 | {
625 | even->acceptProposedAction(); //可以在这个窗口部件上拖放对象
626 | }
627 | //释放对方时,执行的操作
628 | void MainWindow::dropEvent(QDropEvent *even)
629 | {
630 | QList urls = even->mimeData()->urls();
631 | if(!urls.isEmpty()){
632 | this->fileName = urls.last().toLocalFile();
633 | if(!this->fileName.isEmpty()){
634 | this->readFile();//读文件
635 | }
636 | }
637 | }
638 | //关闭事件
639 | void MainWindow::closeEvent(QCloseEvent *event){
640 | //文档已经修改
641 | if(ui->textEdit->document()->isModified() && !ui->textEdit->document()->isEmpty() && fileContent != ui->textEdit->document()->toPlainText()){
642 | QMessageBox box(QMessageBox::Question,"记事本","是否将更改保存到 无标题");
643 | box.setIcon(QMessageBox::NoIcon);
644 | box.setStandardButtons (QMessageBox::Ok|QMessageBox::Ignore|QMessageBox::Cancel);
645 | box.setButtonText (QMessageBox::Ok,QString("保存"));
646 | box.setButtonText (QMessageBox::Ignore,QString("不保存"));
647 | box.setButtonText (QMessageBox::Cancel,QString("取消"));
648 | int result = box.exec();
649 | if(result == QMessageBox::Ok){
650 | //保存文件
651 | if(fileName.isEmpty()){//新建
652 | //弹出保存文件对话框
653 | fileName = QFileDialog::getSaveFileName(this, tr("打开文件"),QDir::homePath(),tr("文本文件 (*.*);;"));
654 | if(!fileName.isEmpty()){
655 | //保存文件
656 | this->saveTextToFile();
657 | }
658 | }else{//读取的文本
659 | this->saveTextToFile();
660 | }
661 | event->accept();
662 | }else if(result == QMessageBox::Ignore){
663 | event->accept();
664 | }else{
665 | event->ignore();
666 | }
667 | }else{
668 | event->accept();
669 | }
670 | }
671 |
--------------------------------------------------------------------------------
/notepad.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {d63d5fb3-6b2f-407d-a555-f000dd12cbd3}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | true
41 | false
42 | 0
43 | true
44 | true
45 | 0
46 | 8
47 | true
48 | 1
49 | true
50 | true
51 | true
52 | false
53 |
54 |
55 |
56 | ProjectExplorer.Project.PluginSettings
57 |
58 |
59 |
60 | ProjectExplorer.Project.Target.0
61 |
62 | Desktop Qt 5.9.1 MinGW 32bit
63 | Desktop Qt 5.9.1 MinGW 32bit
64 | qt.591.win32_mingw53_kit
65 | 0
66 | 0
67 | 0
68 |
69 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MinGW_32bit-Debug
70 |
71 |
72 | true
73 | qmake
74 |
75 | QtProjectManager.QMakeBuildStep
76 | true
77 |
78 | false
79 | false
80 | false
81 |
82 |
83 | true
84 | Make
85 |
86 | Qt4ProjectManager.MakeStep
87 |
88 | false
89 |
90 |
91 |
92 | 2
93 | 构建
94 |
95 | ProjectExplorer.BuildSteps.Build
96 |
97 |
98 |
99 | true
100 | Make
101 |
102 | Qt4ProjectManager.MakeStep
103 |
104 | true
105 | clean
106 |
107 |
108 | 1
109 | 清理
110 |
111 | ProjectExplorer.BuildSteps.Clean
112 |
113 | 2
114 | false
115 |
116 | Debug
117 |
118 | Qt4ProjectManager.Qt4BuildConfiguration
119 | 2
120 | true
121 |
122 |
123 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MinGW_32bit-Release
124 |
125 |
126 | true
127 | qmake
128 |
129 | QtProjectManager.QMakeBuildStep
130 | false
131 |
132 | false
133 | false
134 | false
135 |
136 |
137 | true
138 | Make
139 |
140 | Qt4ProjectManager.MakeStep
141 |
142 | false
143 |
144 |
145 |
146 | 2
147 | 构建
148 |
149 | ProjectExplorer.BuildSteps.Build
150 |
151 |
152 |
153 | true
154 | Make
155 |
156 | Qt4ProjectManager.MakeStep
157 |
158 | true
159 | clean
160 |
161 |
162 | 1
163 | 清理
164 |
165 | ProjectExplorer.BuildSteps.Clean
166 |
167 | 2
168 | false
169 |
170 | Release
171 |
172 | Qt4ProjectManager.Qt4BuildConfiguration
173 | 0
174 | true
175 |
176 |
177 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MinGW_32bit-Profile
178 |
179 |
180 | true
181 | qmake
182 |
183 | QtProjectManager.QMakeBuildStep
184 | true
185 |
186 | false
187 | true
188 | false
189 |
190 |
191 | true
192 | Make
193 |
194 | Qt4ProjectManager.MakeStep
195 |
196 | false
197 |
198 |
199 |
200 | 2
201 | 构建
202 |
203 | ProjectExplorer.BuildSteps.Build
204 |
205 |
206 |
207 | true
208 | Make
209 |
210 | Qt4ProjectManager.MakeStep
211 |
212 | true
213 | clean
214 |
215 |
216 | 1
217 | 清理
218 |
219 | ProjectExplorer.BuildSteps.Clean
220 |
221 | 2
222 | false
223 |
224 | Profile
225 |
226 | Qt4ProjectManager.Qt4BuildConfiguration
227 | 0
228 | true
229 |
230 | 3
231 |
232 |
233 | 0
234 | 部署
235 |
236 | ProjectExplorer.BuildSteps.Deploy
237 |
238 | 1
239 | 在本地部署
240 |
241 | ProjectExplorer.DefaultDeployConfiguration
242 |
243 | 1
244 |
245 |
246 | false
247 | false
248 | 1000
249 |
250 | true
251 |
252 | false
253 | false
254 | false
255 | false
256 | true
257 | 0.01
258 | 10
259 | true
260 | 1
261 | 25
262 |
263 | 1
264 | true
265 | false
266 | true
267 | valgrind
268 |
269 | 0
270 | 1
271 | 2
272 | 3
273 | 4
274 | 5
275 | 6
276 | 7
277 | 8
278 | 9
279 | 10
280 | 11
281 | 12
282 | 13
283 | 14
284 |
285 | 2
286 |
287 | notepad
288 |
289 | Qt4ProjectManager.Qt4RunConfiguration:D:/code/Qt/notepad/notepad.pro
290 | true
291 |
292 | notepad.pro
293 | false
294 |
295 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MinGW_32bit-Debug
296 | 3768
297 | false
298 | true
299 | false
300 | false
301 | true
302 |
303 | 1
304 |
305 |
306 |
307 | ProjectExplorer.Project.Target.1
308 |
309 | Desktop Qt 5.9.1 MSVC2013 64bit
310 | Desktop Qt 5.9.1 MSVC2013 64bit
311 | qt.591.win64_msvc2013_64_kit
312 | 0
313 | 0
314 | 0
315 |
316 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2013_64bit-Debug
317 |
318 |
319 | true
320 | qmake
321 |
322 | QtProjectManager.QMakeBuildStep
323 | true
324 |
325 | false
326 | false
327 | false
328 |
329 |
330 | true
331 | Make
332 |
333 | Qt4ProjectManager.MakeStep
334 |
335 | false
336 |
337 |
338 |
339 | 2
340 | 构建
341 |
342 | ProjectExplorer.BuildSteps.Build
343 |
344 |
345 |
346 | true
347 | Make
348 |
349 | Qt4ProjectManager.MakeStep
350 |
351 | true
352 | clean
353 |
354 |
355 | 1
356 | 清理
357 |
358 | ProjectExplorer.BuildSteps.Clean
359 |
360 | 2
361 | false
362 |
363 | Debug
364 |
365 | Qt4ProjectManager.Qt4BuildConfiguration
366 | 2
367 | true
368 |
369 |
370 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2013_64bit-Release
371 |
372 |
373 | true
374 | qmake
375 |
376 | QtProjectManager.QMakeBuildStep
377 | false
378 |
379 | false
380 | false
381 | false
382 |
383 |
384 | true
385 | Make
386 |
387 | Qt4ProjectManager.MakeStep
388 |
389 | false
390 |
391 |
392 |
393 | 2
394 | 构建
395 |
396 | ProjectExplorer.BuildSteps.Build
397 |
398 |
399 |
400 | true
401 | Make
402 |
403 | Qt4ProjectManager.MakeStep
404 |
405 | true
406 | clean
407 |
408 |
409 | 1
410 | 清理
411 |
412 | ProjectExplorer.BuildSteps.Clean
413 |
414 | 2
415 | false
416 |
417 | Release
418 |
419 | Qt4ProjectManager.Qt4BuildConfiguration
420 | 0
421 | true
422 |
423 |
424 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2013_64bit-Profile
425 |
426 |
427 | true
428 | qmake
429 |
430 | QtProjectManager.QMakeBuildStep
431 | true
432 |
433 | false
434 | true
435 | false
436 |
437 |
438 | true
439 | Make
440 |
441 | Qt4ProjectManager.MakeStep
442 |
443 | false
444 |
445 |
446 |
447 | 2
448 | 构建
449 |
450 | ProjectExplorer.BuildSteps.Build
451 |
452 |
453 |
454 | true
455 | Make
456 |
457 | Qt4ProjectManager.MakeStep
458 |
459 | true
460 | clean
461 |
462 |
463 | 1
464 | 清理
465 |
466 | ProjectExplorer.BuildSteps.Clean
467 |
468 | 2
469 | false
470 |
471 | Profile
472 |
473 | Qt4ProjectManager.Qt4BuildConfiguration
474 | 0
475 | true
476 |
477 | 3
478 |
479 |
480 | 0
481 | 部署
482 |
483 | ProjectExplorer.BuildSteps.Deploy
484 |
485 | 1
486 | 在本地部署
487 |
488 | ProjectExplorer.DefaultDeployConfiguration
489 |
490 | 1
491 |
492 |
493 | false
494 | false
495 | 1000
496 |
497 | true
498 |
499 | false
500 | false
501 | false
502 | false
503 | true
504 | 0.01
505 | 10
506 | true
507 | 1
508 | 25
509 |
510 | 1
511 | true
512 | false
513 | true
514 | valgrind
515 |
516 | 0
517 | 1
518 | 2
519 | 3
520 | 4
521 | 5
522 | 6
523 | 7
524 | 8
525 | 9
526 | 10
527 | 11
528 | 12
529 | 13
530 | 14
531 |
532 | 2
533 |
534 |
535 |
536 | %{buildDir}
537 | Custom Executable
538 |
539 | ProjectExplorer.CustomExecutableRunConfiguration
540 | 3768
541 | false
542 | true
543 | false
544 | false
545 | true
546 |
547 | 1
548 |
549 |
550 |
551 | ProjectExplorer.Project.Target.2
552 |
553 | Desktop Qt 5.9.1 MSVC2015 32bit
554 | Desktop Qt 5.9.1 MSVC2015 32bit
555 | qt.591.win32_msvc2015_kit
556 | 0
557 | 0
558 | 0
559 |
560 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2015_32bit-Debug
561 |
562 |
563 | true
564 | qmake
565 |
566 | QtProjectManager.QMakeBuildStep
567 | true
568 |
569 | false
570 | false
571 | false
572 |
573 |
574 | true
575 | Make
576 |
577 | Qt4ProjectManager.MakeStep
578 |
579 | false
580 |
581 |
582 |
583 | 2
584 | 构建
585 |
586 | ProjectExplorer.BuildSteps.Build
587 |
588 |
589 |
590 | true
591 | Make
592 |
593 | Qt4ProjectManager.MakeStep
594 |
595 | true
596 | clean
597 |
598 |
599 | 1
600 | 清理
601 |
602 | ProjectExplorer.BuildSteps.Clean
603 |
604 | 2
605 | false
606 |
607 | Debug
608 |
609 | Qt4ProjectManager.Qt4BuildConfiguration
610 | 2
611 | true
612 |
613 |
614 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2015_32bit-Release
615 |
616 |
617 | true
618 | qmake
619 |
620 | QtProjectManager.QMakeBuildStep
621 | false
622 |
623 | false
624 | false
625 | false
626 |
627 |
628 | true
629 | Make
630 |
631 | Qt4ProjectManager.MakeStep
632 |
633 | false
634 |
635 |
636 |
637 | 2
638 | 构建
639 |
640 | ProjectExplorer.BuildSteps.Build
641 |
642 |
643 |
644 | true
645 | Make
646 |
647 | Qt4ProjectManager.MakeStep
648 |
649 | true
650 | clean
651 |
652 |
653 | 1
654 | 清理
655 |
656 | ProjectExplorer.BuildSteps.Clean
657 |
658 | 2
659 | false
660 |
661 | Release
662 |
663 | Qt4ProjectManager.Qt4BuildConfiguration
664 | 0
665 | true
666 |
667 |
668 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2015_32bit-Profile
669 |
670 |
671 | true
672 | qmake
673 |
674 | QtProjectManager.QMakeBuildStep
675 | true
676 |
677 | false
678 | true
679 | false
680 |
681 |
682 | true
683 | Make
684 |
685 | Qt4ProjectManager.MakeStep
686 |
687 | false
688 |
689 |
690 |
691 | 2
692 | 构建
693 |
694 | ProjectExplorer.BuildSteps.Build
695 |
696 |
697 |
698 | true
699 | Make
700 |
701 | Qt4ProjectManager.MakeStep
702 |
703 | true
704 | clean
705 |
706 |
707 | 1
708 | 清理
709 |
710 | ProjectExplorer.BuildSteps.Clean
711 |
712 | 2
713 | false
714 |
715 | Profile
716 |
717 | Qt4ProjectManager.Qt4BuildConfiguration
718 | 0
719 | true
720 |
721 | 3
722 |
723 |
724 | 0
725 | 部署
726 |
727 | ProjectExplorer.BuildSteps.Deploy
728 |
729 | 1
730 | 在本地部署
731 |
732 | ProjectExplorer.DefaultDeployConfiguration
733 |
734 | 1
735 |
736 |
737 | false
738 | false
739 | 1000
740 |
741 | true
742 |
743 | false
744 | false
745 | false
746 | false
747 | true
748 | 0.01
749 | 10
750 | true
751 | 1
752 | 25
753 |
754 | 1
755 | true
756 | false
757 | true
758 | valgrind
759 |
760 | 0
761 | 1
762 | 2
763 | 3
764 | 4
765 | 5
766 | 6
767 | 7
768 | 8
769 | 9
770 | 10
771 | 11
772 | 12
773 | 13
774 | 14
775 |
776 | -1
777 |
778 |
779 |
780 | %{buildDir}
781 | Custom Executable
782 |
783 | ProjectExplorer.CustomExecutableRunConfiguration
784 | 3768
785 | false
786 | true
787 | false
788 | false
789 | true
790 |
791 | 1
792 |
793 |
794 |
795 | ProjectExplorer.Project.Target.3
796 |
797 | Desktop Qt 5.9.1 MSVC2015 64bit
798 | Desktop Qt 5.9.1 MSVC2015 64bit
799 | qt.591.win64_msvc2015_64_kit
800 | 0
801 | 0
802 | 0
803 |
804 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2015_64bit-Debug
805 |
806 |
807 | true
808 | qmake
809 |
810 | QtProjectManager.QMakeBuildStep
811 | true
812 |
813 | false
814 | false
815 | false
816 |
817 |
818 | true
819 | Make
820 |
821 | Qt4ProjectManager.MakeStep
822 |
823 | false
824 |
825 |
826 |
827 | 2
828 | 构建
829 |
830 | ProjectExplorer.BuildSteps.Build
831 |
832 |
833 |
834 | true
835 | Make
836 |
837 | Qt4ProjectManager.MakeStep
838 |
839 | true
840 | clean
841 |
842 |
843 | 1
844 | 清理
845 |
846 | ProjectExplorer.BuildSteps.Clean
847 |
848 | 2
849 | false
850 |
851 | Debug
852 |
853 | Qt4ProjectManager.Qt4BuildConfiguration
854 | 2
855 | true
856 |
857 |
858 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2015_64bit-Release
859 |
860 |
861 | true
862 | qmake
863 |
864 | QtProjectManager.QMakeBuildStep
865 | false
866 |
867 | false
868 | false
869 | false
870 |
871 |
872 | true
873 | Make
874 |
875 | Qt4ProjectManager.MakeStep
876 |
877 | false
878 |
879 |
880 |
881 | 2
882 | 构建
883 |
884 | ProjectExplorer.BuildSteps.Build
885 |
886 |
887 |
888 | true
889 | Make
890 |
891 | Qt4ProjectManager.MakeStep
892 |
893 | true
894 | clean
895 |
896 |
897 | 1
898 | 清理
899 |
900 | ProjectExplorer.BuildSteps.Clean
901 |
902 | 2
903 | false
904 |
905 | Release
906 |
907 | Qt4ProjectManager.Qt4BuildConfiguration
908 | 0
909 | true
910 |
911 |
912 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2015_64bit-Profile
913 |
914 |
915 | true
916 | qmake
917 |
918 | QtProjectManager.QMakeBuildStep
919 | true
920 |
921 | false
922 | true
923 | false
924 |
925 |
926 | true
927 | Make
928 |
929 | Qt4ProjectManager.MakeStep
930 |
931 | false
932 |
933 |
934 |
935 | 2
936 | 构建
937 |
938 | ProjectExplorer.BuildSteps.Build
939 |
940 |
941 |
942 | true
943 | Make
944 |
945 | Qt4ProjectManager.MakeStep
946 |
947 | true
948 | clean
949 |
950 |
951 | 1
952 | 清理
953 |
954 | ProjectExplorer.BuildSteps.Clean
955 |
956 | 2
957 | false
958 |
959 | Profile
960 |
961 | Qt4ProjectManager.Qt4BuildConfiguration
962 | 0
963 | true
964 |
965 | 3
966 |
967 |
968 | 0
969 | 部署
970 |
971 | ProjectExplorer.BuildSteps.Deploy
972 |
973 | 1
974 | 在本地部署
975 |
976 | ProjectExplorer.DefaultDeployConfiguration
977 |
978 | 1
979 |
980 |
981 | false
982 | false
983 | 1000
984 |
985 | true
986 |
987 | false
988 | false
989 | false
990 | false
991 | true
992 | 0.01
993 | 10
994 | true
995 | 1
996 | 25
997 |
998 | 1
999 | true
1000 | false
1001 | true
1002 | valgrind
1003 |
1004 | 0
1005 | 1
1006 | 2
1007 | 3
1008 | 4
1009 | 5
1010 | 6
1011 | 7
1012 | 8
1013 | 9
1014 | 10
1015 | 11
1016 | 12
1017 | 13
1018 | 14
1019 |
1020 | -1
1021 |
1022 |
1023 |
1024 | %{buildDir}
1025 | Custom Executable
1026 |
1027 | ProjectExplorer.CustomExecutableRunConfiguration
1028 | 3768
1029 | false
1030 | true
1031 | false
1032 | false
1033 | true
1034 |
1035 | 1
1036 |
1037 |
1038 |
1039 | ProjectExplorer.Project.Target.4
1040 |
1041 | Desktop Qt 5.9.1 MSVC2017 64bit
1042 | Desktop Qt 5.9.1 MSVC2017 64bit
1043 | qt.591.win64_msvc2017_64_kit
1044 | 0
1045 | 0
1046 | 0
1047 |
1048 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2017_64bit-Debug
1049 |
1050 |
1051 | true
1052 | qmake
1053 |
1054 | QtProjectManager.QMakeBuildStep
1055 | true
1056 |
1057 | false
1058 | false
1059 | false
1060 |
1061 |
1062 | true
1063 | Make
1064 |
1065 | Qt4ProjectManager.MakeStep
1066 |
1067 | false
1068 |
1069 |
1070 |
1071 | 2
1072 | 构建
1073 |
1074 | ProjectExplorer.BuildSteps.Build
1075 |
1076 |
1077 |
1078 | true
1079 | Make
1080 |
1081 | Qt4ProjectManager.MakeStep
1082 |
1083 | true
1084 | clean
1085 |
1086 |
1087 | 1
1088 | 清理
1089 |
1090 | ProjectExplorer.BuildSteps.Clean
1091 |
1092 | 2
1093 | false
1094 |
1095 | Debug
1096 |
1097 | Qt4ProjectManager.Qt4BuildConfiguration
1098 | 2
1099 | true
1100 |
1101 |
1102 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2017_64bit-Release
1103 |
1104 |
1105 | true
1106 | qmake
1107 |
1108 | QtProjectManager.QMakeBuildStep
1109 | false
1110 |
1111 | false
1112 | false
1113 | false
1114 |
1115 |
1116 | true
1117 | Make
1118 |
1119 | Qt4ProjectManager.MakeStep
1120 |
1121 | false
1122 |
1123 |
1124 |
1125 | 2
1126 | 构建
1127 |
1128 | ProjectExplorer.BuildSteps.Build
1129 |
1130 |
1131 |
1132 | true
1133 | Make
1134 |
1135 | Qt4ProjectManager.MakeStep
1136 |
1137 | true
1138 | clean
1139 |
1140 |
1141 | 1
1142 | 清理
1143 |
1144 | ProjectExplorer.BuildSteps.Clean
1145 |
1146 | 2
1147 | false
1148 |
1149 | Release
1150 |
1151 | Qt4ProjectManager.Qt4BuildConfiguration
1152 | 0
1153 | true
1154 |
1155 |
1156 | D:/code/Qt/build-notepad-Desktop_Qt_5_9_1_MSVC2017_64bit-Profile
1157 |
1158 |
1159 | true
1160 | qmake
1161 |
1162 | QtProjectManager.QMakeBuildStep
1163 | true
1164 |
1165 | false
1166 | true
1167 | false
1168 |
1169 |
1170 | true
1171 | Make
1172 |
1173 | Qt4ProjectManager.MakeStep
1174 |
1175 | false
1176 |
1177 |
1178 |
1179 | 2
1180 | 构建
1181 |
1182 | ProjectExplorer.BuildSteps.Build
1183 |
1184 |
1185 |
1186 | true
1187 | Make
1188 |
1189 | Qt4ProjectManager.MakeStep
1190 |
1191 | true
1192 | clean
1193 |
1194 |
1195 | 1
1196 | 清理
1197 |
1198 | ProjectExplorer.BuildSteps.Clean
1199 |
1200 | 2
1201 | false
1202 |
1203 | Profile
1204 |
1205 | Qt4ProjectManager.Qt4BuildConfiguration
1206 | 0
1207 | true
1208 |
1209 | 3
1210 |
1211 |
1212 | 0
1213 | 部署
1214 |
1215 | ProjectExplorer.BuildSteps.Deploy
1216 |
1217 | 1
1218 | 在本地部署
1219 |
1220 | ProjectExplorer.DefaultDeployConfiguration
1221 |
1222 | 1
1223 |
1224 |
1225 | false
1226 | false
1227 | 1000
1228 |
1229 | true
1230 |
1231 | false
1232 | false
1233 | false
1234 | false
1235 | true
1236 | 0.01
1237 | 10
1238 | true
1239 | 1
1240 | 25
1241 |
1242 | 1
1243 | true
1244 | false
1245 | true
1246 | valgrind
1247 |
1248 | 0
1249 | 1
1250 | 2
1251 | 3
1252 | 4
1253 | 5
1254 | 6
1255 | 7
1256 | 8
1257 | 9
1258 | 10
1259 | 11
1260 | 12
1261 | 13
1262 | 14
1263 |
1264 | -1
1265 |
1266 |
1267 |
1268 | %{buildDir}
1269 | Custom Executable
1270 |
1271 | ProjectExplorer.CustomExecutableRunConfiguration
1272 | 3768
1273 | false
1274 | true
1275 | false
1276 | false
1277 | true
1278 |
1279 | 1
1280 |
1281 |
1282 |
1283 | ProjectExplorer.Project.TargetCount
1284 | 5
1285 |
1286 |
1287 | ProjectExplorer.Project.Updater.FileVersion
1288 | 18
1289 |
1290 |
1291 | Version
1292 | 18
1293 |
1294 |
1295 |
--------------------------------------------------------------------------------