当前位置:网站首页>QT new project_ MyNotepad++
QT new project_ MyNotepad++
2022-07-02 13:48:00 【Across mountains and rivers, across the sea】
Qt The new project _MyNotepad++
How to create a menu bar
Hold down alt+F You can choose file (F)
The creation is successful, as shown in the figure below :
According to the above method, we create the effect of the following figure in turn

Yes Create new functions to expand
Function description :
When textEdit That text box Change when , Click New At the terminal output Prompt information .
Realization effect


Implementation code
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
#include <QDebug>
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
private slots:
void newFileSlot();
};
#endif // MAINWINDOW_H
main.cpp
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
// Set title
this->setWindowTitle("ning_ning_WenDang");
QObject::connect(
ui->newAction,
SIGNAL(triggered()),
this,
SLOT(newFileSlot())
);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::newFileSlot()
{
// If the current document has changed
if(ui->textEdit->document()->isModified())
{
qDebug()<<"current file modified."; // Current document changes ;
}
else
{
qDebug()<<"not modified.";
}
}
边栏推荐
- Add sequence number column to query results in MySQL
- Can automatically update the universal weekly report template, you can use it with your hand!
- Everyone believes that the one-stop credit platform makes the credit scenario "useful"
- Pocket Raider comments
- Don't spend money, spend an hour to build your own blog website
- Performance optimization of memory function
- 浏览器驱动的下载
- Chinese name extraction (toy code - accurate head is too small, right to play)
- What are eNB, EPC and PGW?
- 基于ssm+jsp框架实现的学生选课信息管理系统【源码+数据库】
猜你喜欢

2022零代码/低代码开发白皮书【伙伴云出品】附下载

Answer: can the audio be set to on by default during easydss video on demand?

Selenium, element operation and browser operation methods

Code implementation MNLM

How to modify the error of easydss on demand service sharing time?

Qt-制作一个简单的计算器-实现四则运算-将结果以对话框的形式弹出来

Solution: Compression Technology (original version and sequel version)

leetcode621. task scheduler

The 29 year old programmer in Shanghai was sentenced to 10 months for "deleting the database and running away" on the day of his resignation!

Tupang multi-target tracking! BOT sort: robust correlated multi pedestrian tracking
随机推荐
On flow delivery between microservices
Let juicefs help you with "remote backup"
你的 Sleep 服务会梦到服务网格外的 bookinfo 吗
Can automatically update the universal weekly report template, you can use it with your hand!
How to use SAP's metadata framework (MDF) to build custom business rules?
解答:EasyDSS视频点播时音频是否可以设置为默认开启?
Engineers who can't read device manuals are not good cooks
D如何检查null
D为何链接不了dll
科技的成就(二十七)
Explanation: here is your UFO, Goldbach conjecture
Explanation of 34 common terms on the Internet
每日一题:1175.质数排列
诚邀青年创作者,一起在元宇宙里与投资人、创业者交流人生如何做选择……...
P1347 sorting (topology + SPFA judgment ring or topology [inner judgment ring])
Qt新项目_MyNotepad++
题解《子数整数》、《欢乐地跳》、《开灯》
[Unity]使用GB2312,打包后程序不正常解决方案
We sincerely invite young creators to share with investors and entrepreneurs how to make choices in life in the metauniverse
MySQL -- convert rownum in Oracle to MySQL

