Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Suggestions- Publishing data on a topic using Qt Slider

Hello All,

I am new to ROS, I need help regarding implementation of qt-slider in ros.

Can any one help me or give suggestions, thanks in advance.

I have qt source files: Please have a look:

MainWindow::MainWindow() { slider = new QSlider(Qt::Horizontal); slider->setMinimum(0); slider->setMaximum(100); lineEdit = new QLineEdit();

QObject::connect(slider, SIGNAL(valueChanged(int)),
                 this, SLOT(onValueChanged(int)));

QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(slider);
layout->addWidget(lineEdit);

QWidget *wrapper = new QWidget();
wrapper->setLayout(layout);
setCentralWidget(wrapper);

}

MainWindow::~MainWindow() { }

void MainWindow::onValueChanged(int value)

{

int pos = slider->sliderPosition();
QByteArray convertedValue = QByteArray::number(pos,16);
QString m = QString(convertedValue);
m= "0x"+m;
QString id,len;
id="0x01 ";
len="0x01 ";
canmsg=id+len+m;
lineEdit->setText(canmsg);

}

int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow mainWindow; mainWindow.show(); return app.exec(); }

Can any one help me to publish this message(i mean canmsg) on topic(any). As discussed in qt ros, I made changes in cmakelist.txt. Thanks for reading.

Suggestions- Publishing data on a topic using Qt Slider

Hello All,

I am new to ROS, I need help regarding implementation of qt-slider in ros.

Can any one help me or give suggestions, thanks in advance.

I have qt source files: Please have a look:

MainWindow::MainWindow()
{
    slider = new QSlider(Qt::Horizontal);
    slider->setMinimum(0);
    slider->setMaximum(100);
    lineEdit = new QLineEdit();

QLineEdit();

    QObject::connect(slider, SIGNAL(valueChanged(int)),
                  this, SLOT(onValueChanged(int)));

 QVBoxLayout *layout = new QVBoxLayout();
 layout->addWidget(slider);
 layout->addWidget(lineEdit);

 QWidget *wrapper = new QWidget();
 wrapper->setLayout(layout);
 setCentralWidget(wrapper);

}

} MainWindow::~MainWindow() { }

} void MainWindow::onValueChanged(int value)

{

value)

{

    int pos = slider->sliderPosition();
 QByteArray convertedValue = QByteArray::number(pos,16);
 QString m = QString(convertedValue);
 m= "0x"+m;
 QString id,len;
 id="0x01 ";
 len="0x01 ";
 canmsg=id+len+m;
 lineEdit->setText(canmsg);

}

} int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow mainWindow; mainWindow.show(); return app.exec(); }

}

Can any one help me to publish this message(i mean canmsg) on topic(any). As discussed in qt ros, I made changes in cmakelist.txt. Thanks for reading.

Suggestions- Publishing data on a topic using Qt Slider

Hello All,

I am new to ROS, I need help regarding implementation of qt-slider in ros.

Can any one help me or give suggestions, thanks in advance.

I have qt source files: Please have a look:

MainWindow::MainWindow()
{
    slider = new QSlider(Qt::Horizontal);
    slider->setMinimum(0);
    slider->setMaximum(100);
    lineEdit = new QLineEdit();

    QObject::connect(slider, SIGNAL(valueChanged(int)),
                     this, SLOT(onValueChanged(int)));

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(slider);
    layout->addWidget(lineEdit);

    QWidget *wrapper = new QWidget();
    wrapper->setLayout(layout);
    setCentralWidget(wrapper);
}

MainWindow::~MainWindow()
{
}

void MainWindow::onValueChanged(int value)
 {
     int pos = slider->sliderPosition();
    QByteArray convertedValue = QByteArray::number(pos,16);
    QString m = QString(convertedValue);
    m= "0x"+m;
    QString id,len;
    id="0x01 ";
    len="0x01 ";
    canmsg=id+len+m;
    lineEdit->setText(canmsg);
}
 
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    MainWindow mainWindow;
    mainWindow.show();
    return app.exec();
}

Can any one help me to publish this message(i mean canmsg) on topic(any). As discussed in qt ros, I made changes in cmakelist.txt. Thanks for reading.

Suggestions- Publishing data on a topic using Qt Slider

Hello All,

I am new to ROS, I need help regarding implementation of qt-slider in ros.

Can any one help me or give suggestions, thanks in advance.

I have qt source files: Please have a look:

MainWindow::MainWindow()
{
    slider = new QSlider(Qt::Horizontal);
    slider->setMinimum(0);
    slider->setMaximum(100);
    lineEdit = new QLineEdit();

    QObject::connect(slider, SIGNAL(valueChanged(int)),
                     this, SLOT(onValueChanged(int)));

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(slider);
    layout->addWidget(lineEdit);

    QWidget *wrapper = new QWidget();
    wrapper->setLayout(layout);
    setCentralWidget(wrapper);
}

MainWindow::~MainWindow()
{
}

void MainWindow::onValueChanged(int value)
{
    int pos = slider->sliderPosition();
    QByteArray convertedValue = QByteArray::number(pos,16);
    QString m = QString(convertedValue);
    m= "0x"+m;
    QString id,len;
id,len, canmsg;
    id="0x01 ";
    len="0x01 ";
    canmsg=id+len+m;
    lineEdit->setText(canmsg);
}

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    MainWindow mainWindow;
    mainWindow.show();
    return app.exec();
}

Can any one help me to publish this message(i mean canmsg) 'canmsg') on topic(any). As discussed in qt ros, I made changes in cmakelist.txt. Thanks for reading.