Wasabi
21st September 2010, 20:20
This'll be easier if I start with the code:
//FaultLine.h
class Dialog : public QDialog
{
//...
private:
Dialog();
Dialog(QWidget* parent,Qt::WindowFlags f);
Dialog(const QWidget& parent,Qt::WindowFlags f);
};
class Canvas : public QWidget
{
//...
};
//Canvas.cpp
#include "FaultLine.h"
//...
void Canvas::HorizonDialog()
{
Dialog* dlg = new Dialog(this);
//...
}
//...
//Dialog.cpp
//...
#include "FaultLine.h"
Dialog::Dialog()
{
}
Dialog::Dialog(QWidget* parent=0, Qt::WindowFlags f=0) : QDialog(parent,f)
{
this->setLayout(&Layout);
}
The following code does not compile correctly. In ::HorizonDialog(), I get a "cannot convert parameter 1 from 'Canvas *const ' to 'const Dialog &'" when trying to allocate a new Dialog. I've tried using a copy-constructor (which obviously doesn't work), overloading the operator=, changing the argument to "*this", and a few other things. I was certain this was a C++ error (I still wouldn't be surprised if it is), but the people over at the cplusplus.com forums have so far been unable to find the error. So, in the off-chance that this is somehow related to qmake, I'm also asking here.
Help, please?
As well, substituting the current construction for the default ("new Dialog()") compiles just fine.
//FaultLine.h
class Dialog : public QDialog
{
//...
private:
Dialog();
Dialog(QWidget* parent,Qt::WindowFlags f);
Dialog(const QWidget& parent,Qt::WindowFlags f);
};
class Canvas : public QWidget
{
//...
};
//Canvas.cpp
#include "FaultLine.h"
//...
void Canvas::HorizonDialog()
{
Dialog* dlg = new Dialog(this);
//...
}
//...
//Dialog.cpp
//...
#include "FaultLine.h"
Dialog::Dialog()
{
}
Dialog::Dialog(QWidget* parent=0, Qt::WindowFlags f=0) : QDialog(parent,f)
{
this->setLayout(&Layout);
}
The following code does not compile correctly. In ::HorizonDialog(), I get a "cannot convert parameter 1 from 'Canvas *const ' to 'const Dialog &'" when trying to allocate a new Dialog. I've tried using a copy-constructor (which obviously doesn't work), overloading the operator=, changing the argument to "*this", and a few other things. I was certain this was a C++ error (I still wouldn't be surprised if it is), but the people over at the cplusplus.com forums have so far been unable to find the error. So, in the off-chance that this is somehow related to qmake, I'm also asking here.
Help, please?
As well, substituting the current construction for the default ("new Dialog()") compiles just fine.