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. Where is my SIGNAL ?
Forum Updated to NodeBB v4.3 + New Features

Where is my SIGNAL ?

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 4 Posters 651 Views 3 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    My objective is to track an item selection in list.
    I am using an example "btscanner" and have copied the attached "connect".
    Noticed that both SIGNAL and SLOT are same object.

    How does that work?

    I do not see any such SIGNAL definition anywhere in the original example.

    I can fill the list widget, click on an item. It highlights item in red background but my SLOT does not execute.

    BTW
    Any suggestion how to debug this ? I have the original btscanner dialog working ,but I cannot figure out how to "step thru" the working slot function.

        connect(ui->list, SIGNAL(itemActivated(QListWidgetItem*)),
                this, SLOT(itemActivated(QListWidgetItem*)));
    

    Just in case , i did try both
    itemActivated - original btscanner
    on_list_itemActivated - QtDesigner build SLOT function

    I am getting this run time error on both
    '

    lear BT devices NOW !  
    QObject::connect: No such slot MainWindow_CAT_TAB::itemActivated(QListWidgetItem*) in ../CAT_V3_backup/mainwindow_cat_tab.cpp:245
    QObject::connect:  (sender name:   'list')
    QObject::connect:  (receiver name: 'MainWindow_CAT_TAB')
    QObject::connect: No such signal QListWidget::on_list_itemActivated(QListWidgetItem*) in ../CAT_V3_backup/mainwindow_cat_tab.cpp:252
    QObject::connect:  (sender name:   'list')
    QObject::connect:  (receiver name: 'MainWindow_CAT_TAB')
    QDEBUG TRACE 
    QDEBUG TRACE TASK 
    		 SCAN  
    
    JonBJ 1 Reply Last reply
    0
    • CharbyC Charby

      I am not familiar with the Qt form editor I haven't used for years so my answer might not be accurate in that regards but from the original example, I can see that :

      • ui->list is a QListWidget instance : the itemActivated(QListWidgetItem *item) signal is defined and triggered within QListWidget
      • this is the DeviceDiscoveryDialog which declare the slots itemActivated() at line 83 in device.h and defined at line 142 in device.cpp
      • as you have seen in DeviceDiscoveryDialog ctor, itemActivated signal of ui->list is connected to the DeviceDiscoveryDialog itemActivated slot. It means that after the connection is made, whenever within ui->list logic, the itemActivated signal is emitted, DeviceDiscoveryDialog::itemActivated will be called...
      • if you need to debug, simply place a breakpoint inside the slot definition.

      Now from your console errors, one can tell that you did made the connection but neither the slot (for MainWindow_CAT_TAB) and the signal (for list) are declared. Hard to tell you much without your actual code, but you might check for instance if list is actually a pointer to QListWidget...Note that connection magic is based on mocking so you might run qmake to ensure required generated code are up to date.

      Hope this helped.

      A Offline
      A Offline
      Anonymous_Banned275
      wrote on last edited by
      #3

      @Charby ```
      Thanks for the reply.

      I believe part of the issue is - "itemActivated" is a build-in / standard SIGNAL, hence my "connect" needs to be

      connect(ui->list, SIGNAL(itemActivated(QListWidgetItem*)),
      this, SLOT(on_list_itemActivated(QListWidgetItem*)));

      It still does not execute the SLOT on_list_itemActivated.

      kshegunovK 1 Reply Last reply
      0
      • CharbyC Offline
        CharbyC Offline
        Charby
        wrote on last edited by
        #2

        I am not familiar with the Qt form editor I haven't used for years so my answer might not be accurate in that regards but from the original example, I can see that :

        • ui->list is a QListWidget instance : the itemActivated(QListWidgetItem *item) signal is defined and triggered within QListWidget
        • this is the DeviceDiscoveryDialog which declare the slots itemActivated() at line 83 in device.h and defined at line 142 in device.cpp
        • as you have seen in DeviceDiscoveryDialog ctor, itemActivated signal of ui->list is connected to the DeviceDiscoveryDialog itemActivated slot. It means that after the connection is made, whenever within ui->list logic, the itemActivated signal is emitted, DeviceDiscoveryDialog::itemActivated will be called...
        • if you need to debug, simply place a breakpoint inside the slot definition.

        Now from your console errors, one can tell that you did made the connection but neither the slot (for MainWindow_CAT_TAB) and the signal (for list) are declared. Hard to tell you much without your actual code, but you might check for instance if list is actually a pointer to QListWidget...Note that connection magic is based on mocking so you might run qmake to ensure required generated code are up to date.

        Hope this helped.

        A 1 Reply Last reply
        2
        • CharbyC Charby

          I am not familiar with the Qt form editor I haven't used for years so my answer might not be accurate in that regards but from the original example, I can see that :

          • ui->list is a QListWidget instance : the itemActivated(QListWidgetItem *item) signal is defined and triggered within QListWidget
          • this is the DeviceDiscoveryDialog which declare the slots itemActivated() at line 83 in device.h and defined at line 142 in device.cpp
          • as you have seen in DeviceDiscoveryDialog ctor, itemActivated signal of ui->list is connected to the DeviceDiscoveryDialog itemActivated slot. It means that after the connection is made, whenever within ui->list logic, the itemActivated signal is emitted, DeviceDiscoveryDialog::itemActivated will be called...
          • if you need to debug, simply place a breakpoint inside the slot definition.

          Now from your console errors, one can tell that you did made the connection but neither the slot (for MainWindow_CAT_TAB) and the signal (for list) are declared. Hard to tell you much without your actual code, but you might check for instance if list is actually a pointer to QListWidget...Note that connection magic is based on mocking so you might run qmake to ensure required generated code are up to date.

          Hope this helped.

          A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #3

          @Charby ```
          Thanks for the reply.

          I believe part of the issue is - "itemActivated" is a build-in / standard SIGNAL, hence my "connect" needs to be

          connect(ui->list, SIGNAL(itemActivated(QListWidgetItem*)),
          this, SLOT(on_list_itemActivated(QListWidgetItem*)));

          It still does not execute the SLOT on_list_itemActivated.

          kshegunovK 1 Reply Last reply
          0
          • A Anonymous_Banned275

            @Charby ```
            Thanks for the reply.

            I believe part of the issue is - "itemActivated" is a build-in / standard SIGNAL, hence my "connect" needs to be

            connect(ui->list, SIGNAL(itemActivated(QListWidgetItem*)),
            this, SLOT(on_list_itemActivated(QListWidgetItem*)));

            It still does not execute the SLOT on_list_itemActivated.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #4

            Please show the declaration of the MainWindow_CAT_TAB class.
            Also assuming c++11 compliant compiler (which is a requirement for Qt 5.6+) please provide the output of:

            qDebug() << typeid(ui->list).name() << typeid(this).name();
            

            put just before the connect call.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            1
            • A Anonymous_Banned275

              My objective is to track an item selection in list.
              I am using an example "btscanner" and have copied the attached "connect".
              Noticed that both SIGNAL and SLOT are same object.

              How does that work?

              I do not see any such SIGNAL definition anywhere in the original example.

              I can fill the list widget, click on an item. It highlights item in red background but my SLOT does not execute.

              BTW
              Any suggestion how to debug this ? I have the original btscanner dialog working ,but I cannot figure out how to "step thru" the working slot function.

                  connect(ui->list, SIGNAL(itemActivated(QListWidgetItem*)),
                          this, SLOT(itemActivated(QListWidgetItem*)));
              

              Just in case , i did try both
              itemActivated - original btscanner
              on_list_itemActivated - QtDesigner build SLOT function

              I am getting this run time error on both
              '

              lear BT devices NOW !  
              QObject::connect: No such slot MainWindow_CAT_TAB::itemActivated(QListWidgetItem*) in ../CAT_V3_backup/mainwindow_cat_tab.cpp:245
              QObject::connect:  (sender name:   'list')
              QObject::connect:  (receiver name: 'MainWindow_CAT_TAB')
              QObject::connect: No such signal QListWidget::on_list_itemActivated(QListWidgetItem*) in ../CAT_V3_backup/mainwindow_cat_tab.cpp:252
              QObject::connect:  (sender name:   'list')
              QObject::connect:  (receiver name: 'MainWindow_CAT_TAB')
              QDEBUG TRACE 
              QDEBUG TRACE TASK 
              		 SCAN  
              
              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #5

              @AnneRanch
              As stated before, e.g. https://forum.qt.io/topic/121592/please-help-with-lambda-sytax/17, life would be better for you and much easier for those who try to answer your SIGNAL/SLOT() errors if you changed to the new-style syntax, for compile-time diagnostics instead of dodgy runtime ones.

              A 2 Replies Last reply
              2
              • JonBJ JonB

                @AnneRanch
                As stated before, e.g. https://forum.qt.io/topic/121592/please-help-with-lambda-sytax/17, life would be better for you and much easier for those who try to answer your SIGNAL/SLOT() errors if you changed to the new-style syntax, for compile-time diagnostics instead of dodgy runtime ones.

                A Offline
                A Offline
                Anonymous_Banned275
                wrote on last edited by
                #6

                USER ERROR !

                The item is activated when the user clicks or double clicks on it, depending on the system configuration. I

                My "system" is configured for "double click".

                Any pointers WHERE is such , apparenlty default (?) configuration would be appreciated.

                kshegunovK 1 Reply Last reply
                1
                • A Anonymous_Banned275

                  USER ERROR !

                  The item is activated when the user clicks or double clicks on it, depending on the system configuration. I

                  My "system" is configured for "double click".

                  Any pointers WHERE is such , apparenlty default (?) configuration would be appreciated.

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by kshegunov
                  #7

                  @AnneRanch said in Where is my SIGNAL ?:

                  USER ERROR !

                  What user, what error? Please answer the questions and provide the requested information before jumping to the next one.
                  If the original problem was solved, then do say so.

                  Any pointers WHERE is such , apparenlty default (?) configuration would be appreciated.

                  Enjoy:
                  https://doc.qt.io/qt-5/qabstractitemview.html#editTriggers-prop
                  https://doc.qt.io/qt-5/qabstractitemview.html#selectionMode-prop
                  https://doc.qt.io/qt-5/qabstractitemview.html#selectionBehavior-prop

                  Read and abide by the Qt Code of Conduct

                  A 1 Reply Last reply
                  1
                  • kshegunovK kshegunov

                    @AnneRanch said in Where is my SIGNAL ?:

                    USER ERROR !

                    What user, what error? Please answer the questions and provide the requested information before jumping to the next one.
                    If the original problem was solved, then do say so.

                    Any pointers WHERE is such , apparenlty default (?) configuration would be appreciated.

                    Enjoy:
                    https://doc.qt.io/qt-5/qabstractitemview.html#editTriggers-prop
                    https://doc.qt.io/qt-5/qabstractitemview.html#selectionMode-prop
                    https://doc.qt.io/qt-5/qabstractitemview.html#selectionBehavior-prop

                    A Offline
                    A Offline
                    Anonymous_Banned275
                    wrote on last edited by
                    #8

                    @kshegunov said in Where is my SIGNAL ?:

                    @AnneRanch said in Where is my SIGNAL ?:

                    USER ERROR !

                    What user, what error? Please answer the questions and provide the requested information before jumping to the next one.
                    If the original problem was solved, then do say so.

                    Any pointers WHERE is such , apparenlty default (?) configuration would be appreciated.

                    Enjoy:
                    https://doc.qt.io/qt-5/qabstractitemview.html#editTriggers-prop
                    https://doc.qt.io/qt-5/qabstractitemview.html#selectionMode-prop
                    https://doc.qt.io/qt-5/qabstractitemview.html#selectionBehavior-prop

                    Links are appreciated. How about an real sample / example ?
                    Say "verify single or double click on (abstract ) item "?

                    Problem was identified (USER was using single click ...) , so why "going back " is of an value ?
                    Move forward to other pressing issues...

                    kshegunovK 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @AnneRanch
                      As stated before, e.g. https://forum.qt.io/topic/121592/please-help-with-lambda-sytax/17, life would be better for you and much easier for those who try to answer your SIGNAL/SLOT() errors if you changed to the new-style syntax, for compile-time diagnostics instead of dodgy runtime ones.

                      A Offline
                      A Offline
                      Anonymous_Banned275
                      wrote on last edited by
                      #9

                      @JonB said in Where is my SIGNAL ?:

                      @AnneRanch
                      As stated before, e.g. https://forum.qt.io/topic/121592/please-help-with-lambda-sytax/17, life would be better for you and much easier for those who try to answer your SIGNAL/SLOT() errors if you changed to the new-style syntax, for compile-time diagnostics instead of dodgy runtime ones.

                      Noting to do with connect , user error expecting "normal" single click to work.
                      I guess Qt default is different. Lesson learn - do not assume anything ( in Qt. ) .

                      1 Reply Last reply
                      0
                      • A Anonymous_Banned275

                        @kshegunov said in Where is my SIGNAL ?:

                        @AnneRanch said in Where is my SIGNAL ?:

                        USER ERROR !

                        What user, what error? Please answer the questions and provide the requested information before jumping to the next one.
                        If the original problem was solved, then do say so.

                        Any pointers WHERE is such , apparenlty default (?) configuration would be appreciated.

                        Enjoy:
                        https://doc.qt.io/qt-5/qabstractitemview.html#editTriggers-prop
                        https://doc.qt.io/qt-5/qabstractitemview.html#selectionMode-prop
                        https://doc.qt.io/qt-5/qabstractitemview.html#selectionBehavior-prop

                        Links are appreciated. How about an real sample / example ?
                        Say "verify single or double click on (abstract ) item "?

                        Problem was identified (USER was using single click ...) , so why "going back " is of an value ?
                        Move forward to other pressing issues...

                        kshegunovK Offline
                        kshegunovK Offline
                        kshegunov
                        Moderators
                        wrote on last edited by
                        #10

                        @AnneRanch said in Where is my SIGNAL ?:

                        How about an real sample / example ?

                        No thanks, I'm good.

                        Say "verify single or double click on (abstract ) item "?

                        I have nothing to verify, really, as I said, I'm good.

                        Problem was identified (USER was using single click ...) , so why "going back " is of an value ?
                        Move forward to other pressing issues...

                        This isn't the problem from the above description, and as you're not taking any time to solve a/the original problem you're learning nothing. We even have a jargon for the kind of code penalty this behavior produces/encourages - "technical debt".

                        Ultimately, the decision is yours to make, but you should now convince me why I should spare my precious time to teach you anything, if you're all about cutting corners, not after learning things ... the ball is in your court, gal.


                        PS.
                        Free advice, take it if you will:

                        Don't try to rush trough coding, especially when you have relatively little idea of what you're doing.

                        As for the more "soft" side of things, I'm not easily irked, but responses are going to ebb really quickly if you just ignore people's posts. We (people) don't like being ignored, especially after we have invested interest/time/effort. What usually happens is you're going to get ignored back ... that is to say, all this has happened before ...

                        Read and abide by the Qt Code of Conduct

                        1 Reply Last reply
                        4
                        • A Offline
                          A Offline
                          Anonymous_Banned275
                          wrote on last edited by
                          #11

                          My apology
                          as I said , I am using example "btscanner" as a guide.
                          Basically trying to logically go thru the bluetooth process.
                          Since I am just "flying blind" without much commentary guidance from Qt code example I did not know that "list" selection actually "connect" to two , so far only two, functions depending on "click" or "double click".
                          Actually "list" , as coded in btscanner , can be just highlighted without any SLOT being executed.

                          kshegunovK 1 Reply Last reply
                          0
                          • A Anonymous_Banned275

                            My apology
                            as I said , I am using example "btscanner" as a guide.
                            Basically trying to logically go thru the bluetooth process.
                            Since I am just "flying blind" without much commentary guidance from Qt code example I did not know that "list" selection actually "connect" to two , so far only two, functions depending on "click" or "double click".
                            Actually "list" , as coded in btscanner , can be just highlighted without any SLOT being executed.

                            kshegunovK Offline
                            kshegunovK Offline
                            kshegunov
                            Moderators
                            wrote on last edited by kshegunov
                            #12

                            @AnneRanch said in Where is my SIGNAL ?:

                            My apology

                            Not what I seek, and it's really beside the point. The point is you should invest the time to read through the description(s) of the classes and examples you're currently trying out, not flail about mismatched expectations. There's this peculiar russian expression (derived from a joke*): чукча писатель, чукча не читатель, so don't be like the humorous protagonist is the takeaway.

                            Basically trying to logically go thru the bluetooth process.

                            Okay, this is fine, but it seems to me you haven't the understanding (yet, presumably) about much more basic things, like how to do signal-slot connections and how to track the errors in these.

                            Since I am just "flying blind" without much commentary guidance from Qt code example I did not know that "list" selection actually "connect" to two , so far only two, functions depending on "click" or "double click".

                            Again, jumping ahead. The selection is managed by a selection model, and the view is (usually) backed by a data model, both of which are duly described in the "model-view" section in the documentation.[1] There's also clarifications what is a delegate and why it exists.

                            Actually "list" , as coded in btscanner , can be just highlighted without any SLOT being executed.

                            Of course. The list is a list, it has no idea who's going to respond to whatever it raises as 'interesting things that happened'™ (a.k.a signals). It just does, so other objects can subscribe to the events, but there's really no reason why it itself wouldn't allow for selections/editing even so. If some object is interested in the edit operation, then it'd connect to the relevant signals, makes sense, right?

                            * The joke goes like this:
                            A chukcha decided he wanted to be writer, and he wrote a novel and he presented his novel to the editor of a printing house. The editor was a straight shooter and told the chukcha:
                            'Look, it's a weak work, you need to read more of the classics to improve. Have you read Tolstoy, Dostoyevski?'
                            To which the chukcha replied proudly:
                            'No! Chukcha is a writer, not a reader!'

                            Note: in the original russian the word for 'writer' is the same used for 'author'/'novelist' in this context.

                            [1]: https://doc.qt.io/qt-5/model-view-programming.html

                            Read and abide by the Qt Code of Conduct

                            1 Reply Last reply
                            4

                            • Login

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