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

mierdatutis mi mmm286 at gmail.com
Sat Jun 20 15:17:44 CEST 2009


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! :-(

2009/6/20 Donal O'Connor <donaloconnor at gmail.com>

> The error only shows when you run the program, it isn't during the compile
> stages.
>
> The signatures of the methods/slots are not compatible.
>
> The signal signature must be the same as the slot's.
>
> Have a read of http://doc.trolltech.com/4.5/signalsandslots.html
>
>
> On Sat, Jun 20, 2009 at 1:20 PM, mierdatutis mi <mmm286 at gmail.com> wrote:
>
>>
>> Sorry I don't understand.
>>
>> I compile with qdevlop and when I compile there is no message of slots.
>>
>> This is the code that I have:
>>
>> MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
>>
>> : QMainWindow(parent, f)
>>
>> {
>>
>> setupUi(this);
>>
>> connect(boton, SIGNAL(clicked()), this, SLOT(sinopsis()));
>>
>> connect(lista, SIGNAL( currentItemChanged ( QListWidgetItem *,
>> QListWidgetItem *)), this, SLOT(cambio()));
>>
>> }
>>
>>  void MainWindowImpl::cambio()
>>
>> {
>>
>> QMessageBox msgBox;
>>
>> msgBox.setText("The document has been modified.");
>>
>> msgBox.exec();
>>
>> }
>>
>>
>>
>> Thanks
>> Regards
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Alexis Menard <alexis.menard at trolltech.com>
>> Date: 2009/6/20
>> Subject: Re: [Qt-interest] problem with signal of QListWidget
>> To: mierdatutis mi <mmm286 at gmail.com>
>> Cc: qt-interest at trolltech.com
>>
>>
>> Look your terminal it should say if it find the slot or not.
>> You probably did a mistake in the declaration. As far as i can see the
>> signature of the signal/slot doesn't match...
>>
>> On Jun 20, 2009, at 12:41, mierdatutis mi wrote:
>>
>>
>> Hi,
>>
>> I'm trying to do a program that when I change the item selected in a list,
>> show me in a text the content file (like cat file).
>>
>> I try to do a signal with a funcion like slot but doesn't works, the
>> program doesn't go to the function "cambio".
>>
>> connect(lista, SIGNAL(currentItemChanged ( QListWidgetItem *,
>> QListWidgetItem *)), this,SLOT (cambio()));
>>
>> Any help?
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090620/802a96ce/attachment.html 


More information about the Qt-interest-old mailing list