Results 1 to 20 of 25

Thread: Pointer to another window.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Pointer to another window.

    How to return a pointer, to another window?

    If i just return, for example


    return Pointer_name;

    Then change something in another window,it doesn't affect the orginal one, when i change anything, it seams like another copy.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Pointer to another window.

    You need to provide some more information. A single line of code with no context at all doesn't give us anything to go on.

    Please post some code that shows what you are trying to do, especially the code that returns the pointer, and where you are trying to use the pointer and "it doesn't affect the original one".
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3

    Default Re: Pointer to another window.

    Ther is nothing to show. I wanna return one pointer, to another window thats it.

    So for example Window_A_PTR in a part of MainWindow.
    I wanna return and use that pointer to Window_B.
    So:

    Window_A* Window_A::Return_Pointer()
    {

    return Window_A_PTR;

    }

    Now in window B:

    //Wher i wanna use it
    {

    Window_A* Temp = new Window_A;
    Window_A Get_The_Pointer;

    Get_The_Pointer = Temp->Return_Pointer();

    //Then use that "Get_The_Pointer" and do some changes in Window_B, but it should affect Window_A_PTR, cuz it's the orginal one.

    }

  4. #4
    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: Pointer to another window.

    Why are you breaking your English?
    If you want to be taken seriously use proper language.

    Your pseudo code does what you want in terms of returning the pointer.
    The problem you have is therefore not clear.
    Its seems to me your last comment may be pointing to the problem which may be the scope of usage.
    To be sure however the real code where you use the pointer getter method is needed.

    Show the place in code that doe NOT behave like you intend it to maybe this will brings us to the right path.
    And please use code tags when posting code.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 2
    Last Post: 14th October 2016, 10:55
  2. Replies: 3
    Last Post: 23rd May 2015, 13:57
  3. Replies: 6
    Last Post: 9th November 2011, 04:31
  4. Replies: 2
    Last Post: 17th February 2011, 12:30
  5. Replies: 1
    Last Post: 4th December 2010, 17:20

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.