当前位置:网站首页>QT actual combat case (38) -- using qpprocess class to realize the function of starting process
QT actual combat case (38) -- using qpprocess class to realize the function of starting process
2022-06-12 23:29:00 【wendy_ ya】
Catalog
One 、 Project introduction
utilize QProcess Class implements the function of starting a process ( Take the Notepad program as an example ).
Two 、 Basic configuration of the project
Create a new one Qt Case study , Project name: “ProcessTest”, Base class selection “QWidget”, Click to select Create UI Interface check box , Complete project creation .
3、 ... and 、UI Interface design
UI The interface layout is as follows :
Only... Is created in the interface 1 Controls , Its name and type are as follows :
| Serial number | name | type | attribute |
|---|---|---|---|
| ① | pbn_process | QPushButton | text: Start a process |
Four 、 The main program realizes
4.1 widget.h The header file
The header file contains the header file , Then add a private object , Declare button click slot function :
#include<QProcess>
private:
QProcess myProcess;
private slots:
void on_pbn_process_clicked();
4.2 widget.cpp Source file
Define button click slot function :
void Widget::on_pbn_process_clicked()
{
// Start Notepad process
myProcess.start("notepad.exe");
}
Here's the launch of Windows System Notepad program ( namely notepad.exe, Because it is in Windows In the system directory of , The directory has been added to the system PATH In the environment variables , So you don't need to write a specific path ).
5、 ... and 、 Effect demonstration
The complete effect is as follows :
ok, The above is the whole content of this article , If it helps you , Remember to like it ~
边栏推荐
- MySQL row to column, column to row, multiple columns to one row, one row to multiple columns
- Hongmeng starts 2
- Sequence maximum return
- Alien Skin Exposure X7调色滤镜插件,RAW后期处理工具
- The development trend of digital collections!
- MYSQL 行转列、列转行、多列转一行、一行转多列
- Photoshop:ps how to enlarge a picture without blurring
- Matters of parent-child class construction method in inheritance
- Unprecedented analysis of Milvus source code architecture
- 2202 - production de CV
猜你喜欢

Alien Skin Exposure X7调色滤镜插件,RAW后期处理工具
C语言:如何给全局变量起一个别名?

CST learning: four element array design of circular patch antenna (III) array formation and parallel excitation
![CS for mobile security [nethunter]](/img/25/ad99256a1eebb09f639e95d00756a5.jpg)
CS for mobile security [nethunter]

Gb28181 protocol -- alarm

Alcohol detector based on 51 single chip microcomputer

LeetCode 146. LRU cache

For product managers, which of the two certificates, PMP and NPDP, is more authoritative?

2202-简历制作

Opencv source code compilation
随机推荐
Design of traceid in the project
Zhengzhou University of light industry -- development and sharing of harmonyos pet health system
Chapter 8 - shared model JUC
Sword finger offer series - 47 Maximum value of gifts
Design a MySQL table for message queue to store message data
测试平台系列(97) 完善执行case部分
CS for mobile security [nethunter]
C language: how to give an alias to a global variable?
[redis sentinel] failed listening on port 26379 (TCP) & sentinel mode no response problem solved
数字藏品的发展趋势!
Analysis report on business model innovation path and operation status of China's app store industry from 2022 to 2028
MYSQL 行转列、列转行、多列转一行、一行转多列
[opencv learning] perspective transformation matrix
人脸检测:MTCNN
Using baserecyclerviewadapterhelper to implement tree structure
Shardingsphere-proxy-5.0.0 deployment table implementation (I)
Abstract methods and abstract classes
Go time format assignment
Leetcode 890 finding and replacing patterns [map] the leetcode path of heroding
The Milvus graphical management tool Attu is coming!