mainwindow.cpp
Go to the documentation of this file.
1 #include "mainwindow.h"
2 #include "ui_mainwindow.h"
3 
4 MainWindow::MainWindow(int argc, char **argv) :
5  QMainWindow(0),
6  ui(new Ui::MainWindow),
7  node(argc, argv)
8 {
9  ui->setupUi(this);
10 
11  connect(&node, SIGNAL(newVelocityData(float)), this, SLOT(onNewVelocity(float)));
12  connect(&node, SIGNAL(newNodesList(QStringList)), this, SLOT(onNewNodesList(QStringList)));
13 
14  if(node.init())
15  std::cout << "ROS node initialized." << std::endl;
16  else
17  std::cerr << "ROS node failed to initialize." << std::endl;
18 }
19 
21 {
22  delete ui;
23 }
24 
25 void MainWindow::onNewVelocity(float velocity)
26 {
27  ui->widget->setValue(velocity);
28 }
29 
30 void MainWindow::onNewNodesList(QStringList nodes)
31 {
32  ui->listWidget->clear();
33  for(auto node : nodes)
34  ui->listWidget->addItem(node);
35 }
bool init()
Definition: qnode.cpp:23
MainWindow(int argc, char **argv)
Definition: mainwindow.cpp:4
Ui::MainWindow * ui
Definition: mainwindow.h:24
QNode node
Definition: mainwindow.h:26
void onNewNodesList(QStringList nodes)
Definition: mainwindow.cpp:30
void onNewVelocity(float velocity)
Definition: mainwindow.cpp:25


igvc
Author(s): Matthew Barulic , Al Chaussee
autogenerated on Sun May 10 2015 16:18:45