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. How do I make QtDesigner see slots and signals from other classes objects?
Qt 6.11 is out! See what's new in the release blog

How do I make QtDesigner see slots and signals from other classes objects?

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 6 Posters 1.9k 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.
  • mrjbomM mrjbom

    Hello.
    I created a form and added a button to it, now I want one of the objects of my classes to be able to receive a signal in its slot.
    The signals and slots editor obviously doesn't see the other objects.
    Scr12-03-2021 160358.png

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

    @mrjbom said in How do I make QtDesigner see slots and signals from other classes objects?:

    now I want one of the objects of my classes

    Where are those objects/instances created? Designer only knows about objects created inside widgets you're creating/editing in designer.

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

    mrjbomM 1 Reply Last reply
    2
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #3

      Hi
      It only shows QWidgets from the same form.
      It cant see other custom classes or anything like that.

      alt text

      So " one of the objects of my classes " means some objects you generate in code or what excatly do you mean ?

      mrjbomM 1 Reply Last reply
      2
      • jsulmJ jsulm

        @mrjbom said in How do I make QtDesigner see slots and signals from other classes objects?:

        now I want one of the objects of my classes

        Where are those objects/instances created? Designer only knows about objects created inside widgets you're creating/editing in designer.

        mrjbomM Offline
        mrjbomM Offline
        mrjbom
        wrote on last edited by
        #4

        @jsulm, in other files, how do I get QtDesigner to see them?

        artwawA 1 Reply Last reply
        0
        • mrjbomM mrjbom

          @jsulm, in other files, how do I get QtDesigner to see them?

          artwawA Offline
          artwawA Offline
          artwaw
          wrote on last edited by
          #5

          @mrjbom you don't. You should use connect method in your code.
          Allow me to re-iterate what others said:
          It only shows QWidgets from the same form

          For more information please re-read.

          Kind Regards,
          Artur

          mrjbomM 1 Reply Last reply
          1
          • mrjjM mrjj

            Hi
            It only shows QWidgets from the same form.
            It cant see other custom classes or anything like that.

            alt text

            So " one of the objects of my classes " means some objects you generate in code or what excatly do you mean ?

            mrjbomM Offline
            mrjbomM Offline
            mrjbom
            wrote on last edited by
            #6

            @mrjj said in How do I make QtDesigner see slots and signals from other classes objects?:

            one of the objects of my classes
            This means that I have created other classes and would like QtDesigner to see the objects of these classes.

            artwawA 1 Reply Last reply
            0
            • mrjbomM mrjbom

              @mrjj said in How do I make QtDesigner see slots and signals from other classes objects?:

              one of the objects of my classes
              This means that I have created other classes and would like QtDesigner to see the objects of these classes.

              artwawA Offline
              artwawA Offline
              artwaw
              wrote on last edited by
              #7

              @mrjbom usually the main window of your UI is a member of your default class (unless you changed it it is MainWindow). If you created other windows and want to connect to them you can include their header files in your main class - how to make them visible and when is what you need to code. There are some restrictions, like you should only have one QMainWindow in your program; more detail can be found in Qt Main Window Framework section of the documentation.

              For more information please re-read.

              Kind Regards,
              Artur

              1 Reply Last reply
              0
              • artwawA artwaw

                @mrjbom you don't. You should use connect method in your code.
                Allow me to re-iterate what others said:
                It only shows QWidgets from the same form

                mrjbomM Offline
                mrjbomM Offline
                mrjbom
                wrote on last edited by
                #8

                @artwaw, I expected that this could be fixed.
                Thanks for the reply.

                artwawA 1 Reply Last reply
                0
                • mrjbomM mrjbom

                  @artwaw, I expected that this could be fixed.
                  Thanks for the reply.

                  artwawA Offline
                  artwawA Offline
                  artwaw
                  wrote on last edited by
                  #9

                  @mrjbom "fixed"? There is no error.

                  For more information please re-read.

                  Kind Regards,
                  Artur

                  mrjbomM 1 Reply Last reply
                  0
                  • artwawA artwaw

                    @mrjbom "fixed"? There is no error.

                    mrjbomM Offline
                    mrjbomM Offline
                    mrjbom
                    wrote on last edited by
                    #10

                    @artwaw, I did not mean that this is an error, I meant that you can force QtDesigner to see other files.

                    Christian EhrlicherC JonBJ 2 Replies Last reply
                    0
                    • mrjbomM mrjbom

                      @artwaw, I did not mean that this is an error, I meant that you can force QtDesigner to see other files.

                      Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      @mrjbom How should this work - how should the designer know where you instantiate those (and how often, ...)?

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      mrjbomM 1 Reply Last reply
                      2
                      • mrjbomM mrjbom

                        @artwaw, I did not mean that this is an error, I meant that you can force QtDesigner to see other files.

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by JonB
                        #12

                        @mrjbom
                        The simple answer is: Don't bother to even try using that "Signal/Slot" set up thing at all in Designer! I think you will find most of us do not. Do your connect()s explicitly in code. What the Designer does is pretty limited, and can have issues. Just saying.

                        1 Reply Last reply
                        1
                        • Christian EhrlicherC Christian Ehrlicher

                          @mrjbom How should this work - how should the designer know where you instantiate those (and how often, ...)?

                          mrjbomM Offline
                          mrjbomM Offline
                          mrjbom
                          wrote on last edited by
                          #13

                          @Christian-Ehrlicher, perhaps similar to how I use " Promoted Class"

                          1 Reply Last reply
                          0
                          • Christian EhrlicherC Offline
                            Christian EhrlicherC Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            @mrjbom said in How do I make QtDesigner see slots and signals from other classes objects?:

                            perhaps similar to how I use " Promoted Class"

                            You do not understand the problem. How should the designer know how and where you create those different instances so it can somehow automatically create the connects?

                            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                            Visit the Qt Academy at https://academy.qt.io/catalog

                            1 Reply Last reply
                            2

                            • Login

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