Results 1 to 3 of 3

Thread: Structure of Qt Widget Application for a CLIPS frontend

  1. #1
    Join Date
    Nov 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default Structure of Qt Widget Application for a CLIPS frontend

    Hi,

    As mentioned I'm working on developing a frontend for CLIPS using Qt. I am not inexperienced in designing GUIs but I've only used Swing and wxWidgets(Python). I chose Qt since it's cross platform and I can write in C++. My question is- How do I integrate various CLIPS features into my Qt Application? Should I create one Widget class and then define all the callbacks in it and call it in my main ? Or should I create a separate class for agenda browser, fact browser etc?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Structure of Qt Widget Application for a CLIPS frontend

    Aside from the obvious question of what this CLIPS is, this doesn't sounds like a very Qt specific question.

    Just like with any of the fraemworks you've worked before, you can structure your project in any way that you find good to work with.

    Cheers,
    _

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Structure of Qt Widget Application for a CLIPS frontend

    the obvious question of what this CLIPS is
    I presume the OP is referring to the expert system implementation tool, CLIPS, developed by NASA in the 1980s, and now a SourceForge project. I have never used it, but from what I read it has primarily a command-line oriented interface. The developers have implemented GUI-like interfaces for Windows and Mac, but these look like thin veneers over a command line terminal, with a bunch of menus and dialogs for parameter configuration and rule browsing. The main interface still appears to be a command line. Unimpressive and unimaginative.

    You should be referring to Chapter 4 in the CLIPS Advanced Programming Guide (APG), on Embedding CLIPS. I would represent the interface to the CLIPS environment as a QObject-based class (Let's call it QCLIPSObject). This will likely be a Singleton and implemented as a global variable for use by the rest of your app (much like there is a global Qt variable named "qApp" holding a pointer to the single instance of the QApplication object). The communication between the rest of your GUI and CLIPS will be through signals and slots implemented on QCLIPSObject. Either your main() function or your QMainWindow constructor will create this Singleton instance and assign it to the global variable. In order to keep your GUI responsive, you will need to add a static method to this class that is a callback from CLIPS implementing a "periodic function" (see 4.1.2 EnvAddPeriodicFunction in CLIPS APG). In this function, you'll need to call QApplication::processEvents().

    The QCLIPSObject class would also have methods called in its constructor to initialize CLIPS, install the periodic function, and install any other callbacks needed for interaction with CLIPS. Callbacks from CLIPS map to static C++ methods of QCLIPSObject. In those static methods, you will emit Qt signals (called through the global QCLIPSObject pointer) so that the rest of your app can get notice of what CLIPS is doing.

    You could choose initially to implement your GUI in the same way as in the CLIPS Interface Guide (IG), with menus on a Qt QMainWindow-based class to drive interaction with your CLIPS object. You could add dialogs (each implemented as a separate QDialog-based class with a UI constructed using Qt Designer).

    AFAIK, Qt doesn't have a widget that emulates a command line console but there is an old SourceForge project that could probably be ported to Qt 5 if you wanted to go that route.

    If you want to get fancier, then instead of using QDialog for your various browsers, you could implement them as QDockWidget-based classes instead. An easy way to do this is to implement the GUI as derived from QWidget. You could then choose to embed that QWidget either in a QDialog or in a QDockWidget without modification.

    I don't know what your application is for CLIPS. If all you want to do is to implement a new GUI for interaction with it, then a console-based approach is probably as far as you can go. If you are actually targeting a specific application area, then you can add other graphical widgets to display plots and so forth. Some of the NASA-published papers on the CLIPS web site have some 1980 - 1990 era graphical interfaces developed for specific CLIPS applications.

    If you want to get really fancy and make a lot of work for yourself, you can design this whole system to be extensible using plugins. Qt has classes and libraries for implementing plugin-based applications in which an application's basic functionality can be extended using plugins implemented in DLLs. Qt Creator is in fact implemented this way.

    Have fun.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. General application structure with Qt
    By CoderMan in forum Qt Programming
    Replies: 7
    Last Post: 3rd February 2019, 11:08
  2. Replies: 0
    Last Post: 10th March 2015, 20:24
  3. Replies: 12
    Last Post: 26th June 2011, 12:26
  4. Replies: 4
    Last Post: 5th September 2010, 11:08
  5. DoxyGate - Doxygen GUI Frontend
    By doxygate in forum Qt-based Software
    Replies: 11
    Last Post: 12th January 2009, 17:48

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.