Results 1 to 13 of 13

Thread: External Acces to Private Slot

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: External Acces to Private Slot

    Maybe you were confused by my response, as it basically states exactly the same as what you just replied with. Eg. that obj->func() will not work from outside the class but obj->InvokeMethod will.

    To have your slots truly private, create them in another private class, and contain a pointer to this class in the private part of your public class. So if you need to access your private slots you can do d->slot() whilst people outside your class can not, as 'd' would be private.

    This also means your class is more flexible - you can either have data for each instance of your class, or you can share data between instances of your class (like the Qt object classes).

  2. The following 3 users say thank you to squidge for this useful post:

    borisbn (20th July 2010), stefanadelbert (19th July 2010), Zlatomir (19th July 2010)

Similar Threads

  1. Timer not connecting to private SLOT
    By been_1990 in forum Qt Programming
    Replies: 4
    Last Post: 16th December 2009, 00:07
  2. Acces parent object
    By Nightfox in forum Qt Programming
    Replies: 8
    Last Post: 19th August 2009, 08:56
  3. Acces a stacked widget...?
    By ucomesdag in forum Qt Programming
    Replies: 5
    Last Post: 25th November 2006, 14:05
  4. Acces to a remote mysql server
    By Alienxs in forum Qt Programming
    Replies: 2
    Last Post: 19th August 2006, 03:10
  5. Replies: 2
    Last Post: 4th May 2006, 19:17

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