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. Call function by change index in combobox
Qt 6.11 is out! See what's new in the release blog

Call function by change index in combobox

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.5k Views 1 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
    absfrm
    wrote on last edited by
    #1

    Hi
    I want to call a function by changing Current index in my ComboBox

    I wrote this code :
    @
    void publisher::on_cmb_subj_currentIndexChanged(const QString &arg1)
    {
    myloader();
    }
    @

    but this is not work!!

    If You Want You Can!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      What is the name of your combobox?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Personally, I prefer to connect my signals and slots explicitly. Did you connect yourself, or...? And you did connect yourself, what did the connect statement return?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          absfrm
          wrote on last edited by
          #4

          hi
          my combobox name is cmb_subj

          i like to use connect signals and slots.
          how can i connect my cmb_subj signal (current index changed) and my slot call a function.

          thanks

          If You Want You Can!

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            AFAIK, underscores result in problems with automatic signal-slot connection. One of the reasons I don't like that mechanism at all...

            Instead, just explicitly connect the signal to the slot in your constructor (just after the ui.setupUi(this); call), and it will work. If you need help with the syntax, refer to the [[doc:QObject]] documentation.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              absfrm
              wrote on last edited by
              #6

              thanks Andre
              It's work

              If You Want You Can!

              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