Blog

Modern Qt style for Windows

Submitted by mimec on 2008-07-14
WMStyle

Introduction

The WindowsModernStyle changes the look of toolbars and menus to a style similar to MS Office 2003 and some .NET applications. Depending on the selected color scheme of Windows XP and Vista, they will automatically use the blue, silver or green colors. Also when the Windows Classic style is used, the toolbars and menus will adjust their look to the current color scheme.

In addition, this style also changes the look of:

  • docked windows, including their title bars and tabs used when multiple docked windows are stacked together
  • tab widgets located within a main window (tab widgets placed in dialogs and other windows are not affected)
  • splitters located within a main window
  • toolbox widgets, including both item headers and background of pages

All other widgets are not affected and are rendered using the native Windows style (Vista, XP or classic Windows, depending on the OS version).

The style can be included in an existing application or compiled as a plugin library. This package also contains a demo program using this style.

WindowsModernStyle requires Qt 4.3 or newer, compiled with the Windows XP and Windows Vista styles enabled.

Note: a new, simplified version of the Modern Qt style is now part of the XmlUi component.

Documentation

You can find the full documentation for this article at doc.mimec.org/articles/wmstyle/. It is also included in the source package.

History

1.1 (2009-11-23)

  • added: support for toolbar buttons with menu
  • fixed: painting undocked toolbars
  • added: styling splitters in main window
  • fixed: improved appearance of styled tab widgets

1.0 (2008-07-14)

  • initial version

Downloads

This code can be freely used and modified in both open source applications (including GPL) and commercial applications.

Second Qt article

Submitted by mimec on 2008-06-23

The second Qt article is available, called Simple XML-based UI builder for Qt4. It's a component which allows to merge actions from multiple components and define the layout of menus and toolbars using simple XML files. I wrote it for WebIssues when porting from KDE to Qt4 to replace the KXMLGUI components that I previously used; however this new solution is much simpler and it doesn't depend on anything else than Qt.

Soon I will publish one more article with the graphics style for Windows used by Fraqtive. The style used by WebIssues was based on a Qt Solutions component, but the new one was completely rewritten by me, so when I remove the remaining pieces of GPL-ed code I will probably re-license it to a BSD-style license as well. Then if only I have some time, I'm going back to work on the next version of the WebIssues client.

A little side note: my recent post about moving from Gliwice made my boss panic a little bit, which is actually a good thing, because I got a pretty decent argument to think through this decision :). The truth is, if I had one argument of, let's say, more non-material nature, I would immediately buy a flat in Gliwice and, you know, live happily ever after and all that stuff. But unfortunately life is much more complicated and sometimes we have absolutely no influence on some things, so all I can do now is wait a bit more.

New articles

Submitted by mimec on 2008-06-09

I started writing first articles about programming containing reusable source code more than six years ago, inspired by websites like CodeGuru and CodeProject which were an invaluable source of information when I was learning Visual C++ and MFC. They are still available here and remain the most popular section of my website. The idea of reusing code is even more important in open source development, but it took many years until I finally decided to start publishing articles related to Qt.

At the moment I'm extracting reusable components from the WebIssues Client code and writing documentation and demo applications for them. The first article called Simple template-based relational database is already available. It describes the data container invented for and used by the WebIssues Client, which is an interesting and innovative alternative to using a hierarchy of objects to store application data in memory.

Though WebIssues is licensed under the GPL, I decided to relicense all reusable components using the revised BSD-style license, which allows to use them in both open source and commercial applications.

Another article I wrote some time ago describes the Generator core component of Fraqtive. I'm publishing it because it may be a good source of knowledge for someone who wants to learn metaprogramming on a practical example. The generator core is the most advanced piece of code that I've ever written in C++. It turned out to be an excellent exercise field, because the code is relatively small and simple, yet it allowed me to use a large number of various programming techniques, including metaprogramming with complex class templates.

Weekend in Prague

Submitted by mimec on 2008-05-31

Actually more than a weekend - four whole days. Enough time to see the most interesting places and to feel the climate of the city. It's amazing, I must admit. It's really big and full of different cultures, but somehow it makes you feel like home. It's also beautiful, not just the few places most crowded by tourists, but the entire center of the city has a consistent and elegant look. And it's calm, full of parks and gardens, nice restaurants and pubs, you almost don't file the usual rush of the big city.

This trip also made me realize the sad truth about the place where I live. Well, it wasn't the only reason, because I've been thinking above moving to another city for some time already, but that was the drop that made the glass overflow. Now it's not a matter of "if", but "where" and "when". I'm not really intending to go abroad just now (although from Gliwice it's not much farther to Prague than to Warsaw), so I'm probably going to decide between Wrocław and Kraków. The "when" is something between six months and a year, realistically speaking. I don't want to think about it during the summer, besides finding a job that would fully satisfy me will also take some time.

Upgrade of mimec.org

Submitted by mimec on 2008-04-27

Finally I did it - all mimec.org sites are now running on PHP 5, MySQL 5 and Drupal 5. They have a completely new theme, based on Garland, with some small modifications of the background and fonts. Here's a list of some other important changes:

  • I reorganized and edited the articles and created sub-categories. Now there's only one, but in May I'm planning to publish some new articles about Qt programming. I also moved the comments to the new forums section and divided them into threads so that they're easier to read.
  • I created a new section for projects with direct links to their dedicated websites. It's quite possible that Descend will also have its own website soon, I have a few new ideas and this project is really haunting me :).
  • Finally, I updated the photos, dividing them into separate galleries, uploading larger images (now you can view them in 1024x768) and adding some new ones.

Some time ago I added 'donate' links to WebIssues and Fraqtive websites, I'll also add it here. Not that I'm planning to make a lot of money and stop working ;)... but I think it's quite fair to pay for something you find useful and saves you time and money, even if it's free software. I should have done this a long time ago. By the way, thanks to Peter, the first donor :).

Also some time ago I submitted WebIssues to the Qt Center Programming Contest. Maybe it will be a chance to finally bring some attention to WebIssues in the community and move it to the next level. Who knows. Anyway, I'm going to return to this project just after I release a few more versions of Fraqtive and write the Qt articles.

Tags