Friedemann Kleint

Port to Windows Runtime kick-started

Published Friday February 15th, 2013 | by

With Windows 8, Microsoft introduced a new platform, the Windows Runtime. On the desktop, the operating system provides 2 modes:

Classic mode: This mode shows the familiar Windows desktop known from Windows 7 (with the exception of the start menu), in which traditional applications using the Win32 API run. No modifications are required for Qt 4 or Qt 5-based applications to run in this mode.

Modern UI (formerly known as Metro mode): This is a new type of user interface intended for tablet and phone UIs on which Windows Store Apps run. These applications use a new API called  Windows Runtime, which is based on the Component Object Model (COM). A similar API exists on Windows Phone 8.

Research work on how to port Qt 5 to use Windows Runtime was started by Andrew Knight from Digia and is visible in the winrt branch of the qtbase repository. Recently, further contributions by Kamil Trzciński were added to it (check out his blog). Now, with Qt 5.0 out of the door, we would like to kick off this platform port. This completes our cross-platform offering in addition to the ports for the widely used Android and iOS platforms.

We plan to continue development in this branch, aiming for as complete as possible port. Technical details can be found at here.

The first milestone is to get simple raster windows to be drawn on the screen. Later, we will investigate porting ANGLE to get OpenGL ES 2.0 support required for QML2.

Similar to the android branch, the idea is not to merge the branch, but later look at it and apply its changes to the dev branch.

To play with the branch, create an environment with a x86 MSVC2012 compiler and configure Qt with:

configure -nomake examples -nomake tests -developer-build -opensource -confirm-license -xplatform winrt-x86-msvc2012

We are also planning on creating a Qt Creator plugin to support deployment. Andrew Knight has already started on it in the winrt branch of his Qt Creator repository.

The work has still the “Research” status, so, we are not able to give any release dates yet. We aim to have something ready for the 5.2 release. However, since the development happens in the public winrt branch, the current state is always visible and it is easy to participate.

Contributions and help are warmly welcome.

Happy Hacking!


Posted in News, Qt, Windows

New features of Qt Designer 4.5

Published Thursday October 16th, 2008 | by

Today, I would like to take you on a tour of the features of Qt Designer in the upcoming 4.5 release. The general focus of the 4.5 release is on stability and performance. Regarding Qt Designer, we mostly worked on usability and workflow-related issues.

The widget box and the property editor now have Filter fields, which let you find properties or widgets very quickly.

Property Editor

Using Ctrl+F in the object inspector will now display a search field at the bottom, letting you perform an incremental search on the form’s widgets.

Object Inspector

Another thing to note about the object inspector is that the layout state of containers is now displayed with an icon in the left column. Broken layouts show up using the icon of the “Break Layout” action, which makes it possible to quickly check whether all container widgets have proper layouts.

The widget box now features an “Icon Mode”, in which the icons are arranged in rows. This should substantially reduce the need to scroll, especially if there are many custom widgets present.

Widget Box

Quite some work has gone into object selection. The selection modifiers now conform to standards, i.e.,Ctrl can be used to toggle the selection status of a widget. Rubber-band-selection, which was previously available only on the form itself, can now be used everywhere using the middle mouse button. A common complaint about the previous versions of Qt Designer was that selecting a layout within a nested hierarchy of layouts was difficult. As of 4.5, there will be two additional ways to achieve this: The widget context menu contains an entry “Select ancestors” which lets you select the desired ancestor widget by name. In addition, Shift-clicking a selected widget will select the next ancestor, going up the hierarchy.

Some improvements were made to layout editing. It is now possible to re-layout just by choosing another layout type without having to break the layout. Also, when breaking the layout of a container embedded into another layout, it will no longer be squeezed to zero height or width in the form editor. Instead, it will maintain its size also in the unlaid-out state, allowing for conveniently rearranging and re-layouting it. Note that this deviates from the WYSIWYG principle employed in Qt Designer; it is a temporary state that only exists in the form editor.

