Results 1 to 2 of 2

Thread: "Innaccessible within this context"

  1. #1
    Join Date
    Sep 2009
    Posts
    34
    Thanks
    28
    Qt products
    Qt4
    Platforms
    MacOS X

    Default "Innaccessible within this context"

    Hi there folks,

    I'm having a bit of a weird error here, when I use the following code:

    Qt Code:
    1. void mainwindow::adddialogslot() {
    2. adddialog *add = new adddialog;
    3. add->show();
    4. if (add->Accepted) {
    5. QSqlRecord patient;
    6. patient.setValue("name", add->lineEdit_name->text());
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

    The compiler tells me "QLineEdit* Ui_AddDLG::lineEdit_name is inaccessible within this context". I wonder what I am doing wrong. Sample code would be appreciated.

    Thanks in advance,

    Nefastious

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: "Innaccessible within this context"

    I guess lineEdit_name is declared private. So you can't reach it from outside of adddialog. So best define a getter for the text.

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

    Nefastious (19th October 2009)

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.