Results 1 to 2 of 2

Thread: a question conerning code in main.cpp

  1. #1
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default a question conerning code in main.cpp

    hello everyone,
    i have made a gui application in qt that now needs to share some variables with another application... the other application is going to write values in a shared memory and then send a signal that the gui will catch and go read these values from a common file.

    i have declared - on the gui part - my shared variables, and a public procedure (getVarsFromFile) that opens the shared file and reads the variables from it...
    i also guess that i am to write a small procedure (void caught_a_signal() ) in the main.cpp that gets called when a signal is sent.. now what i think of doing is call the myForm->getVarsFromFile() within the caught_a_signal() procedure... but of course the problem that arises there is that myForm is not declared in the scope of that procedure, only in main{}. so what can i do? how can i declare the myForm so that it can be seen from the procedure too?
    thank you for your help
    nass

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: a question conerning code in main.cpp

    I think you should post an event to the event queue in the signal handler. This way you can then handle the event inside the application using customEvent().

Similar Threads

  1. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

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.