Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "mainwindow.h"
00030
00031 #ifndef Q_MOC_RUN // MOC doesnt' parse boost correctly. See https://bugreports.qt.io/browse/QTBUG-22829
00032
00033 #include <QMessageBox>
00034 #include <QtGui>
00035 #include <QtCore>
00036 #include <QString>
00037
00038 QT_BEGIN_NAMESPACE
00039
00040 class Ui_MainWindow
00041 {
00042 public:
00043 QWidget *centralWidget;
00044 QGridLayout *gridLayout;
00045 QHBoxLayout *horizontalLayout;
00046 QMenuBar *menuBar;
00047 QToolBar *mainToolBar;
00048 QStatusBar *statusBar;
00049
00050 void setupUi(QMainWindow *MainWindow)
00051 {
00052 if (MainWindow->objectName().isEmpty())
00053 MainWindow->setObjectName(QString("MainWindow"));
00054 MainWindow->resize(400, 300);
00055 centralWidget = new QWidget(MainWindow);
00056 centralWidget->setObjectName(QString("centralWidget"));
00057 gridLayout = new QGridLayout(centralWidget);
00058 gridLayout->setSpacing(6);
00059 gridLayout->setContentsMargins(11, 11, 11, 11);
00060 gridLayout->setObjectName(QString("gridLayout"));
00061 horizontalLayout = new QHBoxLayout();
00062 horizontalLayout->setSpacing(6);
00063 horizontalLayout->setObjectName(QString("horizontalLayout"));
00064
00065 gridLayout->addLayout(horizontalLayout, 0, 0, 1, 1);
00066
00067 MainWindow->setCentralWidget(centralWidget);
00068 menuBar = new QMenuBar(MainWindow);
00069 menuBar->setObjectName(QString("menuBar"));
00070 menuBar->setGeometry(QRect(0, 0, 400, 20));
00071 MainWindow->setMenuBar(menuBar);
00072 mainToolBar = new QToolBar(MainWindow);
00073 mainToolBar->setObjectName(QString("mainToolBar"));
00074 MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
00075 statusBar = new QStatusBar(MainWindow);
00076 statusBar->setObjectName(QString("statusBar"));
00077 MainWindow->setStatusBar(statusBar);
00078
00079 retranslateUi(MainWindow);
00080
00081 QMetaObject::connectSlotsByName(MainWindow);
00082 }
00083
00084 void retranslateUi(QMainWindow *MainWindow)
00085 {
00086 MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
00087 }
00088
00089 };
00090
00091 namespace Ui {
00092 class MainWindow: public Ui_MainWindow {};
00093 }
00094
00095 QT_END_NAMESPACE
00096
00097
00098 MainWindow::MainWindow(QWidget *parent, ros::NodeHandle* nh) :
00099 QMainWindow(parent),
00100 ui(new Ui::MainWindow)
00101 {
00102 ui->setupUi(this);
00103
00104 mSpeedGauge = new QcGaugeWidget;
00105 mSpeedGauge->addBackground(99);
00106 QcBackgroundItem *bkg1 = mSpeedGauge->addBackground(92);
00107 bkg1->clearrColors();
00108 bkg1->addColor(0.1,Qt::black);
00109 bkg1->addColor(1.0,Qt::white);
00110
00111 QcBackgroundItem *bkg2 = mSpeedGauge->addBackground(88);
00112 bkg2->clearrColors();
00113 bkg2->addColor(0.1,Qt::gray);
00114 bkg2->addColor(1.0,Qt::darkGray);
00115
00116
00117 int minimum;
00118 nh->getParam("minimum", minimum);
00119 int maximum;
00120 nh->getParam("maximum", maximum);
00121
00122 mSpeedGauge->addDegrees(65)->setValueRange(minimum,maximum);
00123
00124 mSpeedGauge->addValues(80)->setValueRange(minimum,maximum);
00125
00126
00127 std::string gaugeName;
00128 nh->getParam("gauge_name", gaugeName);
00129 mSpeedGauge->addLabel(70)->setText(gaugeName.c_str());
00130
00131
00132 QcLabelItem *lab = mSpeedGauge->addLabel(40);
00133 lab->setText("0");
00134 mSpeedNeedle = mSpeedGauge->addNeedle(60);
00135 mSpeedNeedle->setLabel(lab);
00136 mSpeedNeedle->setColor(Qt::black);
00137 mSpeedNeedle->setValueRange(minimum,maximum);
00138 mSpeedGauge->addBackground(7);
00139 mSpeedGauge->addGlass(88);
00140 ui->horizontalLayout->addWidget(mSpeedGauge);
00141 }
00142
00143 MainWindow::~MainWindow()
00144 {
00145 delete ui;
00146 }
00147 #endif