Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    3
    5
    10186
    Loading More Posts
    • 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
      MisteKiste last edited by

      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 Reply Quote 0
      • p3c0
        p3c0 Moderators last edited by

        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 Reply Quote 0
        • M
          MisteKiste last edited by

          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 Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 3
            • M
              MisteKiste last edited by

              Great, that's working. Thanks!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post