Legacy MFC components


All components listed below were written by me between 2002 and 2005 when I used the MFC framework for developing various applications. I published them first on the portal, then on my personal website. At that time they were very popular.

Today I no longer maintain or support them and I can't even guarantee that they will work with latest versions of MFC. However, they are still moderately popular and can still be useful to someone, so I'm keeping a list of those components for reference. Also an archive of comments is still available.

Each of the components includes a simple demo application and a brief documentation (also included in demo packages). They can be freely used for any purposes, including commercial use.

Multi-column tree view

Simple tree view with columns and horizontal scrolling

  • Very simple - only 16 KB of code
  • Used just like the standard CTreeView, also a version for dialog windows
  • Columns header, horizontal scrolling, grid lines, full-row selection mode
  • Standard look under all OS versions

Multi-threaded SDI applications

Creating multi-threaded SDI applications with multiple windows

  • Opening documents in individual SDI windows created in separate threads
  • The Window menu which can be used to switch to other windows
  • Improved registering of file extensions and opening documents from the Explorer
  • Full integration with the document/view architecture of the MFC library

IE-style menu and toolbar

IE-style menu bar and toolbar with 32-bit images

  • Menu bar which can be placed in a Rebar control, with full mouse and keyboard support
  • 3D or flat style depending on system version and settings
  • Displaying images from 16-colors to 32-bit with alpha channel
  • Easy creating of pop-up menus

HotProp control

A flexible properties control with modern look

  • Numeric, text and boolean properties, drop-down lists of options
  • Two layout modes: single-line and double-line
  • Two visual styles: 3D of flat (Office XP style)
  • Graphical properties with custom drawing procedures
  • Dynamic adding, removing and hiding properties

Multi-page interface

User interface with many views, tabs and splitters

  • Easy creating of windows with many views using simple macros
  • Improved splitter redrawing the views while dragging
  • Dividing the interface into many pages implemented as separate MDI child windows
  • Freely nested sub-pages with automatically created tabs to switch them
Filed under: Blog

Simple template-based relational database


RDB is a set of class templates implementing simple, generic and fast collections of objects called tables. Each table can store objects of any class with one or more integer attributes called keys. The table has a separate index for each key for fast retrieving and iterating items.

In addition, this package contains adapter classes for using RDB tables with the Qt Model/View architecture.

Depending on your needs, you can use just the 'core' components of RDB, or use them together with the model components. The core RDB components have no external dependencies. The model components require Qt 4.2 or newer.

Core RDB classes

An RDB table is an indexed collection of objects, similar to a hashed map, but with the possibility to have multiple indexes for different attributes in one table. It can be used to organize data in memory in a similar way to a relational database. Note that RDB provides no support for serializing data or for binding with an external database.

Many applications need to store complex data structures in memory. They often do so by using collections of objects, which in turn contain their own collections of objects, forming a tree structure of relations. The downside is that in order to find data stored on a deep level of the tree, you have to traverse through all parent branches, which may lead to inefficient and difficult to understand code.

The situation gets even worse if the data structure is not a tree, but contains cross-references, circular dependencies and many-to-many relations. This makes memory management difficult and error-prone, especially in a language such as C++ with no automatic garbage collection.

A relational database is a simple and well established model of storing data with complex relations. Databases are excellent for storing persistent data, but cannot be used for working with data which has to be stored in memory for performance reasons. Even if an application works with a database backend, it still usually maps retrieved data to collections of objects, which are subject to the problems described above.

The purpose of RDB is to combine the efficiency and ease of use of simple containers like lists and maps with the idea of a relational database which uses keys and indexes for modeling relations between data.

Adapters for the Qt Model/View architecture

The RDB package contains adapter classes for using tables with the Qt Model/View architecture in an easy and comfortable way. This is useful if your application needs to displays various lists and trees of data stored in RDB tables. The adapter model automatically populates the view, and also provides support for automatic sorting and filtering and makes customizing columns in the view easy.

The Model/View architecture in Qt is an excellent and powerful solution, but implementing a model from scratch is not very comfortable. One of the problems is that the indexes used to identify cells are based on the physical row and column number in the view, which has to be translated to the appropriate item of data. This can be difficult when rows can be sorted, columns can be reordered and especially if the view is a tree with multiple levels of items.

The RDB::TableItemModel class solves this problem by acting like an additional layer between QAbstractItemModel and simplified models called table models. Table models operate on item identifiers (which simply correspond to keys in the RDB tables) and column identifiers, without having to know the layout of rows and columns in the view. In addition, each table model is associated with a single level of items in the tree. This way you can, for example, create a list of all persons and a tree of persons grouped by company, and reuse the same table model in both these views.


You can find the full documentation for this component at It is also included in the source package.


1.2 (2010-10-08)

  • added the findRow utility function
  • fixed wrong sorting by non-unique column
  • fixed validation of input data

1.1 (2009-11-23)

  • added: method for finding a cell in the model
  • added: default argument values for TableItemModel methods
  • fixed: possible crashes when invalid model indexes are passed
  • fixed: prevent updating the view when columns don't change

1.0 (2008-06-09)

  • initial version


This code can be freely used and modified in both open source applications (including GPL) and commercial applications. If you find it useful, please consider donating to!

See also:
Filed under: Blog

Modern Qt style for Windows


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.


    You can find the full documentation for this article at It is also included in the source package.


    1.1 (2009-11-23)

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

    1.0 (2008-07-14)

    • initial version


    This code can be freely used and modified in both open source applications (including GPL) and commercial applications. If you find it useful, please consider donating to!

    See also:
    • list of all WMStyle releases on the download page
    Filed under: Blog
Syndicate content