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. QObject::connect: Cannot connect (null)::clicked() to ScanFrame::OnBtnStartScanClicked()
Qt 6.11 is out! See what's new in the release blog

QObject::connect: Cannot connect (null)::clicked() to ScanFrame::OnBtnStartScanClicked()

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 4 Posters 6.0k Views 2 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.
  • jsulmJ jsulm

    @Kira said in QObject::connect: Cannot connect (null)::clicked() to ScanFrame::OnBtnStartScanClicked():

    btnStart

    Is this really initialised?

    KiraK Offline
    KiraK Offline
    Kira
    wrote on last edited by
    #6

    @jsulm : Its part of qtdesigner.

    1 Reply Last reply
    0
    • J.HilkJ J.Hilk

      @Kira
      what exactly is the error/warning message and is there a difference, when you change it to Qt5-Syntax?

      KiraK Offline
      KiraK Offline
      Kira
      wrote on last edited by
      #7

      @J-Hilk : Ok thanks will try it

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

        Hi,

        Don't forget to call setupUi from the ui object otherwise you are not going to get what you expect.

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

        KiraK 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          Don't forget to call setupUi from the ui object otherwise you are not going to get what you expect.

          KiraK Offline
          KiraK Offline
          Kira
          wrote on last edited by
          #9

          @SGaist : Its being called _ui->setupUi(this);

          1 Reply Last reply
          0
          • KiraK Offline
            KiraK Offline
            Kira
            wrote on last edited by
            #10

            @jsulm: Also I am trying to display image on QLabel its not being displayed.
            I checked the slot is being called but the image is not being displayed.
            Please refer to the below slot code.

            QPixmap pix;
            pix.load("cat.jpg");
            pix.scaled(_ui->lblROICamera->size(), Qt::KeepAspectRatio);
            
            _ui->lblCamera->setPixmap(QPixmap::fromImage(img));
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #11

              Because the path to that picture is relative so unless you have that file in the same folder as the executable, it won't be loaded.

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

              KiraK 1 Reply Last reply
              1
              • SGaistS SGaist

                Because the path to that picture is relative so unless you have that file in the same folder as the executable, it won't be loaded.

                KiraK Offline
                KiraK Offline
                Kira
                wrote on last edited by Kira
                #12

                @SGaist :its present. I verified, actually, I haved worked with images multiple times, don't know y its showing strange behavior;

                J.HilkJ 1 Reply Last reply
                0
                • KiraK Kira

                  @SGaist :its present. I verified, actually, I haved worked with images multiple times, don't know y its showing strange behavior;

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #13

                  @Kira said in QObject::connect: Cannot connect (null)::clicked() to ScanFrame::OnBtnStartScanClicked():

                  its present

                  executable, not project file!


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  KiraK 1 Reply Last reply
                  0
                  • J.HilkJ J.Hilk

                    @Kira said in QObject::connect: Cannot connect (null)::clicked() to ScanFrame::OnBtnStartScanClicked():

                    its present

                    executable, not project file!

                    KiraK Offline
                    KiraK Offline
                    Kira
                    wrote on last edited by
                    #14

                    @J-Hilk :ohh.
                    Executable is being generated but its not in the debug folder. I have provided a separated folder for the exe file

                    jsulmJ 1 Reply Last reply
                    0
                    • KiraK Kira

                      @J-Hilk :ohh.
                      Executable is being generated but its not in the debug folder. I have provided a separated folder for the exe file

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #15

                      @Kira Is the image in the SAME directory as the executable?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      KiraK 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Kira Is the image in the SAME directory as the executable?

                        KiraK Offline
                        KiraK Offline
                        Kira
                        wrote on last edited by
                        #16

                        @jsulm : One more thing I am using a promoted widget which is QFrame consisting of QLabel and QPushbutton.
                        When I put label in the base class the image gets displayed but when I write the same code in the promoted widget it is not being displayed.

                        Base Widget label:

                        46b95296-4de9-412f-9410-7db732aecf53-image.png

                        After pasting the similar code in promoted widget:
                        3c33320b-13e2-4bc4-864b-27902375a7ad-image.png

                        jsulmJ 1 Reply Last reply
                        0
                        • KiraK Kira

                          @jsulm : One more thing I am using a promoted widget which is QFrame consisting of QLabel and QPushbutton.
                          When I put label in the base class the image gets displayed but when I write the same code in the promoted widget it is not being displayed.

                          Base Widget label:

                          46b95296-4de9-412f-9410-7db732aecf53-image.png

                          After pasting the similar code in promoted widget:
                          3c33320b-13e2-4bc4-864b-27902375a7ad-image.png

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #17

                          @Kira Without code I have no idea...

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          KiraK 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @Kira Without code I have no idea...

                            KiraK Offline
                            KiraK Offline
                            Kira
                            wrote on last edited by
                            #18

                            @jsulm : Every connect statement I get a warning : avoid unnamed object with custom constructor and destructor.
                            Also, I also figured the problem is in the slot of the promoted widget. When I try to write the code to display the image in constructor it works fine but when I add the same code in the slot it failed to display the image.
                            I have also checked that the slot is invoked every time by placing a breakpoint in the respective slot.

                            jsulmJ 1 Reply Last reply
                            0
                            • KiraK Kira

                              @jsulm : Every connect statement I get a warning : avoid unnamed object with custom constructor and destructor.
                              Also, I also figured the problem is in the slot of the promoted widget. When I try to write the code to display the image in constructor it works fine but when I add the same code in the slot it failed to display the image.
                              I have also checked that the slot is invoked every time by placing a breakpoint in the respective slot.

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #19

                              @Kira Sorry, without code and exact error messages others can only guess...

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              KiraK 1 Reply Last reply
                              2
                              • jsulmJ jsulm

                                @Kira Sorry, without code and exact error messages others can only guess...

                                KiraK Offline
                                KiraK Offline
                                Kira
                                wrote on last edited by
                                #20

                                @jsulm : Thanks for highlighting the issue.
                                As mentioned earlier, I had created a base widget and promoted widget.
                                In the designer, I promoted the widget, and in the class file of the base widget, I created an object of the promoted widget to pass some initialization parameter. There I called the signal to slot connection.

                                I finally figured that the connections start working after I added them after
                                _ui->setupUi(this); or called them in showEvent().
                                Since _ui->setupUi(this); is declared in the constructor of the promoted widget. I never thought this could be the issue.
                                I finally got the example working by adding them in the showEvent()

                                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