PDA

View Full Version : Qt 4.7 : error: call of overloaded ‘QString(int)’ is ambiguous



Astronomy
25th September 2010, 11:07
Hello,

today i tried to port my App from Qt 4.5.3 to Qt 4.7 (under ubuntu 32bit 10.04 )
I got several: error: call of overloaded ‘QString(int)’ is ambiguous

Detailed Error Message:
Astro_Diplom/ComaGui/ui_jobs.h: In member function ‘void Ui_Jobs::setupUi(QDialog*)’:
Astro_Diplom/ComaGui/ui_jobs.h:86: error: call of overloaded ‘QString(int)’ is ambiguous
qtsdk-2010.05/qt/include/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
qtsdk-2010.05/qt/include/QtCore/qstring.h:426: note: QString::QString(const char*)
qtsdk-2010.05/qt/include/QtCore/qstring.h:727: note: QString::QString(const QString&)
qtsdk-2010.05/qt/include/QtCore/qstring.h:106: note: QString::QString(QChar)
qtsdk-2010.05/qt/include/QtCore/qstring.h:105: note: QString::QString(const QChar*)
Astro_Diplom/ComaGui/ui_jobs.h:89: error: call of overloaded ‘QString(int)’ is ambiguous


My custom widget "Form" is inherited from QWidget...
Many Form widgets are in Jobs and..
Jobs is inherited from QDialog and the compiler stops here..

ui_jobs.h




class Ui_Jobs
{
public:
...
Physical *widgetJobTemperatur;
...
void setupUi(QDialog *Jobs)
{

...

widgetJobTemperatur = new Form(Jobs); //Compiler stops here..
widgetJobTemperatur->setObjectName(QString::fromUtf8("widgetJobTemperatur"));
widgetJobTemperatur->setGeometry(QRect(110, 197, 217, 117));
}

}
It seems that Qt4.7 is somehow more restrictive during compilation, than 4.5.3 ?
Under 4.5.3 everything is working fine..?

thank you for any hint,
Astronomy

__________________________________________________ ____________
(Form are physical widgets, i took a bad name and hadn't had time to change it..)

tbscope
25th September 2010, 11:41
Please post the constructor of the class Form.

Astronomy
25th September 2010, 12:29
Header:

class Form : public QWidget {
Q_OBJECT
public:
Form(QWidget *parent = 0, QString Name=0);
~Form();
...
void SetName(QString strName);
...
}

and cpp:





#include "form.h"
#include "ui_form.h"

Form::Form(QWidget *parent,QString Name) : QWidget(parent), m_ui(new Ui::Form)
{
m_ui->setupUi(this);
//MyValue = 0.0;
IndexMin = 0;
IndexMax = 0;
IsStepsizeEnabled = true;

SetName(Name);
CheckConstVariy();
}

Form::~Form()
{
delete m_ui;
}

void Form::SetName(QString strName)
{
m_ui->PhysName->setText( strName );
}

Astronomy
25th September 2010, 12:49
Hmm...
Maybe i'd imported some false project settings from the previous build.
Now i have undefined References.. see pic..

QListData::detach(int)
QListData::detach_grow(int*,int) ???

i'll try qmake + clean all again..

Astronomy
25th September 2010, 12:58
OK,
i have figured it out.

it was the red Line, which caused the error:
QString Dir = G_cWorkSpace.fiModelsDirectory.absoluteFilePath();
fiCalculatingDirectory is from Type: QFileInfo, in my class WORKSPACE...


void Tab1::on_pushButtonSelectFiles_clicked()
{
QString Dir = G_cWorkSpace.fiModelsDirectory.absoluteFilePath(); //caused the error
QFileDialog dialog( this,Dir,"(*.inp)");
...
}

changing it to:


void Tab1::on_pushButtonSelectFiles_clicked()
{
QString Dir;
Dir = G_cWorkSpace.fiModelsDirectory.absoluteFilePath(); // problem solved
QFileDialog dialog( this,Dir,"(*.inp)");
...
}

solved the problem :)

thanx & greetz to All,
Astronomy