Some Lesser Known Qt Tools and Commands - Part 5

Jeff Tranter


Jeff Tranter is a Qt Consulting Manager at ICS. Jeff oversees the architectural and high-level design of software systems for clients. Jeff’s leadership organizes global teams of developers on desktop and embedded applications.

By Jeff Tranter | Wednesday, July 22, 2015

In this blog post, the last in the series, I'll cover the remaining Qt command line tools as there are only a few programs we have not already discussed.

xmlpatterns and xmlpatternsvalidator

These two XML-related tools are for working with Qt's XQuery support. XQuery is a query and functional programming language for querying and transforming collections of structured and unstructured data.

The xmlpatterns command is a tool for running XQuery queries. The xmlpatternsvalidator program is used for validating Qt XML Patterns.

As a piece of useless trivia, xmlpatternsvalidator ties with qcollectiongenerator for the Qt tool with the longest file name, at twenty characters. The creators of UNIX, who preferred short commands like "ls" and "cat", would certainly not have been pleased with these choices.

The details of these commands are beyond the scope of what I can cover here. I refer you to the Qt documentation section on "XQuery" 1 and the "C++ Source Code Analyzer Example" 2.

qtplugininfo

The qtplugininfo command dumps meta-data about Qt plugins in JSON format. This command is new in the Qt 5.5.0 release. Here is an example of the output:

% qtplugininfo  /usr/local/Qt-5.5.0/plugins/imageformats/libqjpeg.so 

IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" Qt 5.5.0 (release)
User Data: {
    "Keys": [
        "jpg",
        "jpeg"
    ],
    "MimeTypes": [
        "image/jpeg",
        "image/jpeg"
    ]
}

Offhand, I'm not sure what it would be useful for exactly. Presumably, for development tools that interface with Qt plugins and need to query their capabilities.

qtdiag

This command outputs information about the current Qt install. It can be useful when users are reporting bugs, for example, to give details of Qt on the specific machine. The output can be quite long (more than 100 lines on my Linux desktop system). A partial output of the command is listed below.

Qt 5.5.0 (i386-little_endian-ilp32 shared (dynamic) release build; by GCC 4.8.2) on "xcb" 
OS: Ubuntu 14.04.2 LTS [linux version 3.13.0-53-generic]

Architecture: i386; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX

Library info:
  PrefixPath: /usr/local/Qt-5.5.0
  DocumentationPath: /usr/local/Qt-5.5.0/doc
  HeadersPath: /usr/local/Qt-5.5.0/include
  LibrariesPath: /usr/local/Qt-5.5.0/lib

Standard paths [*...* denote writable entry]:
  DesktopLocation: "Desktop" */home/tranter/Desktop*
  DocumentsLocation: "Documents" */home/tranter*

Network:
  Using "OpenSSL 1.0.1f 6 Jan 2014", version: 0x1000106f

Platform capabilities: ThreadedPixmaps OpenGL ThreadedOpenGL WindowMasks MultipleWindows ForeignWindows NonFullScreenWindows NativeWidgets WindowManagement SyncState RasterGLSurface

LibGL Vendor: NVIDIA Corporation
Renderer: NVS 5200M/PCIe/SSE2
Version: 4.4.0 NVIDIA 331.113
Shading language: 4.40 NVIDIA via Cg compiler
Format: Version: 4.4 Profile: 0 Swap behavior: 0 Buffer size (RGB): 8,8,8 Depth buffer: 24

qtpaths

This program is a command line client to the QStandardPaths class. I've previously written a blog post 3 on this topic. It can be useful to run from scripts that need to determine information about the current system, such as the location of Qt binaries.

Below is some sample output showing three different invocations of the program.

% qtpaths --types
ConfigLocation
DesktopLocation
DocumentsLocation
DownloadLocation
FontsLocation
GenericCacheLocation
GenericConfigLocation
GenericDataLocation
HomeLocation
MoviesLocation
MusicLocation
PicturesLocation
RuntimeLocation

% qtpaths --binaries-dir
/usr/local/Qt-5.5.0/bin

% qtpaths --paths DownloadLocation
/home/tranter/Downloads

qtwaylandscanner

This program is part of the Qt Wayland module, which supports using Wayland, a new replacement for X11. A previous blog 4 post covered how to get Wayland running on the Raspberry Pi platform. I hope to talk more about Qt and Wayland in a future blog post.

sdpscanner

This is a utility program provided as part of Qt's Bluetooth module. It performs a scan on a remote Bluetooth using Service Discovery Protocol (SDP). SDP allows service applications running on different Bluetooth devices to discover each other's existence and exchange information on their characteristics.

syncqt.pl

This program, a Perl script, is a development tool that synchronizes Qt header files. If you work with a git clone of Qt and change branches, running this tool will perform some actions that are needed to avoid build errors due to Qt's forwarding headers in the include directories. It can be run after doing a "git pull" or "git checkout".

Summary

At a recent ICS Qt training class, the students asked the instructor the purpose of each of the programs in the Qt binary directory. Surprisingly, there was no obvious place to get that information. That indicated to me that this web series was useful, and we may in fact include some of the content in our training material.

With that, we have completed this series on the lesser-known Qt commands. I may update it in the future to cover any new commands that may be added in upcoming Qt releases.

References

  1. XQuery Introduction, Qt documentation, accessed 1 Jul 2015, doc.qt.io/qt-5/xmlprocessing.html
  2. C++ Source Code Analyzer Example, Qt documentation, accessed 1 Jul 2015, doc.qt.io/qt-5/qtxmlpatterns-xquery-example.html
  3. What's new in Qt 5: QStandardPaths, ICS blog post, accessed 1 Jul 2015, www.ics.com/blog/whats-new-qt-5-qstandardpaths
  4. Building Qt and QtWayland for Raspberry Pi, ICS blog post, accessed 1 Jul 2015, www.ics.com/blog/building-qt-and-qtwayland-raspberry-pi

Tags:  Qt

Have a question or add to the conversation: Log in Register