QComboBox Signals doesn't invoke the called function
I'm using PyQt .
I had two comboboxes . First combobox has seven commands as text . Each command has its own options . ( i'll put options in the second combobox )
if user clicks commands combobox , then only the second combobox should appear with appropriate options loaded on it.
To do this action , i've tried to connect the 'changing' event with the function that implements the second combobox .
But , the function doesn't get invoked ..... ( i can't figure out what problem is )
i'll paste the code here :
Code:
self.connect(self.command,QtCore.SIGNAL('editTextChanged()'),self.optionopen)
called function :
Code:
def optionopen(self):
self.
optionlab=QtGui.
QLabel('Option:',self
) self.loc.addWidget(self.optionlab,4,10)
self.loc.addWidget(self.option,4,14)
self.option.insertItems(268,list)
self.setLayout(self.loc)
I've tried out following functions:
changeEvent()
activated()
currentIndexChanged()
and finally
editTextChanged()
Plz , help me out .....
Any suggestions are welcome....
Re: QComboBox Signals doesn't invoke the called function
Code:
self.connect(self.command,QtCore.SIGNAL('editTextChanged()'),self.optionopen)
I haven't done anything with python, so I don't know anything about it syntax, but where is the SLOT() parameter?
if optionopen() is a slot, it should be defined as such, and also in the connect statement it should be given as QtCore.SLOT().
Re: QComboBox Signals doesn't invoke the called function
usually , i didn't give SLOT() parameter in python ( in c++ , i did give )
I've implemented a push button previously , connected it to a function processimg as:
Code:
self.connect(self.process,QtCore.SIGNAL('clicked()'),self.processimg)
It worked superb ....
but this function doesn't get invoked .
proper function for event changing of a combobox ?
Re: QComboBox Signals doesn't invoke the called function
all the signals you mentioned have a prameter, yet in your code your are connecting a signal without parameters, which does not exist - look in your console or debug output for any runtim signal/slot warnings.
Also, I would use the signal: void currentIndexChanged ( const QString & text ).
Re: QComboBox Signals doesn't invoke the called function
As you mentioned , i tried to give parameters to the signal
TypeError: C++ type 'argument' is not supported as a slot argument type
( i think i should figure out a way to provide slots in python)
Well , thank u for your instant replies :o
Re: QComboBox Signals doesn't invoke the called function
Hey,
What does connection operation return?I mean,maybe there is a problem with the slot execution rather then with connection establishment. Try to place a print("Slot is called") or smth. to check it...
Re: QComboBox Signals doesn't invoke the called function
thank u alex, that was a good idea .
And i have done that => The slot itself is not called
It is a mistake in calling statement . Still can't figure out
Added after 40 minutes:
i Got itttttttttt.
It's simple :
Code:
self.connect(self.command,QtCore.SIGNAL('activated(QString)'),self.optionopen)
Just passed QString as a parameter . ( When i used QtCore.SLOT('optionopen(self)') , it didn't work . )