Results 1 to 3 of 3

Thread: slot to execute (or initialize) my program

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default slot to execute (or initialize) my program

    hello world,

    i have a program "myProgramm.exe" when i run it, it runs calculation. Now i have put a button (with a slot) used to run the principale function (because i don't want run the calcul a the beginning of the execution).
    To stop my programm i click on the STOP button which it break the loop of calculation and induce the end of the programme.

    This thing works nice but when i STOP my programm i can't RUN it by a click on the RUN button: i must close end rerun my ".exe" before clicking on the RUN button.

    to avoid this i think i have to:
    - either i create a slot which it initialize my programm (rerun the function main.cpp)
    - or i replace my run button by a button which rerun my .exe

    but i don't know how i can make this....

    can you help me (please, use a easy english because mine is not perfect)

    thank you

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: slot to execute (or initialize) my program

    Don't do your calculation in main().

    Put the code in a class (like MyCalculator : public QObject) and initialize and start the run in a slot run().

    In your main() you just create an object based on this class and connect the buttons to its slots (start() and stop().

  3. #3
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: slot to execute (or initialize) my program

    can i havve an example please ?
    thank you

Similar Threads

  1. How to Un- Initialize the drive in xp?
    By Gokulnathvc in forum Newbie
    Replies: 3
    Last Post: 12th May 2011, 23:45
  2. Replies: 18
    Last Post: 14th March 2011, 13:26
  3. execute sth before program exits (user closes window)
    By donglebob in forum Qt Programming
    Replies: 6
    Last Post: 9th December 2008, 23:24
  4. how to execute program that using qsqlite on different machine?
    By mismael85 in forum Installation and Deployment
    Replies: 2
    Last Post: 19th March 2008, 21:09
  5. Replies: 4
    Last Post: 14th June 2007, 05:06

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.