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. currentTextChanged missing SIGNAL(s) sequence ?
Forum Updated to NodeBB v4.3 + New Features

currentTextChanged missing SIGNAL(s) sequence ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 813 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    This is a follow-up on another post.
    Very simple question.
    The Bluetooth scanner "Nearby BT devices" list gets filled via function in original example "btscanner" ( I did not write nor checked the XML code ) .
    Works as expected , but in reverse of similar scan used by "Blueman" "Device search". See f-SATA device.

    My objective is to use "currentTextChanged" SIGNAL to copy the items in
    "Nearby BT devices" list elsewhere.
    It works , but copies only the LAST item from "Nearby BT devices" list.

    It is no big loss, I can copy it manually , but like to know

    1. how is "current" text defined ? ( index 0 ??)
    2. why am I missing all but one "currentTextChanged" SIGNAL ?
    connect( DDD->ui->list,
             SIGNAL( currentTextChanged( const QString & ) ),
            this->ui->plainTextEdit_2,
             SLOT( appendPlainText( const QString & ) )
             );
    
    

    abe51a7a-a9de-479a-9bcc-663d267fe513-image.png

    sierdzioS 1 Reply Last reply
    0
    • A Anonymous_Banned275

      This is a follow-up on another post.
      Very simple question.
      The Bluetooth scanner "Nearby BT devices" list gets filled via function in original example "btscanner" ( I did not write nor checked the XML code ) .
      Works as expected , but in reverse of similar scan used by "Blueman" "Device search". See f-SATA device.

      My objective is to use "currentTextChanged" SIGNAL to copy the items in
      "Nearby BT devices" list elsewhere.
      It works , but copies only the LAST item from "Nearby BT devices" list.

      It is no big loss, I can copy it manually , but like to know

      1. how is "current" text defined ? ( index 0 ??)
      2. why am I missing all but one "currentTextChanged" SIGNAL ?
      connect( DDD->ui->list,
               SIGNAL( currentTextChanged( const QString & ) ),
              this->ui->plainTextEdit_2,
               SLOT( appendPlainText( const QString & ) )
               );
      
      

      abe51a7a-a9de-479a-9bcc-663d267fe513-image.png

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      What is your "list"? A QListWidget?

      @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

      how is "current" text defined ? ( index 0 ??)

      Current row property is defined as such: https://doc.qt.io/qt-5/qlistwidget.html#currentRow-prop

      And current text: https://doc.qt.io/qt-5/qlistwidget.html#currentTextChanged

      This is flexible, but can be broadly abbreviated to: current row is the selected row (by mouse or keyboard).

      why am I missing all but one "currentTextChanged" SIGNAL ?

      I don't know what you've got, the screenshot is completely unclear to me. Please post what you expect vs. what you've got.

      Are you changing the current row anywhere? If your goal is to populate one list based on contents of another, using currentText property is a very awkward approach. You should rather respond to signals emitted by your model(), like rowsInserted(), rowsRemoved(), modelReset().

      (Z(:^

      A 1 Reply Last reply
      2
      • sierdzioS sierdzio

        What is your "list"? A QListWidget?

        @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

        how is "current" text defined ? ( index 0 ??)

        Current row property is defined as such: https://doc.qt.io/qt-5/qlistwidget.html#currentRow-prop

        And current text: https://doc.qt.io/qt-5/qlistwidget.html#currentTextChanged

        This is flexible, but can be broadly abbreviated to: current row is the selected row (by mouse or keyboard).

        why am I missing all but one "currentTextChanged" SIGNAL ?

        I don't know what you've got, the screenshot is completely unclear to me. Please post what you expect vs. what you've got.

        Are you changing the current row anywhere? If your goal is to populate one list based on contents of another, using currentText property is a very awkward approach. You should rather respond to signals emitted by your model(), like rowsInserted(), rowsRemoved(), modelReset().

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

        @sierdzio I am asking how is "current" defined.
        Assuming the widget can hold indexed items - is "current " at index 0 ?
        Or is it the one highlighted by positioning the mouse over it ? Clicking it?

        "This is flexible, but can be broadly abbreviated to: current row is the selected row (by mouse or keyboard)."

        Just a definition of "current" is what I need because the function is filling the widget - there is no manual , by user (mouse / keyboard) , selection during fill.

        After that is clarified I may be able figure out why only LAST SIGNAL is acted upon .
        But I need to know what to monitor as "current".

        As far as "awkward" - the fill is dynamic and using "row" requires knowing the start / end. My way is KISS.

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

          @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

          Just a definition of "current" is what I need

          See https://doc.qt.io/qt-5/model-view-programming.html#current-item-and-selected-items

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

          A 1 Reply Last reply
          4
          • Christian EhrlicherC Christian Ehrlicher

            @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

            Just a definition of "current" is what I need

            See https://doc.qt.io/qt-5/model-view-programming.html#current-item-and-selected-items

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

            @Christian-Ehrlicher said in currentTextChanged missing SIGNAL(s) sequence ?:

            @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

            Just a definition of "current" is what I need

            See https://doc.qt.io/qt-5/model-view-programming.html#current-item-and-selected-items

            Using the above definitions - there is no current anything AFTER the widget is filled.

            Tracing the "add item" functions confirms that only first item "appended" to the widget is generating currentTextChanged SIGNAL for further processing,
            My guess is "current item" is indeed at index 0 and DOES not change - next items are appended - hence no more SIGNAL will be generated.

            Time to find a different way to skin the cat.

            sierdzioS 1 Reply Last reply
            0
            • A Anonymous_Banned275

              @Christian-Ehrlicher said in currentTextChanged missing SIGNAL(s) sequence ?:

              @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

              Just a definition of "current" is what I need

              See https://doc.qt.io/qt-5/model-view-programming.html#current-item-and-selected-items

              Using the above definitions - there is no current anything AFTER the widget is filled.

              Tracing the "add item" functions confirms that only first item "appended" to the widget is generating currentTextChanged SIGNAL for further processing,
              My guess is "current item" is indeed at index 0 and DOES not change - next items are appended - hence no more SIGNAL will be generated.

              Time to find a different way to skin the cat.

              sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by sierdzio
              #6

              @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

              Tracing the "add item" functions confirms that only first item "appended" to the widget is generating currentTextChanged SIGNAL for further processing,
              My guess is "current item" is indeed at index 0 and DOES not change - next items are appended - hence no more SIGNAL will be generated.

              Why "guess"? The documentation clearly says that current item changing is a result of user interaction (click, double click, keyboard arrow click, etc.). Adding or removing rows won't change it (except for adding first or removing last item - then obviously the text changes).

              Time to find a different way to skin the cat.

              As mentioned, use model() for this. It informs you exactly what, where, and how is changed. And if you want to do it simple, you can just clear your other view and load it afresh every time the model is changed.

              (Z(:^

              A 1 Reply Last reply
              2
              • sierdzioS sierdzio

                @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

                Tracing the "add item" functions confirms that only first item "appended" to the widget is generating currentTextChanged SIGNAL for further processing,
                My guess is "current item" is indeed at index 0 and DOES not change - next items are appended - hence no more SIGNAL will be generated.

                Why "guess"? The documentation clearly says that current item changing is a result of user interaction (click, double click, keyboard arrow click, etc.). Adding or removing rows won't change it (except for adding first or removing last item - then obviously the text changes).

                Time to find a different way to skin the cat.

                As mentioned, use model() for this. It informs you exactly what, where, and how is changed. And if you want to do it simple, you can just clear your other view and load it afresh every time the model is changed.

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

                @sierdzio
                OK, since you continue to re-post same argument you won't mind if I re-post mine, right?

                Why am I getting ONLY one of minimal four signals?

                Before I try model, I will "connect" to process "scan" which by the way detects non-existent bluetooth devices and passes them to the function filling the list - hence I need to fix that first anyway. ( Nothing to do with this post !)

                JonBJ sierdzioS 2 Replies Last reply
                0
                • A Anonymous_Banned275

                  @sierdzio
                  OK, since you continue to re-post same argument you won't mind if I re-post mine, right?

                  Why am I getting ONLY one of minimal four signals?

                  Before I try model, I will "connect" to process "scan" which by the way detects non-existent bluetooth devices and passes them to the function filling the list - hence I need to fix that first anyway. ( Nothing to do with this post !)

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

                  @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

                  Why am I getting ONLY one of minimal four signals?

                  Because, as per the definition of "current" text given by @sierdzio above, the current text only changes when the first item is added. That's how it works. So only one raising of the signal. You will need to pick a different signal to listen for, one emitted by the model instead.

                  1 Reply Last reply
                  4
                  • A Anonymous_Banned275

                    @sierdzio
                    OK, since you continue to re-post same argument you won't mind if I re-post mine, right?

                    Why am I getting ONLY one of minimal four signals?

                    Before I try model, I will "connect" to process "scan" which by the way detects non-existent bluetooth devices and passes them to the function filling the list - hence I need to fix that first anyway. ( Nothing to do with this post !)

                    sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #9

                    OK, since you continue to re-post same argument you won't mind if I re-post mine, right?

                    Sure, as long as we reach some understanding in the end, that is fine.

                    @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

                    Why am I getting ONLY one of minimal four signals?

                    You only change current item once (implicitly) - first when model is empty, currentText() == "". then when you add first item, currentText changes to the text of that item.

                    Then, as you keep adding more rows, currentItem does not change - it waits for user interaction to happen (or you can force it to change programmatically by changing currentItem when new row is inserted).

                    This all works exactly as documented in the docs I've linked.

                    (Z(:^

                    A 1 Reply Last reply
                    4
                    • sierdzioS sierdzio

                      OK, since you continue to re-post same argument you won't mind if I re-post mine, right?

                      Sure, as long as we reach some understanding in the end, that is fine.

                      @AnneRanch said in currentTextChanged missing SIGNAL(s) sequence ?:

                      Why am I getting ONLY one of minimal four signals?

                      You only change current item once (implicitly) - first when model is empty, currentText() == "". then when you add first item, currentText changes to the text of that item.

                      Then, as you keep adding more rows, currentItem does not change - it waits for user interaction to happen (or you can force it to change programmatically by changing currentItem when new row is inserted).

                      This all works exactly as documented in the docs I've linked.

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

                      @sierdzio said in currentTextChanged missing SIGNAL(s) sequence ?:

                      Sure, as long as we reach some understanding in the end, that is fine.

                      first when model is empty, currentText() == "". then when you add first item, currentText changes to the text of that item. AGREED

                      Then, as you keep adding more rows, currentItem does not change AGRRED which is why I posted this originally - it waits for user interaction AGREED , BUT THERE IS NO USER INTERACTION - AS CODED - to happen (or you can force it to change programmatically by changing

                      SOLVED

                      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