我想在我的电路板上读取CPU的温度(Raspbian中的典型命令"/opt/vc/bin/vcgencmd measure_temp"),我可以在点击按钮时执行命令,但我找不到将结果保存在Qt程序中的变量的方法。
The code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QProcess>
QProcess process;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
ui->setupUi(this);
MainWindow::~MainWindow()
delete ui;
void MainWindow::on_pushButton_clicked()
QProcess lecturatemp;
lecturatemp.startDetached("/bin/sh",QStringList()<<"-c"<<"/opt/vc/bin/vcgencmd measure_temp"); //
//lecturatemp.waitForFinished();