Results 1 to 2 of 2

Thread: currentTextChanged ComboBox

  1. #1
    Join Date
    Feb 2018
    Qt products

    Default currentTextChanged ComboBox

    Hi, I have to change label text when I change combobox value. I used this method
    Qt Code:
    1. void MainWindow::on_cb_regioni_currentIndexChanged(const QString &arg1)
    2. {
    3. ui->lb_regione->setText(arg1);
    4. }
    To copy to clipboard, switch view to plain text mode 

    When I change the combobox nothing happens.
    I tried to debug it, but this method is never called.

    Thanks everybody.

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 847 Times in 834 Posts
    Qt products

    Default Re: currentTextChanged ComboBox

    It looks like you are trying to use Qt MOC's automatic connection feature. This will not work if you do not spell the name of the widget exactly the same in your code and in Qt Designer (the .ui file).

    It also will not work if the combobox is not a child of your QMainWindow class (that is, if you make a separate QWidget-based class as the "central widget" with its own .ui file where the combobox is actually defined).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QML Combobox with QStringListModel
    By volcano in forum Qt Quick
    Replies: 3
    Last Post: 29th November 2016, 06:59
  2. how do I use comboBox
    By QT++ in forum Newbie
    Replies: 5
    Last Post: 2nd July 2013, 14:13
  3. Help ComboBox
    By vinny gracindo in forum Newbie
    Replies: 3
    Last Post: 20th November 2009, 19:41
  4. Imitating a ComboBox
    By metalinspired in forum Newbie
    Replies: 8
    Last Post: 16th August 2009, 14:43
  5. ComboBox of bmp:s
    By SailinShoes in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2008, 15:22


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.