Results 1 to 2 of 2

Thread: lineedit fill in new dialog window.

  1. #1
    Join Date
    Oct 2007
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default lineedit fill in new dialog window.

    I created a form with designer-qt4 and open in myqtapp.cpp

    myForm *dialog2 = new myForm;
    dialog2->show();

    but i want fill a lineedit in new opened form. Like this.
    lineEdit_recordid->setText("315");

    and i get following error.
    myqtapp.cpp:41: error: ‘lineEdit_recordid’ was not declared in this scope
    make: *** [myqtapp.o] Error 1

    what can i use?
    Last edited by mkarakaplan; 7th October 2007 at 00:19.

  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: lineedit fill in new dialog window.

    Provided that "lineEdit_recordid" was placed in Designer, it's a private member of myForm. You could do it for example like this:
    Qt Code:
    1. class myForm
    2. {
    3. ...
    4. public:
    5. void setRecordId(const QString& id);
    6. ...
    7. };
    8.  
    9. void myForm::setRecordId(const QString& id)
    10. {
    11. lineEdit_recordid->setText(id);
    12. // or
    13. // ui.lineEdit_recordid->setText(id);
    14. }
    15.  
    16. // usage:
    17. dialog2->setRecordId("315");
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41
  2. Docking a widget to fill a dialog
    By mridey in forum Qt Tools
    Replies: 1
    Last Post: 16th November 2006, 11:45
  3. Replies: 3
    Last Post: 23rd July 2006, 18:02

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.