📄 copserv.cpp
字号:
#include <QPushButton>#include <QSlider>#include <QLabel>#include <QDial>#include <QLCDNumber>#include <QVBoxLayout>#include <QHBoxLayout>#include <QGridLayout>#include <QSettings>#include <QApplication>#include <QCoreApplication>#include <unistd.h>#include <sys/types.h>#include "CopServ.h"CopServ::CopServ() : QWidget(){ createScreen();}void CopServ::createScreen(){ QPushButton* celBtn = new QPushButton("Cel"); QPushButton* fahBtn = new QPushButton("Fah"); QPushButton* quitBtn = new QPushButton("Quit"); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(celBtn, 0, 0); mainLayout->addWidget(fahBtn, 0, 1); mainLayout->addWidget(quitBtn, 1, 0); setLayout(mainLayout); connect(celBtn, SIGNAL(clicked()), this, SLOT(launchCel())); connect(fahBtn, SIGNAL(clicked()), this, SLOT(launchFah())); connect(quitBtn, SIGNAL(clicked()), qApp, SLOT(quit())); setGeometry(0, 50, 240, 320); setWindowTitle("Server Window");}void CopServ::launchApp(const char* path){ if (path == NULL) { qDebug("Launch path is NULL!\n"); } pid_t pid = fork(); if (pid == 0) { qDebug("new process forked. PID is:%d\n", getpid()); int result = execl(path, path, 0); if (result < 0) { qDebug("failed to launch application!\n"); } _exit(-1); }}void CopServ::launchCel(){ launchApp("./cel/cel");}void CopServ::launchFah(){ launchApp("./fah/fah");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -