Results 1 to 2 of 2

Thread: How to separate program logic from GUI

  1. #1

    Default How to separate program logic from GUI

    Hello I`m trying to separate programm logic from the GUI, I want to have multiwindowed application with logi placed in my class not MainWindow like it is in most example cases. And I want to start my windows, give them a pointers to Data, they would fill the data, close and next window would be run. What to do in such situation try to override the qapplication(If yes where should i put my logic in which QApplication method) or it can be done by "just like that"
    Qt Code:
    1. QApplication a(argc,argv);
    2. MainWindow *w = new MainWindow();
    3. w->show();
    4. a->exec();
    5. //Here to place the loop of comunication beetwen this and windows
    6. //Main loop of gui communication with logic
    7. //Start windows, close windows, switch results, make actions
    8. //MAIN LOOP
    9. return 0;
    To copy to clipboard, switch view to plain text mode 
    if this loop is posiblle to create pls tell my how. Should i make some signals to comunicate with my window or in other way.I achiewed that signals are protected by default so is it possible or there is a better way to sepate the logic from window pls help, give me some clues, or examples.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to separate program logic from GUI

    You don't need another loop (you already have one)

    Just code your classes that will contain and work the with data you need.

    Also you can take a look at the Model View Programming, it may be what you are looking for.

Similar Threads

  1. Replies: 0
    Last Post: 30th April 2010, 05:22
  2. need help in getting a logic to work
    By eva2002 in forum General Programming
    Replies: 3
    Last Post: 29th January 2010, 08:30
  3. Ladder logic editor
    By GuL in forum Newbie
    Replies: 4
    Last Post: 23rd October 2009, 22:02
  4. QSQLITE logic error
    By cyberboy in forum Qt Programming
    Replies: 11
    Last Post: 10th February 2008, 19:52
  5. GL Logic op blending inside QGLWidget
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2006, 19:55

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.