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)
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)