[Qt-interest] Fwd: problem with signal of QListWidget

Stephen Jackson spjackson42 at gmail.com
Sat Jun 20 20:57:13 CEST 2009


On Sat, Jun 20, 2009 at 2:17 PM, mierdatutis mi wrote:
> Thanks I try with "itemClicked"
>
> I do:
>
> connect(lista, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT(
> cambio(QListWidgetItem*)
>
> void MainWindowImpl::cambio(QListWidgetItem *c)
>
> {
>
> QMessageBox msgBox;
>
> msgBox.setText("The document has been modified.");
>
> msgBox.exec();
>
> }
>
> and in the h file
>
> class MainWindowImpl : public QMainWindow, public Ui::MainWindow
>
> {
>
> Q_OBJECT
>
> public:
>
> MainWindowImpl( QWidget * parent = 0, Qt::WFlags f = 0 );
>
> private slots:
>
> void sinopsis();
>
> void cambio(QListWidgetItem*);
>
> };
>
> #endif
>
> But doesn't works! :-(
>

The code you have shown here ought to work. The code you originally
posted using currentItemChanged ought to work.

The fault is probably in some code that you are not showing us. What
is "lista"? Is it really a pointer to your user interface QListWidget,
or is it just some local variable?

I suggest you post a complete minimal compilable example that
demonstrates your problem.

Regards,

Stephen Jackson



More information about the Qt-interest-old mailing list