Unable to connect QDial to QLCDNumber
-
Hello community,
I created both items in the .ui graphical tool. No way to connect them. No idea what did I wrong.
Please, somebody so kind to help me?
here is my code#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QObject> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QDebug> //QLCDNumber , QDial MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); /* dialCels is the QDial and lcdCels the QLCDNumber*/ qDebug() << "Connected? " << connect(ui->dialCels, SIGNAL(ValueChanged(int)), ui->lcdCels, SLOT(display(int)) ); } MainWindow::~MainWindow() { delete ui; }Thanks in advance
-
Hi and welcome to devnet,
You have a typo, it's valueChanged.
You should use Qt 5 new syntax, it would have failed at build time.
Note that you should also see a warning in the application output at runtime in your case. -
Because you are using the old syntax. See the documentation here.
-
Because you are using the old syntax. See the documentation here.