Ask Reuben


What is Qt?

What are the Qt libraries?

What is this environment variable beginning QT that I am being asked to set?

The Genero Desktop Client (GDC), Genero Studio (GST), Genero Report Designer (GRD), and Genero Report Viewer (GRV) applications are built on what is known as the Qt libraries or Qt framework.  If you look inside the bin or lib folder of the various GUI Genero applications you will find dll or libraries whose filename begins Qt…

Qt is a widget toolkit that allows you to develop cross platform applications.  The Four Js developers write code that says draw this particular widget with these properties.  This calls code in the Qt library that is then responsible for the rendering of the widget on the Windows, Linux, and OSX desktop GUI platforms that we support.  The Qt toolkit has been the backbone of the GDC and has been integral to its longevity and success.

Qt itself either renders native widgets or draws widgets that emulate native widgets.    You may notice this last point if you have attempted to use third party desktop application testing tools that rely on the ability to interact with native widgets.  These testing tools could not interact with the Qt emulation of native widgets and so historically Qt testing tools such as Froglogic Squish were needed that understood and could interact with the Qt widgets.  Since the introduction of Genero Ghost Client (GGC), you can use that for automated testing.  The GGC differs in that it interacts with the AUI Tree whilst other testing tools normally interact with what they can view on the screen.

With Genero 4.00 and the move to Universal Rendering, we have reduced the dependency of the GDC on Qt.  Instead of using Qt to draw each individual widget, Qt is used now to render a browser, into which the Universal Rendering is displayed and interacted with using web technologies.  You could almost say the GDC is rendering a Web Component and rendering a Genero Browser Client application inside the Web Component, there is a little bit more to it than that but I think that is a good simplification.  The Qt WebEngine uses code from the Chromium project and an interesting exercise is to create a Genero form with an empty web component and display a web page such as to the web component and note the output and the user agent string.  See code example at end.  Also when you debug web content in the GDC note that this uses Chrome dev tools, so again showing its Chromium base.

Normally the use of the Qt libraries is transparent to the developer.  It is there but you never have to install it or do anything with it.  We ship the libraries inside the GDC, GST etc and that is it.

There are a few times you may encounter Qt…

  •  Qt improves over time but sometimes that improvement is too much for your older PC or older graphics card.   There are some QT prefixed environment variables that support may ask you to set that will tell the Qt libraries to use a different internal library.  The key thing to remember is that these QT prefixed environment variables need to be set in the environment where the product using Qt is running.  It is not correct to set it in the same place where FGLDIR is set, the correct place is in the process where the gdc.exe or generostudio.exe etc is being launched from.  For example, at one time there was a bug in a particular graphics card and the workaround was to set a particular QT prefixed environment variable that told the Qt libraries to use a different code base that avoided the bug in the graphics card e.g. QT_OPENGL=software
  • For debugging and logging purposes, you maybe asked to set an environment variable that begins QT, or perhaps add a command line argument to gdc.exe or generostudio.exe.  Again it needs to be set in the environment where the executable is launched from.
  • The GDC login/password dialog box, you may wish to apply some corporate branding to it so that the first thing a users sees is not the standard login/password dialog.  You can create using Qt Designer a form with your corporate branding that can replace the GDC standard login/password dialog.  See here for more details.  The reason it has to be a Qt form and not a Genero form as at that point the Genero application has not started, so at that point the GDC has to draw a Qt form.
  • The help dialog that pops up in Genero Studio uses Qt Assistant, as the name suggests, another Qt product.

In steps 1 and 2 above I didn’t tell you how to set the environment variables before the gdc or generostudio executable is launched.  That is a task for your Windows, Linux, or OSX system administrator but options may include …

  • setting in users default environment so it applies to all applications launched.  Useful in a dev environment as gdc and generostudio both likely require the same environment variable to be set.
  • using a batch script to start gdc or generostudio, and set the environment variable inside the script before gdc or generostudio is launched.
  • amend the command line used in a desktop shortcut to be of the nature “cmd.exe /c “set QT_… = value && start /D directory executable”

Google and Stack Overflow are good resources at this point as it is not a Four Js problem but a Windows, Linux, OSX system administration problem on how to set an environment variable when an application is launched.

Below is a small code example that was mentioned above.  Run this in the various front-ends to see what web engine is effectively being used.  In the GDC expect to see Qt in the answer.   Samples screenshots are GDC on the left, GBC on the right

    OPEN WINDOW w WITH FORM "emptywebcomponent"
    DISPLAY "" TO wc
    MENU ""
        ON ACTION close
            EXIT MENU
#! emptywebcomponent.per
LAYOUT (TEXT="Browser Test")
[f01 ]
WEBCOMPONENT f01 = formonly.wc;