Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include <QProcess>
  4. #include <QtDebug>
  5.  
  6. MainWindow::MainWindow(QWidget *parent) :
  7. QMainWindow(parent),
  8. ui(new Ui::MainWindow)
  9. {
  10. ui->setupUi(this);
  11. proc = new QProcess();
  12. proc->start("acpi -t");
  13. connect(proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readIn()));
  14. }
  15.  
  16. MainWindow::~MainWindow()
  17. {
  18. delete ui;
  19. }
  20.  
  21. void MainWindow::readIn()
  22. {
  23. QByteArray data;
  24. data = proc->readAllStandardOutput();
  25.  
  26. ui->textBrowser->setText(data);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement