Results 1 to 4 of 4

Thread: sharing struct data throughout program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    43
    Thanked 3 Times in 3 Posts

    Default sharing struct data throughout program

    I have a struct as a private member of my main Window class, like so:

    Qt Code:
    1. class Window : public QWidget
    2. {
    3. Q_OBJECT
    4. public:
    5. //etc
    6.  
    7. private:
    8. //etc
    9. struct Comp {
    10.  
    11. short dataNUM_TOTc;
    12. char *lyBuName[24];
    13. bool onMA[24];
    14. short dataTYPE[24];
    15. } comp[7];
    To copy to clipboard, switch view to plain text mode 

    The values of the instances of the struct, comp[0-6], are initialized through a member function of the Window class and determine how my QWidgets are set up. I would like to be able to access (read) the values of this struct in the constructor function of another class, defined in another .cpp file. How to do this?

    edit: Actually, I've no reason to make it private, so assume it's public instead of private.
    Last edited by vonCZ; 6th July 2007 at 15:13.

Similar Threads

  1. Replies: 16
    Last Post: 23rd May 2008, 11:12
  2. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 05:19
  3. program for working with Data Base(i need it)
    By banakil in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 23:58
  4. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 13:53

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.