PDA

View Full Version : Combobox Signals



b1
1st August 2006, 00:16
G'Day All,

I am fairly new to QT. I am using QT4.1.1 and I am having a problem with combobox signals.

I have created a widget with a multiple lineedits and comboboxes. The comboboxes are prefilled by a function that calls data from a database. This part works fine. When I click on the combobox I can select any of the line items that have been entered.
I have created a signal/slot to run a function that fills the remainder of the widgets based on the combobox selection.
However, when I press tab, enter or click another lineedit/combobox, the highlighted item remians displayed, the focus moves, but the function does not get run. It appears the signal is not emmited. I have tried each of the following to avail.

connect( comboBox_3, SIGNAL( currentIndexChanged() ), this, SLOT( readSData() ) );
connect( comboBox_3, SIGNAL( highlighted() ), this, SLOT( readSData() ) );
connect( comboBox_3, SIGNAL( returnPressed() ), this, SLOT( readSData() ) );


The "readSData()" is declared as a slot and runs if called manually.

The signal/slots used for the "lineedits" and "pushbuttons" all work correctly. It is only the "comboboxes" that don't work.

Any thoughts or suggestions would be appreciated.

Regards, rod

munna
1st August 2006, 04:18
It should be




connect( comboBox_3, SIGNAL( currentIndexChanged(int) ), this, SLOT( readSData() ) );
connect( comboBox_3, SIGNAL( highlighted(int) ), this, SLOT( readSData() ) );



There is no signal called returnPressed that is emitted by QComboBox.

jpn
1st August 2006, 10:02
There is no signal called returnPressed that is emitted by QComboBox.
You may, however, connect to combo box's internal line edit:

connect( comboBox_3->lineEdit(), SIGNAL( returnPressed() ), this, SLOT( readSData() ) );

sumsin
1st August 2006, 10:21
Have you defined th Q_OBJECT macro in your header file.