Results 1 to 10 of 10

Thread: Accessing the same variable from multiple windows.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2013
    Posts
    44
    Thanks
    9
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Accessing the same variable from multiple windows.

    I want to access the same variable from mainWindow as well as my dialog class called 'Dialog'
    suppose i change this variable from mainwindow, the change should be reflected whenever i use the variable from dialog.
    i cannot use signal /slots due to some reasons.

    i have already tried this.
    i made a source calls vars.h /vars.cpp and declared the variable there, but it doesn't seem to work .
    what can i do ?

  2. #2
    Join Date
    Dec 2012
    Posts
    197
    Thanks
    25
    Thanked 41 Times in 33 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Accessing the same variable from multiple windows.

    Do you mean you need a global variable ?
    Wouldnt go for a global variable since its not a good practice.
    What are the reasons behind not using signals and slots ?

  3. #3
    Join Date
    Sep 2013
    Posts
    44
    Thanks
    9
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Re: Accessing the same variable from multiple windows.

    no, I just want to use a global variable .

  4. #4
    Join Date
    Dec 2012
    Posts
    197
    Thanks
    25
    Thanked 41 Times in 33 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Accessing the same variable from multiple windows.

    Isnt it the same as this link link.
    Last edited by toufic.dbouk; 9th October 2013 at 07:52.

Similar Threads

  1. Accessing same variable from multiple windows
    By harvey_slash in forum Newbie
    Replies: 21
    Last Post: 5th May 2016, 10:26
  2. multiple definitoin of variable
    By saman_artorious in forum Qt Programming
    Replies: 6
    Last Post: 22nd April 2013, 19:47
  3. Multiple definition of a variable?
    By T0bi4s in forum Newbie
    Replies: 5
    Last Post: 14th January 2010, 22:13
  4. Replies: 6
    Last Post: 25th December 2008, 05:58
  5. Accessing to a static variable from the same class
    By xgoan in forum General Programming
    Replies: 6
    Last Post: 5th March 2007, 10:50

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.