使用系统主题图标代替Qt内置图标
This commit is contained in:
parent
662f751b77
commit
23cfbe8a23
|
@ -26,13 +26,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
ui(new Ui::MainWindow)
|
ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->action_new->setIcon(style()->standardIcon(QStyle::SP_FileDialogNewFolder));
|
|
||||||
ui->action_open->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton));
|
|
||||||
ui->action_save->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
|
|
||||||
ui->action_quit->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
|
||||||
ui->action_undo->setIcon(style()->standardIcon(QStyle::SP_DialogCancelButton));
|
|
||||||
ui->action_quit->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
|
||||||
ui->action_about->setIcon(style()->standardIcon(QStyle::SP_DialogHelpButton));
|
|
||||||
move((QApplication::desktop()->width() - width())/2, (QApplication::desktop()->height() - height())/2);
|
move((QApplication::desktop()->width() - width())/2, (QApplication::desktop()->height() - height())/2);
|
||||||
|
|
||||||
lineEdit_command = new QLineEdit;
|
lineEdit_command = new QLineEdit;
|
||||||
|
@ -101,7 +94,7 @@ void MainWindow::on_action_aboutQt_triggered()
|
||||||
|
|
||||||
void MainWindow::on_action_about_triggered()
|
void MainWindow::on_action_about_triggered()
|
||||||
{
|
{
|
||||||
QMessageBox aboutMB(QMessageBox::NoIcon, "关于", "海天鹰编辑器 1.7\n\n一款基于 Qt 的文本编辑程序。\n作者:黄颖\nE-mail: sonichy@163.com\n主页:https://github.com/sonichy\n参考文献:\n多文档编辑器:http://www.qter.org/?page_id=161\nQMdiArea基本用法:http://www.mamicode.com/info-detail-1607476.html\n保存文本:http://blog.csdn.net/neicole/article/details/7330234\n语法高亮:http://www.cnblogs.com/lenxvp/p/5475931.html\n拖放打开文件:http://blog.csdn.net/rl529014/article/details/53057577\n行号:http://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html");
|
QMessageBox aboutMB(QMessageBox::NoIcon, "关于", "海天鹰编辑器 1.8\n\n一款基于 Qt 的文本编辑程序。\n作者:黄颖\nE-mail: sonichy@163.com\n主页:https://github.com/sonichy\n参考文献:\n多文档编辑器:http://www.qter.org/?page_id=161\nQMdiArea基本用法:http://www.mamicode.com/info-detail-1607476.html\n保存文本:http://blog.csdn.net/neicole/article/details/7330234\n语法高亮:http://www.cnblogs.com/lenxvp/p/5475931.html\n拖放打开文件:http://blog.csdn.net/rl529014/article/details/53057577\n行号:http://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html");
|
||||||
aboutMB.setIconPixmap(QPixmap(":/icon.png"));
|
aboutMB.setIconPixmap(QPixmap(":/icon.png"));
|
||||||
aboutMB.setWindowIcon(QIcon(":/icon.png"));
|
aboutMB.setWindowIcon(QIcon(":/icon.png"));
|
||||||
aboutMB.exec();
|
aboutMB.exec();
|
||||||
|
@ -109,7 +102,7 @@ void MainWindow::on_action_about_triggered()
|
||||||
|
|
||||||
void MainWindow::on_action_changelog_triggered()
|
void MainWindow::on_action_changelog_triggered()
|
||||||
{
|
{
|
||||||
QString s = "1.7\n2018-10\n支持拖放打开多个文件。\n增加打开文件log。\n打开方式文件路径兼容深度文管和其他文管。\n\n1.6\n2018-09\n标签右键增加只读菜单。\n优化括号补全。\n\n1.5\n2018-08\n增加行号\n增加java文件编译命令\n\n1.4\n2018-07\n设置QTextEdit的Tab跳过的空格数为4个空格\n\n1.3\n2018-06\n增加调试窗口。\n\n1.2\n2018-05\n增加c、cpp的OpenGL编译命令。\n2018-05\n解决右键打开方式无法打开文件问题。\n增加运行python。\n2018-04\n增加打印功能。\n\n1.1\n2017-10\n增加获取文本编码(使用 file --mime-encoding 命令返回),但是没有解决乱码问题。\n排版实验。\n用文本框代替消息框显示更新日志。\n2017-07\n增加拖放打开文件。\n2017-06\n增加语法高亮。\n提取打开文件的相对路径,使Markdown预览能够载入相对路径图片。\n\n1.0\n2017-03\n支持命令行打开文件和打开方式打开文件。\n查找窗口填入选中文本。\n2017-02\n根据文件扩展名选择语法高亮方案。\nJS语法高亮实验成功!\nHTML语法高亮实验成功!\n增加设置字体。\n设置状态栏左右边距。\n2017-01\n实现全部替换。\n设置循环查找。\n增加查找替换窗体和功能。\n根据文件扩展名决定是否使用默认程序打开,如htm。\n优化保存、另存为和文本修动标题标记逻辑。\n增加撤销,重做,子窗标题文本改动标识。\n增加子窗体类,实现Ctrl+滚轮缩放和保存打开文件的路径。\n增加使用默认程序预览文件。\n把上一个打开或保存的路径设置为打开或保存对话框的默认路径和文件名。\n增加放大、缩小。\n增加文本光标变化信号,光标所在行列显示在状态栏第二栏。\n状态栏分为2栏\n修复没有子窗口时预览引起的崩溃。\n增加预览功能。\n保存成功。\n修改字体颜色,背景色成功。\n新建文件成功,打开文件载入成功。\n选用QMdiArea作为主控件,增加窗口标签、平铺、层叠菜单。 \n制作主要菜单。";
|
QString s = "1.8\n2018-11\n使用系统主题图标代替Qt内置图标。\n\n1.7\n2018-10\n支持拖放打开多个文件。\n增加打开文件log。\n打开方式文件路径兼容深度文管和其他文管。\n\n1.6\n2018-09\n标签右键增加只读菜单。\n优化括号补全。\n\n1.5\n2018-08\n增加行号\n增加java文件编译命令\n\n1.4\n2018-07\n设置QTextEdit的Tab跳过的空格数为4个空格\n\n1.3\n2018-06\n增加调试窗口。\n\n1.2\n2018-05\n增加c、cpp的OpenGL编译命令。\n2018-05\n解决右键打开方式无法打开文件问题。\n增加运行python。\n2018-04\n增加打印功能。\n\n1.1\n2017-10\n增加获取文本编码(使用 file --mime-encoding 命令返回),但是没有解决乱码问题。\n排版实验。\n用文本框代替消息框显示更新日志。\n2017-07\n增加拖放打开文件。\n2017-06\n增加语法高亮。\n提取打开文件的相对路径,使Markdown预览能够载入相对路径图片。\n\n1.0\n2017-03\n支持命令行打开文件和打开方式打开文件。\n查找窗口填入选中文本。\n2017-02\n根据文件扩展名选择语法高亮方案。\nJS语法高亮实验成功!\nHTML语法高亮实验成功!\n增加设置字体。\n设置状态栏左右边距。\n2017-01\n实现全部替换。\n设置循环查找。\n增加查找替换窗体和功能。\n根据文件扩展名决定是否使用默认程序打开,如htm。\n优化保存、另存为和文本修动标题标记逻辑。\n增加撤销,重做,子窗标题文本改动标识。\n增加子窗体类,实现Ctrl+滚轮缩放和保存打开文件的路径。\n增加使用默认程序预览文件。\n把上一个打开或保存的路径设置为打开或保存对话框的默认路径和文件名。\n增加放大、缩小。\n增加文本光标变化信号,光标所在行列显示在状态栏第二栏。\n状态栏分为2栏\n修复没有子窗口时预览引起的崩溃。\n增加预览功能。\n保存成功。\n修改字体颜色,背景色成功。\n新建文件成功,打开文件载入成功。\n选用QMdiArea作为主控件,增加窗口标签、平铺、层叠菜单。 \n制作主要菜单。";
|
||||||
QDialog *dialog = new QDialog;
|
QDialog *dialog = new QDialog;
|
||||||
dialog->setWindowTitle("更新历史");
|
dialog->setWindowTitle("更新历史");
|
||||||
dialog->setFixedSize(400, 300);
|
dialog->setFixedSize(400, 300);
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>24</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu">
|
<widget class="QMenu" name="menu">
|
||||||
|
@ -144,6 +144,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="action_new">
|
<action name="action_new">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-new"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>新建</string>
|
<string>新建</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -152,6 +155,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_open">
|
<action name="action_open">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-open"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>打开</string>
|
<string>打开</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -160,6 +166,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_close">
|
<action name="action_close">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="window-close"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>关闭</string>
|
<string>关闭</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -168,6 +177,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_save">
|
<action name="action_save">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-save"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>保存</string>
|
<string>保存</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -176,6 +188,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_saveas">
|
<action name="action_saveas">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-save-as"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>另存为</string>
|
<string>另存为</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -184,6 +199,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_quit">
|
<action name="action_quit">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="application-exit"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>退出</string>
|
<string>退出</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -192,6 +210,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_undo">
|
<action name="action_undo">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-undo"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>撤销</string>
|
<string>撤销</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -200,6 +221,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_redo">
|
<action name="action_redo">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-redo"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>重做</string>
|
<string>重做</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -208,6 +232,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_copy">
|
<action name="action_copy">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-copy"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>复制</string>
|
<string>复制</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -216,6 +243,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_cut">
|
<action name="action_cut">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-cut"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>剪切</string>
|
<string>剪切</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -224,6 +254,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_paste">
|
<action name="action_paste">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-paste"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>粘贴</string>
|
<string>粘贴</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -240,6 +273,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_find">
|
<action name="action_find">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-find"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>查找</string>
|
<string>查找</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -248,6 +284,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_replace">
|
<action name="action_replace">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-find-replace"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>替换</string>
|
<string>替换</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -256,11 +295,17 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_aboutQt">
|
<action name="action_aboutQt">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="help-faq"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>关于Qt</string>
|
<string>关于Qt</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_about">
|
<action name="action_about">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="help-about"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>关于</string>
|
<string>关于</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -289,14 +334,16 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_changelog">
|
<action name="action_changelog">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="help-contents"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>更新历史</string>
|
<string>更新历史</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_run">
|
<action name="action_run">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="qtrf.qrc">
|
<iconset theme="system-run"/>
|
||||||
<normaloff>:/run.png</normaloff>:/run.png</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>运行</string>
|
<string>运行</string>
|
||||||
|
@ -309,6 +356,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_zoomin">
|
<action name="action_zoomin">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="zoom-in"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>放大</string>
|
<string>放大</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -317,6 +367,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_zoomout">
|
<action name="action_zoomout">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="zoom-out"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>缩小</string>
|
<string>缩小</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -326,14 +379,16 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="action_font">
|
<action name="action_font">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="qtrf.qrc">
|
<iconset theme="preferences-desktop-font"/>
|
||||||
<normaloff>:/font.png</normaloff>:/font.png</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>字体</string>
|
<string>字体</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_print">
|
<action name="action_print">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-print"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>打印</string>
|
<string>打印</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -342,6 +397,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_printPreview">
|
<action name="action_printPreview">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-print-preview"/>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>打印预览</string>
|
<string>打印预览</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -44,11 +44,11 @@ bool MdiChild::loadFile(QString filename)
|
||||||
plt.setColor(QPalette::Text,QColor(Qt::white));
|
plt.setColor(QPalette::Text,QColor(Qt::white));
|
||||||
plt.setBrush(QPalette::Base,QBrush(Qt::black));
|
plt.setBrush(QPalette::Base,QBrush(Qt::black));
|
||||||
setPalette(plt);
|
setPalette(plt);
|
||||||
QTextStream ts(file);
|
QTextStream TS(file);
|
||||||
// 还是乱码
|
// 还是乱码
|
||||||
QTextCodec *codec = QTextCodec::codecForName(scodec.toLatin1());
|
QTextCodec *codec = QTextCodec::codecForName(scodec.toLatin1());
|
||||||
ts.setCodec(codec);
|
TS.setCodec(codec);
|
||||||
QString s = ts.readAll();
|
QString s = TS.readAll();
|
||||||
file->close();
|
file->close();
|
||||||
delete file;
|
delete file;
|
||||||
setPlainText(s);
|
setPlainText(s);
|
||||||
|
|
|
@ -20,7 +20,7 @@ private:
|
||||||
LineNumberArea *lineNumberArea;
|
LineNumberArea *lineNumberArea;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void wheelEvent(QWheelEvent*);
|
void wheelEvent(QWheelEvent *e);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent *e);
|
||||||
void resizeEvent(QResizeEvent* e);
|
void resizeEvent(QResizeEvent* e);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue