PDA

View Full Version : Problem with a combobox



Tindor
22nd November 2006, 19:09
Hi,
I'm quite e newbie in QT, that's why I need your help for a combobox.
I wrote this piece of code :
line_Width_Box=new QComboBox(butoni);
widths << "0.10" << "0.15" << "0.20" << "0.25" << "0.30" << "0.35" << "0.40" << "0.45" << "0.50"
<< "0.75" << "1.00" << "1.25" << "1.50" << "1.75" << "2.0";
line_Width_Box->addItems(widths);
connect(line_Width_Box, SIGNAL(highlighted(index)), this, SLOT(setLineWidth(index)));
butoni->addWidget(lineLabel);
butoni->addWidget(line_Width_Box);

It compiles with no problem, but on runtime I get the message :
Object::connect: No such signal QComboBox::highlighted(index)

setLineWidth(index) is supposed to just change the text of a label, that's why I don't post it here.
And the idea of this combo box is to present the user a list of line widths to be used when drawing primitives.
Any help will be greatly appreciated :)

jpn
22nd November 2006, 19:14
It should be:


connect(line_Width_Box, SIGNAL(highlighted(int)), this, SLOT(setLineWidth(int)));

The signal and slot parameters must not contain any variable names, only the type, in the connect statement.

Tindor
22nd November 2006, 19:18
Thank you very much ! :)