Results 1 to 4 of 4

Thread: QString::arg: Argument missing

  1. #1
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QString::arg: Argument missing

    hi,
    I'm using linguist to translate the following, (environment: ubuntu,qt4.7)
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. QTranslator translator;
    6. QString txt1="text";
    7. translator.load("testLang");
    8. qApp->installTranslator(&translator);
    9. ui->setupUi(this);
    10. l=new QLabel(this);
    11. l->setText(tr("file %1").arg(txt1));
    12. }
    To copy to clipboard, switch view to plain text mode 

    But I'm getting the following warning:
    QString::arg: Argument missing: test translatedText, text
    (translatedText: The text translated in the target language.)
    what's the possible cause , how can i get rid of this?
    Thanks in advance.
    Bala
    Last edited by BalaQT; 4th May 2011 at 11:59.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QString::arg: Argument missing

    The translation probably doesn't contain "%1".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QString::arg: Argument missing

    hi master,
    Thanks for 'your reply' (thought of using 'ur reply' afraid of your infractions ).

    The translation probably doesn't contain "%1".
    In translation I'm having 'file translatedText' for the code tr(file %1).arg(txt1).
    My assumption is the translatedText will be placed in the %1. Is it right?

    Note: I'm getting the output correctly, But I want to remove the warning.
    May be a simple thing, which I'm missing completely.

    Thanks,
    Bala

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QString::arg: Argument missing

    Quote Originally Posted by BalaQT View Post
    My assumption is the translatedText will be placed in the %1. Is it right?
    No. %1 is for QString::arg() to work. And it needs to be present in the translated string as well.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 8th April 2011, 16:44
  2. argument parsing
    By deeee in forum Qt Programming
    Replies: 1
    Last Post: 26th May 2010, 22:21
  3. Error "QString::arg: Argument missing"
    By Lawand in forum Qt Programming
    Replies: 3
    Last Post: 18th February 2009, 20:26
  4. Replies: 4
    Last Post: 31st January 2008, 20:44
  5. Warning QString::arg() argument missing
    By quickNitin in forum Newbie
    Replies: 9
    Last Post: 16th November 2006, 19:13

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.