0

I am working on QT Designer for the first time. I have created a combo box with IP address values in it a.b.c.d and p.q.r.s. I translated the .ui file created in QT Designer to .py file using pyuic4 tool, so that it can be used in Python project that I am developing in Visual Studio.

Now when I run my Python project, the form is opened properly, but on the selection of any value in combobox/dropdown, it isn't displaying the selected value at the top although it shows the value as selected/highlighted when I see the complete list by clicking on dropdown again. Python code doesn't seem to contain currentIndexChanged properties.

Is this usual? Do I have to write the code for such a basic functionality manually?

I tried to write it manually using the code below but this also doesn't seem to be working:

self.IPAddress_comboBox.currentIndexChanged['QString'].connect(self.handleChanged)

def handleChanged(self, text):
 index= self.IPAddress_comboBox.findText(text,QtCore.Qt.MatchFixedString) 
 if index >=0:
   self.IPAddress_comboBox.setCurrentIndex(index)

Combobox with selected value as 10.200.25.11 but displayed value is 10.200.25.10

Here I selected the value 10.200.25.11 which is displayed as highlighted but when the dropdown closes it displays 10.200.25.10 at the top. (while on qt designer, preview works fine)

MarianD
  • 13,096
  • 12
  • 42
  • 54
Tanu Jain
  • 107
  • 1
  • 3
  • 11

1 Answers1

1

There should not be quotes around the signal argument type QString:

self.IPAddress_comboBox.currentIndexChanged[QString].connect(self.handleChanged)

I'm not sure why your combo box isn't displaying the selected value at the top; that functionality works for me. If you could provide an example, that might help.

vedadev
  • 66
  • 5