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. QComboBox(property "currentindex")
Qt 6.11 is out! See what's new in the release blog

QComboBox(property "currentindex")

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 757 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.
  • F Offline
    F Offline
    fender
    wrote on last edited by
    #1

    There are two spinboxes and a combo box on the form. The task is the following: enter the data in the spinbox1-> select the value from the combo box-> in the spinbox2, depending on the selection in the combobox, the recalculated value is written.
    How to implement using signals and slots?
    0_1527749614694_111111.PNG

    T 1 Reply Last reply
    0
    • F fender

      There are two spinboxes and a combo box on the form. The task is the following: enter the data in the spinbox1-> select the value from the combo box-> in the spinbox2, depending on the selection in the combobox, the recalculated value is written.
      How to implement using signals and slots?
      0_1527749614694_111111.PNG

      T Offline
      T Offline
      Tirupathi Korla
      wrote on last edited by
      #2

      Hi @fender
      In Qt Create Design, You should see "signals&slots Editor". mostly it will be at the bottom. you can add signals from sender to receiver. use "valueChanged()" signal for spin box and combobox. once it calls the receiver, calculate using formula by considering both spin1 and combobox values. Hope this helps

      -Tirupathi

      F 1 Reply Last reply
      3
      • T Tirupathi Korla

        Hi @fender
        In Qt Create Design, You should see "signals&slots Editor". mostly it will be at the bottom. you can add signals from sender to receiver. use "valueChanged()" signal for spin box and combobox. once it calls the receiver, calculate using formula by considering both spin1 and combobox values. Hope this helps

        -Tirupathi

        F Offline
        F Offline
        fender
        wrote on last edited by
        #3

        @Tirupathi-Korla said in QComboBox(property "currentindex"):

        Hi @fender
        In Qt Create Design, You should see "signals&slots Editor". mostly it will be at the bottom. you can add signals from sender to receiver. use "valueChanged()" signal for spin box and combobox. once it calls the receiver, calculate using formula by considering both spin1 and combobox values. Hope this helps

        -Tirupathi
        implemented like this

            double d_mu = ui->doubleSpinBox_dmu->value();
            double ro_water = ui->doubleSpinBox_ro_water->value();
            switch(ui->cbTransfer->currentIndex()){
            case 0:  ui->doubleSpinBox_mu->setValue(calc_m2c(d_mu));    break;
            case 1:  ui->doubleSpinBox_mu->setValue(calc_mm2c(d_mu));   break;
            case 2:  ui->doubleSpinBox_mu->setValue(calc_Ct(d_mu));     break;
            case 3:  ui->doubleSpinBox_mu->setValue(calc_P(d_mu, ro_water)); break;
            case 4:  ui->doubleSpinBox_mu->setValue(calc_Pas(d_mu, ro_water));break;
            }
            connect(ui->doubleSpinBox_mu, SIGNAL(valueChanged(double)), SLOT(on_cbTransfer_currentIndexChanged));
        
        
        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