[Qt-interest] ComboBox Item Match

ami guru dosto.walla at gmail.com
Thu Mar 12 12:19:33 CET 2009


Hello,


I am trying to set the item in the combo box to be selected based on the
signal of another widget.


But the index is always returning -1.


The code snippet is as follows:


connect(ui.glWidget,SIGNAL(lightChanged(QString)),this,SLOT(setComboText(QString)));


***********************slot***********************************
void GLPrimitiveMainWindow::setComboText(const QString &text)
{
  qDebug() << text << endl;

  int index = ui.lightTypeComboBox->findText(text);

  qDebug() << index << endl;


  //ui.lightTypeComboBox->setCurrentIndex(index);

}



The signal  that i m sending is as folows:


emit lightChanged("Directional Light");

**********************



"Directional Light" is inserted in the QComboBox in the Designer.


But the index is returning -1


Any hint would be of great help!!!!


Regards
Sajjad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090312/090b1d36/attachment.html 


More information about the Qt-interest-old mailing list