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. [SOLVED] QCombobox: setCurrentIndex without emit the signal currentIndexChanged?

[SOLVED] QCombobox: setCurrentIndex without emit the signal currentIndexChanged?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 11.3k Views
  • 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.
  • M Offline
    M Offline
    MisteKiste
    wrote on last edited by
    #1

    Hey guys,

    I have a simple question. How can I set a new index for a QCombobox with setCurrentIndex without emit the signal currentIndexChanged. So I only need to fire the signal on user interaction.

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      You can disconnect the signal to slot connection using "disconnect()":http://qt-project.org/doc/qt-5/qobject.html#disconnect ?
      And then activate it again by "connect()":http://qt-project.org/doc/qt-5/qobject.html#connect when required.

      157

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MisteKiste
        wrote on last edited by
        #3

        Hey thanks for your reply. Disconnecting works but I cant reconnect with signal. I tried it like before:

        @connect(combo, SIGNAL(currentIndexChanged( const qint32 &)),this, SLOT (combo_currentIndexChanged (const qint32 &)));@

        :(

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

          Hi,

          There's also "blockSignals":http://qt-project.org/doc/qt-5/qobject.html#blockSignals that you could use.

          Hope it helps

          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
          3
          • M Offline
            M Offline
            MisteKiste
            wrote on last edited by
            #5

            Great, that's working. Thanks!

            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