当前位置:网站首页>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.";
}
}
边栏推荐
- 验证失败,请检查您的回电网址。您可以按照指导进行操作
- selenium,元素操作以及浏览器操作方法
- Achievements in science and Technology (27)
- Solution: Compression Technology (original version and sequel version)
- 题解:《你的飞碟在这儿》、《哥德巴赫猜想》
- 693. Travel sequencing (map + topology)
- Android kotlin material design technology points
- [true topic of the Blue Bridge Cup trials 43] scratch space flight children's programming explanation of the true topic of the Blue Bridge Cup trials
- Stone merging Board [interval DP] (ordinary stone Merging & Ring Stone merging)
- Skillfully use SSH to get through the Internet restrictions
猜你喜欢

OpenApi-Generator:简化RESTful API开发流程
![[technology development-22]: rapid overview of the application and development of network and communication technology-2-communication Technology](/img/a7/44609a5acf25021f1fca566c3d8c90.png)
[technology development-22]: rapid overview of the application and development of network and communication technology-2-communication Technology

OpenFOAM:lduMatrix&lduAddressing

最近公共祖先LCA的三种求法

We sincerely invite young creators to share with investors and entrepreneurs how to make choices in life in the metauniverse

Subcontracting configuration of uniapp applet subpackages

Countermeasures for the failure of MMPV billing period caused by negative inventory of materials in SAP mm

Qt入门-制作一个简易的计算器

Selenium, element operation and browser operation methods

2022零代码/低代码开发白皮书【伙伴云出品】附下载
随机推荐
I did it with two lines of code. As a result, my sister had a more ingenious way
What are eNB, EPC and PGW?
Solution: Compression Technology (original version and sequel version)
D如何检查null
mysql ---- Oracle中的rownum转换成MySQL
JS reverse row query data decryption
The xftp connection Haikang camera reported an error: the SFTP subsystem application has been rejected. Please ensure that the SFTP subsystem settings of the SSH connection are valid
Runhe hi3516 development board openharmony small system and standard system burning
Pocket Raider comments
瀏覽器驅動的下載
口袋奇兵点评
BeanUtils--浅拷贝--实例/原理
De4000h storage installation configuration
How much do you know about free SSL certificates? The difference between free SSL certificate and charged SSL certificate
leetcode621. task scheduler
selenium,元素操作以及浏览器操作方法
Quantum three body problem: Landau fall
伙伴云表格强势升级!Pro版,更非凡!
OpenFOAM:lduMatrix&lduAddressing
P3807 [template] Lucas theorem /lucas theorem

