Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unable to connect QDial to QLCDNumber

Unable to connect QDial to QLCDNumber

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 624 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Josz
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • J Offline
        J Offline
        Josz
        wrote on last edited by
        #3

        Thank you very much SGaist, my fail was that I wrote ValueChanged instead valueChanged :-(.

        I wonder, why did not the compiler warn me?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Because you are using the old syntax. See the documentation here.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          2
          • SGaistS SGaist

            Because you are using the old syntax. See the documentation here.

            J Offline
            J Offline
            Josz
            wrote on last edited by
            #5

            @SGaist Thank you again.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved