How do I generate documentation screenshots for a Qt application? - qt

Without manual intervention I would like to generate screenshots of a Qt desktop application. The screenshots should be generated when the make documentation make target is being issued. So in the source tree there are no PNG files containing screenshots but instead there are automated instructions of how to produce them.
An advantage of generating the screenshots would be that the documentation would always stay accurate. It would cope with the problem that the visual appearance of Qt widgets might change over time. Another advantage would be that screenshots for different Qt styles could be created. A Qt style is chosen by using
QApplication::setStyle() or by starting the app with the -style command line option.
I guess there are be two approaches of how to achieve my goal.
Record all mouse events and key strokes that are needed to bring the application
into the state where the screenshot is being taken.
Make the Qt application scriptable, and write a script that brings the application into the state where the screenshot is being taken
Is there any third-party software that could automate the first approach?
Should I use QtScript for the second approach? Are there other ways of how to accomplish my goal? Are there any open source Qt applications that generate their documentation screenshots in their build system?

Related

Is there a way to generate windows and/or components in Ignition?

I was hoping that Ignition had a way to import/export windows to a non-binary format such as JSON or XML, but that seems not to be the case (or is there a way?).
Is there a way to use the script console to generate and populate a new window, or to insert components into an existing window?
This would be used for inserting templates and other components, such as navigation buttons etc.
Yes, but...
I assume here that you're referring to Vision windows. The windows are indeed binary serialized, but the underlying structure is XML. But getting the deserialization done programmatically is a pain and probably not worth it.
You can get a feel for what this looks like by opening a Vision window in the designer, right-clicking its Root Container and choosing Copy, then pasting it into Notepad. I myself tried to find a way to do this from a module and decided it wasn't worth it. For more detail, you can view that thread in the Ignition forum here.
However, that's not really useful for generating and populating a new window.
To do that, you need to do some Java programming. Vision is Java Swing under the hood. There are a couple ways you can dynamically build / populate a Window.
From Python, you can import any Java libraries you need and generate the window dynamically. For relatively simple things, you're probably better off working with the Template Canvas component. There's an Ignition forum thread discussing this topic here. This would be more of a run-time generation, not from the Script Console.
You can write your own module to do it.
Module SDK Vision Component Guide
Vision Component Module Example
Good luck!

Qt Automotive Embedded Cluster (ICP)

I am new to Qt and was curious if we can develop HMI for a Cluster(Instrument Cluster Panel) using Qt.
Can someone share a demo?
I might be in a wrong place to post this question, please don't flag.
I am looking for Examples/Demo in QT 5. (5.3.1)
Look at this widgets on Qt Apps website:
http://qt-apps.org/content/show.php/AnalogWidgets?content=87780
As you can see there are many beautiful widgets. For example:
There is also Qwt: well documented tool with a lot of different technical widgets.
http://qwt.sourceforge.net/index.html
From here
A good example is a dial-type control which combines Image elements with Rotation transforms and SpringAnimation behaviors to produce an interactive speedometer-type dial. You can find the example in the installed Qt directory in Examples/Qt-5.3/quick/customitems/dialcontrol.

Is there any plan to add Qxt features to Qt?

Qxt is an extension library for Qt providing a suite of cross-platform utility classes to add functionality not readily available in Qt. Qxt consists of several modules, each of which lives in a separate library. It has many nice features like:
QSlider with two buttons
Rotating & richtext buttons and labels
LineEdit with sample text
managing many screen settings
String SpinBox
Check ComboBox
Global Shortcut (hot keys)
Schedule View
Tooltip with arbitrary widget on it
RPC(connecting signals and slots through network)
XML-RPC
QxtSQLPackage (Sending SQL query result through network or to a file)
QxtSlotMapper (Map a signal to slots based on parameter value)
Qt comes with lots of new features in each release. I wonder why these useful and nice features are not included in new versions of Qt. Does anybody know if there is any plan to add these features to Qt in the future?
While I do totally understand not just sending Qxt code up stream, because it can be very kludgy, some of the things mentioned are a bit silly as to why they're not included already. The global shortcuts is the number one thing that comes to mind. Having sample text in a line edit would be another cool feature.
For a while now, in my spare time, I've been working on a note taking app, and I've specifically went with QT because of the ease of having it work cross platform compared to GTK or other GUI frameworks. One of the major concepts was having a global hotkey to make the application appear and disappear, but because QT doesn't do this on its own, I had to deal with Qxt for this one function, and it made it a giant mess to get going. I dealt with tons of bugs that prevented me from building versions for Windows. If I could, I'd gladly ditch Qxt in favor of something already baked in to QT.
Qxt grew out of a need for features that QT wouldn't include for one reason or another, and I frankly just don't understand why.

Automated functional testing qt apps in windows

I'm trying to create scripts that test if some GUI components exist inside a window (combo boxes, check boxes, the state of check boxes, etc.) The app I want to tests is written in QT and running on Windows 7. Its content is created dynamically.
I've tried with swapy/pywinauto, AutoHotkey and AutoIt. But as they rely on standard Windows API calls they are useless for this (need a solution that involves QT).
Any recommendation will be appreciated.
You can try QtTestLib for integrated solution, or, if you want (and can afford) commercial solutions, I am aware of squish and kdexecutor.
Are you aware that AutoHotKey Windows Spy allows you to see if certain GUI objects exist inside a window. In the example image you see that I held the mouse over a combo box named ComboBox5. Are you trying to test at this level?
The rest can be found here already:Check if a certain button is existing or not using autohotkey

Any way to analyze the size of a SWF built in Flex?

I have a Flex application that seems larger than it should be. There is a lot of code in it, but not a lot of assets and it just seems large, but I'm not sure how to go about figuring out where the space is going.
I know about the –link-report option, but it only gives the sizes of externally linked library classes. I'm very interested in seeing a report of the sizes of all the classes and resources in my application and it would be a huge bonus if I could also view their dependencies. Not knowing how the code is compiled I'm not sure if this is even possible, but it seems like it should since the compiler can give me the sizes of individual classes linked from other libraries.
I did some searching around, but couldn't find anything helpful. Everything points to the optimization techniques of modularizing and externally linking libraries, which I understand and will implement, but I would really love some more detailed reports of what my compiled application looks like.
To be clear, I'm not really interested in tips on how to reduce the file size, just a report on what is used for and which classes are referencing what.
Anybody have any ideas?
CORRECTION - The link report does show all classes. My particular project in Flex Builder had several CSS files set to compile to swfs. My link report for the main app was being overwritten by these css compiles!
The link report actually contains all compiled classes and not just the ones in external libraries (at least with the Flex 4 SDK). There is an xsl available that will generate an html file of the link report so it is easier to read.
Check this post: http://blog.iconara.net/2007/02/25/visualizing-mxmlcs-link-report/
There is a command-line utility called flash.swf.tools.SwfxPrinter in swfkit.jar, which comes with Flex Builder (or the plug-in or the SDK) and which you can use to analyze information about class sizes. Joe Berkovitz wrote some good instructions on how to make use of it in his blog, and he was working on an AIR-based GUI tool that leverages it, but I'm not sure if he ever published the tool. Still, you can use his instructions to leverage the utility directly from the JAR.
I found a handy little AIR app that really helps organize the link report info.
http://www.kahunaburger.com/2008/03/08/air-link-report-visualizer/
It's old but still works very well.

Resources