Results 1 to 5 of 5

Thread: Qt 4.7 : error: call of overloaded ‘QString(int)’ is ambiguous

  1. #1
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Qt 4.7 : error: call of overloaded ‘QString(int)’ is ambiguous

    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
    Qt Code:
    1. class Ui_Jobs
    2. {
    3. public:
    4. ...
    5. Physical *widgetJobTemperatur;
    6. ...
    7. void setupUi(QDialog *Jobs)
    8. {
    9.  
    10. ...
    11.  
    12. widgetJobTemperatur = new Form(Jobs); //Compiler stops here..
    13. widgetJobTemperatur->setObjectName(QString::fromUtf8("widgetJobTemperatur"));
    14. widgetJobTemperatur->setGeometry(QRect(110, 197, 217, 117));
    15. }
    16.  
    17. }
    To copy to clipboard, switch view to plain text mode 
    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..)
    Last edited by Astronomy; 25th September 2010 at 12:27.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Qt 4.7 : error: call of overloaded ‘QString(int)’ is ambiguous

    Please post the constructor of the class Form.

  3. #3
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.7 : error: call of overloaded ‘QString(int)’ is ambiguous

    Header:
    Qt Code:
    1. class Form : public QWidget {
    2. Q_OBJECT
    3. public:
    4. Form(QWidget *parent = 0, QString Name=0);
    5. ~Form();
    6. ...
    7. void SetName(QString strName);
    8. ...
    9. }
    To copy to clipboard, switch view to plain text mode 

    and cpp:



    Qt Code:
    1. #include "form.h"
    2. #include "ui_form.h"
    3.  
    4. Form::Form(QWidget *parent,QString Name) : QWidget(parent), m_ui(new Ui::Form)
    5. {
    6. m_ui->setupUi(this);
    7. //MyValue = 0.0;
    8. IndexMin = 0;
    9. IndexMax = 0;
    10. IsStepsizeEnabled = true;
    11.  
    12. SetName(Name);
    13. CheckConstVariy();
    14. }
    15.  
    16. Form::~Form()
    17. {
    18. delete m_ui;
    19. }
    20.  
    21. void Form::SetName(QString strName)
    22. {
    23. m_ui->PhysName->setText( strName );
    24. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.7 : error: call of overloaded ‘QString(int)’ is ambiguous

    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..
    Attached Images Attached Images
    Last edited by Astronomy; 25th September 2010 at 13:09.

  5. #5
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: Qt 4.7 : error: call of overloaded ‘QString(int)’ is ambiguous

    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...

    Qt Code:
    1. void Tab1::on_pushButtonSelectFiles_clicked()
    2. {
    3. QString Dir = G_cWorkSpace.fiModelsDirectory.absoluteFilePath(); //caused the error
    4. QFileDialog dialog( this,Dir,"(*.inp)");
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 

    changing it to:

    Qt Code:
    1. void Tab1::on_pushButtonSelectFiles_clicked()
    2. {
    3. QString Dir;
    4. Dir = G_cWorkSpace.fiModelsDirectory.absoluteFilePath(); // problem solved
    5. QFileDialog dialog( this,Dir,"(*.inp)");
    6. ...
    7. }
    To copy to clipboard, switch view to plain text mode 

    solved the problem

    thanx & greetz to All,
    Astronomy
    Last edited by Astronomy; 25th September 2010 at 13:05.

Similar Threads

  1. Replies: 4
    Last Post: 24th August 2010, 15:28
  2. Replies: 5
    Last Post: 30th December 2009, 23:40
  3. call function as Qstring
    By jcr in forum Qt Programming
    Replies: 1
    Last Post: 30th May 2009, 01:35
  4. virtual overloaded functions and base class function call...
    By nouknouk in forum General Programming
    Replies: 7
    Last Post: 11th March 2006, 21:26
  5. ambiguous call to overloaded function
    By :db:sStrong in forum Qt Programming
    Replies: 18
    Last Post: 10th February 2006, 09:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.