Replace ncurses-Masks of Fortran-Progr. with Qt-Masks



  • Hello,

    I have a project within I should replace the ncurses-masks of my existing Fortran-programs with Qt-masks.

    Now I try to explain how my existing programs work:
    The Fortran-programs call some functions of a own designed C-library to create the ncurses-masks.
    Inputs and outputs of the user will be also handelt by this C-functions, the further work with this data make the Fortran-programs.

    We have many Fortran-programs, so the idea is that we only want to change the C-functions from working with ncurses to Qt.
    This worked in my test till I call the method "exec()" of the class "QApplication".
    This call starts the "main event loop" and then my Fortran-program is frozen.

    Now my question is:
    Can I work around this problem, means that I don't call "exec()" or is there another possibility without writing my Frotran-programs new?

    Thanks a lot for your answers and ideas! :-)

    Bye
    Jochen



  • If I understand you correctly, you have a Fortran program that uses nurses to get user input, and you basically want to convert it to use Qt, but without requiring major modifications to the original code, basically just trying to use Qt as a drop-in replacement. The problem is, Qt (and really all modern GUI packages) operate on a fundamentally different paradigm from ncurses, as you just discovered when you entered the event loop.

    nurses doesn't have en event loop, you manually step through each screen and your code basically draws them in sequence. Qt is an event-driven architecture: this allows it to respond to mouse clicks, lets you drag windows around, have multiple dialogs up at once, etc.: it's the foundation of modern user interface design. As such, converting from nurses to Qt is not at all straightforward.

    That is not to say it cannot be done, of course, but you need to reverse the problem: think of the Qt program as your main program, and your Fortran code as running inside of it. You want your various function calls from Fortran to act as events in Qt's event loop, and then write handlers that show the appropriate dialogs and then return the data to the Fortran code. All told, this is a big undertaking: is there a version of this Fortran code that simply reads an input deck (i.e. that doesn't use the nurses stuff)? The way I usually write this sort of interface is to design a GUI that ultimately just writes the input deck out and then triggers the Fortran code to read it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.