Hello,
I have this fantastic class like this:
{
Q_OBJECT
public:"
//etc, etc
signals:
matrixChanged(D3DXMATRIX const & matrix);
};
class MyDialog : public QDialog
{
Q_OBJECT
public:"
//etc, etc
signals:
matrixChanged(D3DXMATRIX const & matrix);
};
To copy to clipboard, switch view to plain text mode
and my happy class using this dialog. defined like this:
{
Q_OBJECT
public:
void ShowDialog();
private slots:
void OnMatrixChanged(D3DXMATRIX const & matrix);
};
class MyDialogUser : public QItemDelegate
{
Q_OBJECT
public:
void ShowDialog();
private slots:
void OnMatrixChanged(D3DXMATRIX const & matrix);
};
To copy to clipboard, switch view to plain text mode
Now, I connect these signals in the method called ShowDialog. After a debugging the Qt
meta object I discovered the only way this works is to do it like this:
//implementation of ShowDialog
void MyDialogUser::ShowDialog()
{
MyDialog dlg;
connect(&dlg, SIGNAL(matrixChanged(D3DXMATRIX)), this, SLOT(OnMatrixChanged(D3DXMATRIX)));
dlg.exec();
}
//implementation of ShowDialog
void MyDialogUser::ShowDialog()
{
MyDialog dlg;
connect(&dlg, SIGNAL(matrixChanged(D3DXMATRIX)), this, SLOT(OnMatrixChanged(D3DXMATRIX)));
dlg.exec();
}
To copy to clipboard, switch view to plain text mode
However I would expect (just see some Qt samples) that, regarding the definition of my slot and signal, I am supposed to do it like this:
void MyDialogUser::ShowDialog()
{
MyDialog dlg;
connect(&dlg, SIGNAL(matrixChanged(D3DXMATRIX const &)), this, SLOT(OnMatrixChanged(D3DXMATRIX const &)));
dlg.exec();
}
void MyDialogUser::ShowDialog()
{
MyDialog dlg;
connect(&dlg, SIGNAL(matrixChanged(D3DXMATRIX const &)), this, SLOT(OnMatrixChanged(D3DXMATRIX const &)));
dlg.exec();
}
To copy to clipboard, switch view to plain text mode
Is there some explanation for this? Am I doing something wrong in the function definitions? In all other cases I do it in the second way, but only in this class I discovered this thing...
Regards,
Arthur
Bookmarks