Results 1 to 2 of 2

Thread: How to access MainWindow objects.

  1. #1
    Join Date
    Jan 2006
    Location
    Berkeley California
    Posts
    109
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to access MainWindow objects.

    I'm not only a Qt newbe but also a C++ newbe so... lots of dumb questions (as someone famous once said [about someone else] - "I'm a humble man, with a lot to be humble about").

    I have a main window with a bunch of widgets on it that I can access within the implementation of the main window. How can I access these widgets from other functions/objects? Do I need to implement a "getWidgetPointer()" access function to call from my other code?

    Also, how do I make my mainwindow instance which is created in my main() function global (or otherwise accessable)?

    Thanks
    Last edited by Doug Broadwell; 2nd November 2006 at 20:21.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to access MainWindow objects.

    That is indeed a C++ (or OOP) question.
    In general, yes, usually you create access member functions to set and get values of class members.
    For private/protected class members it is a must, for public class members you don't HAVE to do it, you can access public members directly so: pointerTomyObject->objectMember = value;

Similar Threads

  1. Replies: 1
    Last Post: 4th October 2006, 16:05
  2. Replies: 3
    Last Post: 23rd July 2006, 18:02
  3. Replies: 7
    Last Post: 18th July 2006, 21:33
  4. Replies: 5
    Last Post: 14th July 2006, 22:42
  5. mainwindow does not refresh
    By edb in forum Qt Programming
    Replies: 22
    Last Post: 25th January 2006, 16:42

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.