Results 1 to 3 of 3

Thread: Showing arguments in QMessageBox::information() !

  1. #1
    Join Date
    Feb 2008
    Posts
    74
    Thanks
    31
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Showing arguments in QMessageBox::information() !

    Hello! Friends,
    I have QLineEdit in my designer form and QMessageBox::information() widget to show error's as: -
    Qt Code:
    1. QMessageBox::information( this, "Invalid Data Entered", "You have entered invalid data\n"
    2. "Valid Range is 1 - 1000\n"
    3. "Please enter valid data.", QMessageBox::Ok, 0 );
    To copy to clipboard, switch view to plain text mode 
    Now from this small client-server example you might be familiar with this: -
    Qt Code:
    1. QString str = ts.readLine();
    2. emit logText( tr("Read: '%1'\n").arg(str) );
    To copy to clipboard, switch view to plain text mode 
    concept where logText() is having a QString-->"Read: '%1' ". In which '%1' is nothing but the 'str' i.e. readLine() which is passed to it.

    So just as in this example where the string from outside is displayed, can i use same concept to show string in QMessageBox taken from LineEdit->text()?
    To change the above QMessage::information(), i tired this: -
    Qt Code:
    1. QMessageBox::information( this, "Invalid Data Entered","You have entered" '%1' "which is an invalid data\n"
    2. "Valid Range is 1 - 1000\n"
    3. "Please enter valid data.", QMessageBox::Ok, 0 );
    To copy to clipboard, switch view to plain text mode 
    but i dont know how to or where to insert this
    Qt Code:
    1. .arg(inpuLineEdit->text())
    To copy to clipboard, switch view to plain text mode 
    statement so that it will take the input & display it in QMessageBox.

    Can anyone please help me out in this? I will be grateful.

    Thanks in advance.
    Last edited by jpn; 6th March 2008 at 10:26. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Showing arguments in QMessageBox::information() !

    Qt Code:
    1. QMessageBox::information(...., QString("foo %1 bar").arg(parameter), ...);
    To copy to clipboard, switch view to plain text mode 

    PS. Could you start using the "#"-button (produces syntax highlighted code) instead of colors, please?
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    Krish (6th March 2008)

  4. #3
    Join Date
    Feb 2008
    Posts
    74
    Thanks
    31
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Showing arguments in QMessageBox::information() !

    Hello! Jpn,
    Thanks Sir for helping me out. I tired few things with that and yes now its working!

    You are as usual a great help to me.---->Thanks very much Sir

    Best Regards.

Similar Threads

  1. about qt/embedded widgets showing in ARM platform
    By xianshuiren in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 3rd December 2007, 05:48
  2. Replies: 6
    Last Post: 21st September 2007, 13:51
  3. Qtopia core 4.2.2 cross compile make error
    By smiyai18 in forum Installation and Deployment
    Replies: 2
    Last Post: 28th August 2007, 17:04
  4. Showing QMainWindow without showing a child QWidget
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 4th March 2007, 09:03

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
  •  
Qt is a trademark of The Qt Company.