Results 1 to 5 of 5

Thread: Virtual protected and private var

  1. #1
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Virtual protected and private var

    Hi there. I am blocked on a problem since nearly two days i dont find any clue to progress. I am using libQXt to create a small webservice that will send back json string to a webbrowser client. The webservice work well but i have a problem with accessing private data from my class.

    class WebService : public QxtWebServiceDirectory {

    Q_OBJECT

    public:
    WebService(QxtAbstractWebSessionManager * sm , QObject * parent = 0);
    virtual ~WebService();
    addString(const QString& json);

    protected:
    void indexRequested (QxtWebRequestEvent *event);

    private:

    QStringList Gadgets;

    };

    case 1 :
    if in the constructor I fill Gadgets with strings;
    then i access Gadget from indexRequested (wich is called when a request is done by a client) I can access Gadgets content.

    case 2: from outside of WebService I call the public method addString to add strings to Gadgets and in this case Gadgets seems to be empty when accessed from indexRequested

    any ideas where it come from ? what I am missing ?
    thx

    [EDIT] See attachment debug1.jpg is the QStringList content while WebService->getGadget() is called (by a singleshot timer from outside the class).

    debug2.jpg is the content of the list when called from webbrowser >> indexRequested()
    Attached Images Attached Images
    Last edited by maddog_fr; 17th November 2010 at 17:03.

  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: Virtual protected and private var

    Please post a compilable minimal example.
    The information you gave is not enough.

  3. #3
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: Virtual protected and private var

    here is a compilable example

    WebServer.zip

  4. #4
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Virtual protected and private var

    I still dont understand ! this small example work as it should classTest.zip

  5. #5
    Join Date
    Jul 2009
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Virtual protected and private var

    Problem solved! nothing to do with protected or private ! I had two webservice runing

    rootService and gService. I was adding data to gService but it was rootService that was answering requests.

Similar Threads

  1. protected function changeevent
    By fearu in forum Newbie
    Replies: 2
    Last Post: 25th September 2010, 13:11
  2. Replies: 11
    Last Post: 12th July 2009, 16:01
  3. Replies: 2
    Last Post: 22nd January 2008, 15:15
  4. signals means protected and what does slots mean
    By babu198649 in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2007, 09:16
  5. About Password Protected Files:
    By vermarajeev in forum Qt Programming
    Replies: 7
    Last Post: 16th February 2007, 14:46

Tags for this Thread

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.