The form layout has an additional action “Add form layout row” in the context menu, which brings the dialog shown in the picture (also triggered by double clicking):

Form Layout “Add Row” Dialog

It let’s you specify description label and field control to be used for a row to be added very conveniently. The object names of the widget are derived from the label text as you type, no, no more lineEdit1, lineEdit2…!

One feature we are particularly proud of is “Morphing widgets”. The context menu now features a “Morph into” entry, which lists similar widget types. For example, it is possible to morph a QWidget into a QFrame or into a QGroupBox without having to break layouts, move children elsewhere, re-layout, etc.

We have not forgotten our embedded designers. Qt Designer now features an “Embedded Design” tab within its preferences dialog page, letting you define embedded device profiles. A device profile comprises screen settings like display resolution, default font and style. Designer will use these settings when editing forms.

Various other features:
Qt Designer 4.5 now supports linear wizards based on QWizard.
– Strings now have more sub-properties, for example a “translateable” checkbox that let’s you disable the translation of a string (causing it not to show up in Qt Linguist). Also, the comment field has been split up into “disambiguation” and “comment”.
– Item widget editors have been improved, allowing you to specify more properties for the items.
– Support for QButtonGroup has been added accessible via context menu for subclasses of QAbstractButton

I hope this little tour has piqued your curiosity and you will try out one of the snapshot packages!


Posted in Uncategorized

Usage of the QFormLayout

Published Monday July 7th, 2008 | by

Hi there. Introducing myself, my name is Friedemann Kleint, and I am one of the trolls hacking away at Qt Designer at the Berlin Office.

Today, I would like to draw your attention to the QFormLayout class. This is a special layout class suited to the common descriptive label – control arrangement found in many dialogs. It thas been developed in cooperation between Brisbane, Oslo and Berlin.

A typical form layout looks like this:

QFormLayout example 1

QFormLayout example 2

Note how the layout takes care of the label alignment according to the platform style. By the way, did you know that you can open several previews in different styles in Designer to compare them?

At first sight, QFormLayout looks like an ordinary grid. However, the layout also has policies for wrapping rows when it shrinks. For example, when setting the property rowWrapPolicy to WrapLongRows, we might get:

QFormLayout’s wrapping policy in effect

Let’s first have a look at the code. You might have created a such dialogs using QGridLayout, previously. This required some housekeeping of the current row. This is no longer necessary with QFormLayout using the addRow() convencience function. You don’t have to explicitly create the label, either:

QFormLayout *formLayout = new QFormLayout;
formLayout->addRow("Name", new QLineEdit);

For completeness, there is a setWidget() function which allows you to address single cells. It takes a row parameter and an ItemRole enumeration, which can be one of QFormLayout::LabelRole or QFormLayout::FieldRole.

In Qt Designer, you can create such arrangements as would in the case of a QGridLayout; you place the controls on a form and choose “Lay Out in a Form Layout”.

Hint: If you have existing .ui files containing such 2-column grid layouts and want to migrate them to the form layout, it might be sufficient to just replace the layout element by something like (after making a backup copy, of course ;-) ).

It is also possible to create arrangements with controls that span the 2 columns. This let’s you add controls with long labels (for example QComboBox) or QGroupBox elements. It can also be used to partition the form layout into sections by using spanning QLabel elements:

A form layout arrangement with spanning labels

In code, you would use the addRow() overload that takes just one QWidget* parameter.

In the upcoming 4.5 release, this functionality will also be available in Designer. Lonesone widgets on a QFormLayout get an active left/right resize handle that let’s you change the span:

Changing the span of a QFormLayout element in Designer

The per-cell API of the QFormLayout uses the SpanningRole enumeration value of ItemRole to handle these rows.

Summarizing, the QFormLayout should be used whereever the typical descriptive label – control arrangement occurs. The dialog will then look correctly on a all platforms.


Posted in Qt