Human-Machine Teaming Lab

Knowledge / Qt

QT with Visual Studio 2008 and 2010 (updated for Qt 4.7.x and 4.8.x)

These directions will allow Qt4 to be installed and used by Visual Studio 2008 or 2010.

1.  Pre-build Setup

  1. Apply service pack 1 to Visual Studio if it has not already been done.
  2. Download the latest version of QT's source code (not the minGW binaries) from here.
  3. Extract the source into C:\Source\Qt\4.x.x-32bit or a similar path. This path will be referred to as QTDIR for the remainder of this document. Qt compilation will fail if there are spaces in the path or if the path is changed after the compilation process has completed.
  4. Create the environment variables:
    1. Go to "Control Panel" → "System" → "Advanced" → "Environment Variables"
    2. Within the user variables section, click New to bring up the New User Variable dialog. User variables should be used (instead of system-wide environment variables) because multiple versions and configurations of Qt can be compiled and available on one computer simultaneously. By using User Variables, changes to one user's variables will not affect other users of the computer.
    3. Fill in the dialog. Fill in the name field with "QTDIR" and the value field with the path to the Qt source code.
    4. Click ok.
    5. Create a user environment variable PATH (or edit it if it already exists). Set the value to %QTDIR%\bin if PATH didn't already exist and prepend %QTDIR%\bin; (note the semicolon at the end) if it did.
    6. Click ok twice.

In order to install QT 4.6, it is best to enable the Dx86 environment from within the Visual Studio Command Prompt (this is not necessary for Qt 4.7 or 4.8), but does not hurt). In order to complete these steps, the DirectX SDK must be installed. The latest DirectX SDK, as of this writing, is the June 2010 build (download). You can check for a newer version here.

  1. Enabling the Dx86 environment:
    1. Once the DirectX SDK is installed, navigate to: "Start" → "All Programs" → "Microsoft DirectX SDK (June 2010)" and right click on "DirectX SDK Command Prompt".
    2. Click on Properties
    3. In the target field of the DirectX SDK Command Prompt Properties window, copy the string contained within the target field. If you are using the June 2010 build, the string reads as follows: "C:\Program Files\Microsoft DirectX SDK (June 2010)\Utilities\Bin\dx_setenv.cmd" or for 64-bit systems "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\Bin\dx_setenv.cmd"
      • Note: the string will be in two sets of quotation marks. ONLY copy the string and one set of quotation marks. What you have copied should resemble the string shown in the step above.
    4. Open the Visual Studio Command Prompt by clicking: "Start" → "All Programs" → "Microsoft Visual Studio 2008" → "Visual Studio Tools" → "Visual Studio 2008 Command Prompt".
    5. Paste the string you copied in step 3 into the Command prompt. You should receive the following message: "Dx86 target environment is now enabled. Dx86 host environment is now enabled."

2.  Build Qt

  1. Open the Visual Studio Command Prompt by clicking: "Start" → "All Programs" → "Microsoft Visual Studio 2008" → "Visual Studio Tools" → "Visual Studio 2008 Command Prompt".
  2. Navigate to the Qt directory: cd %QTDIR%
  3. Configure Qt (Visual Studio 2008): configure -opensource -confirm-license -debug-and-release -platform win32-msvc2008 -mp -ltcg
    • help - Print a list of configuration options.
    • opensource - Compile and link the Open-Source Edition of Qt.
    • confirm-license - Accepts the supplied license by default (in this case, opensource)
    • debug-and-release - Enable generation of both debug and release mode executables.
    • platform win32-msvc2008 - Specifies the desired compiler.
    • mp - Use multiple processors for compiling with MSVC (-MP).
    • ltcg - Use Link Time Code Generation. (Release builds only). This can increase performance by 10%-15%. However, the size of the library will be larger. ltcg does not work with Qt 4.8.0, but it does work for version 4.8.1+ (See the bug report), but there is a two-step work-around. First, delete the files bin/syncqt and bin/syncqt.bat. Second, add the following lines to the file src\3rdparty\webkit\Source\WebCore\WebCore.pro immediately after the line DEFINES += QT_MAKEDLL.
      QMAKE_LFLAGS_LTCG =
      QMAKE_CXXFLAGS_LTCG =
      QMAKE_CFLAGS_LTCG =
  4. Alternatively, for Visual Studio 2010,Configure Qt: configure -opensource -confirm-license -debug-and-release -platform win32-msvc2010 -mp -ltcg
    A full list of parameters can be found at Configuration Options for Qt
  5. Choose which license you would like to use and enter y when prompted. The configuration process will take a few minutes.
  6. Build Qt. This will take a long time.
    nmake
  7. Delete all intermediate files produced in the build process. These file are no longer needed.
    nmake clean

Note: You can setup these commands to run in succession by entering them as one command with each part separated by && (works for Windows 2000 and above).
configure -opensource -confirm-license -debug-and-release -platform win32-msvc2010 -ltcg -mp && nmake && nmake clean

3.  Optional Visual Studio Improvements

3.1  Improve Debugger support for Qt datatypes.

Add the following lines to the file /Common7/Packages/Debugger/autoexp.dat just before the line "[Visualizer]". Note: If you are on the Windows Vista or Windows 7 platform, you must open the text editor in "Run as Administrator" mode.

; Qt Integration
QObject =classname=<staticMetaObject.d.stringdata,s> superclassname=<staticMetaObject.d.superdata->d.stringdata,s>
QList<*>=size=<d->end,i>
QLinkedList<*>=size=<d->end,i>
QString=<d->data,su> size=<d->size,u>
QByteArray=<d->data,s> size=<d->size,u>
QUrl =<d->encodedOriginal.d->data,s>
QUrlInfo =<d->name.d->data,su>
QPoint =x=<xp> y=<yp>
QPointF =x=<xp> y=<yp>
QRect =x1=<x1> y1=<y1> x2=<x2> y2=<y2>
QRectF =x=<xp> y=<yp> w=<w> h=<h>
QSize =width=<wd> height=<ht>
QSizeF =width=<wd> height=<ht>
QMap<*> =size=<d->size>
QVector<*> =size=<d->size>
QHash<*> =size=<d->size>
QVarLengthArray<*> =size=<s> data=<ptr>
QFont =family=<d->request.family.d->data,su> size=<d->request.pointSize, f>
QDomNode =name=<impl->name.d->data,su> value=<impl->value.d->data,su>

Add the following just after the [Visualizer] tag. This has been taken directly from the Qt Visual Studio Add-in, which is not required.

;QT_DEBUG_START (Qt Visual Studio Add-in v1.1.10)
; Nokia Qt 4.x visualizers -----------------------------------------[ start ]--
;------------------------------------------------------------------------------
; Feel free to modify these visualizers to suit yours needs! But please let us
; know about the changes you make, so we continuously improve the visualizers.

QString|*::QString{
    preview         ([$e.d->data,su])
    stringview      ([$e.d->data,sub])
    children
    (
        #(
            d: $c.d,
            [size]: $c.d->size,
            [referenced]: $c.d->ref._q_value
        )
    )
}

QByteArray|*::QByteArray{
    preview         ([$e.d->data,s])
    stringview      ([$e.d->data,sb])
    children
    (
        #(
            d: $c.d,
            [size]: $c.d->size,
            [referenced]: $c.d->ref._q_value
        )
    )
}

QFileInfo|*::QFileInfo{
    preview
    (
        #(
            "private=", $c.d_ptr
        )
    )
}

QUrl|*::QUrl{
    preview
    (
        #if ($e.d.stateFlags == 0) (
            $e.d
        ) #else (
            #( $e.d->scheme, $e.d->host, $e.d->path )
        )
    )
    children
    (
        #(
            scheme: $c.d->scheme,
            host: $c.d->host,
            path: $c.d->path,
            username: $c.d->userName,
            password: $c.d->password,
            encodedOriginal: $c.d->encodedOriginal,
            query: $c.d->query,
            fragment: $c.d->fragment
        )
    )
}

QTime|*::QTime{
    preview
    (
        #(
            "hour=", [$e.mds / 3600000, d],
            ", minute=", [($e.mds % 3600000) / 60000, d],
            ", second=", [($e.mds / 1000) % 60, d],
            ", millisecond=", [$e.mds % 1000, d]
        )
    )
    children
    (
        #(
            [hour]: [$e.mds / 3600000, d],
            [minute]: [($e.mds % 3600000) / 60000, d],
            [second]: [($e.mds / 1000) % 60, d],
            [millisecond]: [$e.mds % 1000, d]
        )
    )
}

QVariant{
    preview
    (
        #if ($e.d.type == 1) (
            #("bool = ", [$e.d.data.b])
        ) #elif ($e.d.type == 2) (
            #("int = ", [$e.d.data.i])
        ) #elif ($e.d.type == 3) (
            #("usigned int = ", [$e.d.data.u])
        ) #elif ($e.d.type == 4) (
            #("long long = ", [$e.d.data.ll])
        ) #elif ($e.d.type == 5) (
            #("unsigned long long = ", [$e.d.data.ull])
        ) #elif ($e.d.type == 6) (
            #("double = ", [$e.d.data.d])
        ) #elif ($e.d.type == 7) (
            #("char = ", [$e.d.data.c])
        ) #elif ($e.d.type == 8) (
            #("QMap = ", [(QMap) $e.d.data.ptr])
        ) #elif ($e.d.type == 10) (
            #("QString = ", [(QString) $e.d.data.ptr])
        ) #elif ($e.d.type == 11) (
            #("QStringList = ", [(QStringList) $e.d.data.ptr])
        ) #elif ($e.d.type == 17) (
            #("QUrl = ", [(QUrl) $e.d.data.ptr])
        ) #else (
            #("type = ", [$e.d.type])
        )
    )
    children
    (
        #if ($e.d.type == 1) (
            $c.d.data.b
        ) #elif ($e.d.type == 2) (
            $c.d.data.i
        ) #elif ($e.d.type == 3) (
            $c.d.data.u
        ) #elif ($e.d.type == 4) (
            $c.d.data.ll
        ) #elif ($e.d.type == 5) (
            $c.d.data.ull
        ) #elif ($e.d.type == 6) (
            $c.d.data.d
        ) #elif ($e.d.type == 7) (
            $c.d.data.c
        ) #elif ($e.d.type == 8) (
        ) #elif ($e.d.type == 10) (
            #(
                [size]: ((QString) $c.d.data.ptr).d->size
            )
        ) #elif ($e.d.type == 11) (
            #if ((((QStringList) $e.d.data.ptr).d->end - ((QStringList) $e.d.data.ptr).d->begin) <= 10) (
               #array
               (
                    expr: (QString)((((QStringList) $e.d.data.ptr).d->array + ((QStringList) $e.d.data.ptr).d->begin)[$i]),
                    size: ((QStringList) $e.d.data.ptr).d->end-((QStringList) $e.d.data.ptr).d->begin
                )
            ) #else (
                #array
                (
                    expr: (QString)((((QStringList) $e.d.data.ptr).d->array + ((QStringList) $e.d.data.ptr).d->begin)[$i]),
                    size: 10
                )
            )
        ) #elif ($e.d.type == 17) (
            #(
                scheme: ((QUrl) $e.d.data.ptr).d->scheme,
                host: ((QUrl) $e.d.data.ptr).d->host,
                path: ((QUrl) $e.d.data.ptr).d->path,
                username: ((QUrl) $e.d.data.ptr).d->userName,
                password: ((QUrl) $e.d.data.ptr).d->password,
                encodedOriginal: ((QUrl) $e.d.data.ptr).d->encodedOriginal,
                query: ((QUrl) $e.d.data.ptr).d->query,
                fragment: ((QUrl) $e.d.data.ptr).d->fragment
            )
        ) #else (
            #("type = ", [$e.d.type])
        )
    )
}

*::QVariant{
    preview
    (
        #if ($e.d.type == 1) (
            #("bool = ", [$e.d.data.b])
        ) #elif ($e.d.type == 2) (
            #("int = ", [$e.d.data.i])
        ) #elif ($e.d.type == 3) (
            #("usigned int = ", [$e.d.data.u])
        ) #elif ($e.d.type == 4) (
            #("long long = ", [$e.d.data.ll])
        ) #elif ($e.d.type == 5) (
            #("unsigned long long = ", [$e.d.data.ull])
        ) #elif ($e.d.type == 6) (
            #("double = ", [$e.d.data.d])
        ) #elif ($e.d.type == 7) (
            #("char = ", [$e.d.data.c])
        ) #elif ($e.d.type == 8) (
            #("QMap = ", [($T1::QMap) $e.d.data.ptr])
        ) #elif ($e.d.type == 10) (
            #("QString = ", [($T1::QString) $e.d.data.ptr])
        ) #elif ($e.d.type == 11) (
            #("QStringList = ", [($T1::QStringList) $e.d.data.ptr])
        ) #elif ($e.d.type == 17) (
            #("QUrl = ", [($T1::QUrl) $e.d.data.ptr])
        ) #else (
            #("type = ", [$e.d.type])
        )
    )
    children
    (
        #if ($e.d.type == 1) (
            $c.d.data.b
        ) #elif ($e.d.type == 2) (
            $c.d.data.i
        ) #elif ($e.d.type == 3) (
            $c.d.data.u
        ) #elif ($e.d.type == 4) (
            $c.d.data.ll
        ) #elif ($e.d.type == 5) (
            $c.d.data.ull
        ) #elif ($e.d.type == 6) (
            $c.d.data.d
        ) #elif ($e.d.type == 7) (
            $c.d.data.c
        ) #elif ($e.d.type == 8) (
        ) #elif ($e.d.type == 10) (
            #(
                [size]: (($T1::QString) $c.d.data.ptr).d->size
            )
        ) #elif ($e.d.type == 11) (
            #if (((($T1::QStringList) $e.d.data.ptr).d->end - (($T1::QStringList) $e.d.data.ptr).d->begin) <= 10) (
               #array
               (
                    expr: ($T1::QString)(((($T1::QStringList) $e.d.data.ptr).d->array + (($T1::QStringList) $e.d.data.ptr).d->begin)[$i]),
                    size: (($T1::QStringList) $e.d.data.ptr).d->end-(($T1::QStringList) $e.d.data.ptr).d->begin
                )
            ) #else (
                #array
                (
                    expr: ($T1::QString)(((($T1::QStringList) $e.d.data.ptr).d->array + (($T1::QStringList) $e.d.data.ptr).d->begin)[$i]),
                    size: 10
                )
            )
        ) #elif ($e.d.type == 17) (
            #(
                scheme: (($T1::QUrl) $e.d.data.ptr).d->scheme,
                host: (($T1::QUrl) $e.d.data.ptr).d->host,
                path: (($T1::QUrl) $e.d.data.ptr).d->path,
                username: (($T1::QUrl) $e.d.data.ptr).d->userName,
                password: (($T1::QUrl) $e.d.data.ptr).d->password,
                encodedOriginal: (($T1::QUrl) $e.d.data.ptr).d->encodedOriginal,
                query: (($T1::QUrl) $e.d.data.ptr).d->query,
                fragment: (($T1::QUrl) $e.d.data.ptr).d->fragment
            )
        ) #else (
            #("type = ", [$e.d.type])
        )
    )
}

;------------------------------------------------------------------------------
; QStringList
;------------------------------------------------------------------------------
QStringList{
    preview
    (
        #if (($c.d->end - $c.d->begin) <= 10) (
            #(
                "[", $c.d->end - $c.d->begin, "](",
                #array
                (
                    expr: (QString)(($c.d->array + $c.d->begin)[$i]),
                    size: $c.d->end-$c.d->begin
                ), ")"
            )
        ) #else (
            #(
                "[", $c.d->end - $c.d->begin, "](",
                #array
                (
                    expr: (QString)(($c.d->array + $c.d->begin)[$i]),
                    size: 10
                ), ", ...)"
            )
        )
    )
}

*::QStringList{
    preview
    (
        #if (($c.d->end - $c.d->begin) <= 10) (
            #(
                "[", $c.d->end - $c.d->begin, "](",
                #array
                (
                    expr: ($T1::QString)(($c.d->array + $c.d->begin)[$i]),
                    size: $c.d->end-$c.d->begin
                ), ")"
            )
        ) #else (
            #(
                "[", $c.d->end - $c.d->begin, "](",
                #array
                (
                    expr: ($T1::QString)(($c.d->array + $c.d->begin)[$i]),
                    size: 10
                ), ", ...)"
            )
        )
    )
}

;------------------------------------------------------------------------------
; QList, QQueue
;------------------------------------------------------------------------------
QList<*>|QQueue<*>{
    preview
    (
        #if (int(sizeof($T1)) <= int(sizeof(void*))) (
            #if (($c.d->end - $c.d->begin) <= 10) (
                #(
                    "[", $c.d->end - $c.d->begin, "](",
                    #array
                    (
                        expr: ($T1)(($c.d->array + $c.d->begin)[$i]),
                        size: $c.d->end-$c.d->begin
                    ), ")"
                )
            ) #else (
                #(
                    "[", $c.d->end - $c.d->begin, "](",
                    #array
                    (
                        expr: ($T1)(($c.d->array + $c.d->begin)[$i]),
                        size: 10
                    ), ", ...)"
                )
            )
        ) #else (
            #if (($c.d->end - $c.d->begin) <= 10) (
                #(
                    "[", $c.d->end - $c.d->begin, "](",
                    #array
                    (
                        expr: *($T1*)(($c.d->array + $c.d->begin)[$i]),
                        size: $c.d->end-$c.d->begin
                    ), ")"
                )
            ) #else (
                #(
                    "[", $c.d->end - $c.d->begin, "](",
                    #array
                    (
                        expr: *($T1*)(($c.d->array + $c.d->begin)[$i]),
                        size: 10
                    ), ", ...)"
                )
            )
        )
    )
    children
    (
        #if (int(sizeof($T1)) <= int(sizeof(void*))) (
            #array (
                expr: ($T1)(($c.d->array + $c.d->begin)[$i]),
                size: $c.d->end - $c.d->begin
            )
        ) #else (
            #array (
                expr: *($T1*)(($c.d->array + $c.d->begin)[$i]),
                size: $c.d->end - $c.d->begin
            )
        )
    )
}

*::QList<*>|*::QQueue<*>{
    preview
    (
        #if (int(sizeof($T2)) <= int(sizeof(void*))) (
            #if (($c.d->end - $c.d->begin) <= 10) (
                #(
                    "[", $c.d->end - $c.d->begin, "](",
                    #array
                    (
                        expr: ($T2)(($c.d->array + $c.d->begin)[$i]),
                        size: $c.d->end-$c.d->begin
                    ), ")"
                )
            ) #else (
                #(
                    "[", $c.d->end - $c.d->begin, "](",
                    #array
                    (
                        expr: ($T2)(($c.d->array + $c.d->begin)[$i]),
                        size: 10
                    ), ", ...)"
                )
            )
        ) #else (
            #if (($c.d->end - $c.d->begin) <= 10) (
                #(
                    "[", $c.d->end - $c.d->begin, "](",
                    #array
                    (
                        expr: *($T2*)(($c.d->array + $c.d->begin)[$i]),
                        size: $c.d->end-$c.d->begin
                    ), ")"
                )
            ) #else (
                #(
                    "[", $c.d->end - $c.d->begin, "](",
                    #array
                    (
                        expr: *($T2*)(($c.d->array + $c.d->begin)[$i]),
                        size: 10
                    ), ", ...)"
                )
            )
        )
    )
    children
    (
        #if (int(sizeof($T2)) <= int(sizeof(void*))) (
            #array (
                expr: ($T2)(($c.d->array + $c.d->begin)[$i]),
                size: $c.d->end - $c.d->begin
            )
        ) #else (
            #array (
                expr: *($T2*)(($c.d->array + $c.d->begin)[$i]),
                size: $c.d->end - $c.d->begin
            )
        )
    )
}

;------------------------------------------------------------------------------
; QList::iterator, QQueue::iterator
;------------------------------------------------------------------------------
QList<*>::iterator|QList<*>::const_iterator|QQueue<*>::iterator|QQueue<*>::const_iterator{
    preview
    (
        #(
            ($T1*)$c.ptr
        )
    )
    children
    (
        #(
            ptr: ($T1)$c.ptr
        )
    )
}

*::QList<*>::iterator|*::QList<*>::const_iterator|*::QQueue<*>::iterator|*::QQueue<*>::const_iterator{
    preview
    (
        #(
            ($T2)$c.i->v
        )
    )
    children
    (
        #(
            ptr: ($T2)$c.i->v
        )
    )
}

;------------------------------------------------------------------------------
; QListIterator
;------------------------------------------------------------------------------
QListIterator<*>|QMutableListIterator<*>{
    preview
    (
        #(
            *($T1*)($c.i.i->v)
        )
    )
    children
    (
        #(
            Value: *($T1*)($c.i.i->v)
        )
    )
}

*::QListIterator<*>|*::QMutableListIterator<*>{
    preview
    (
        #(
            *($T2*)($c.i.i->v)
        )
    )
    children
    (
        #(
            Value: *($T2*)($c.i.i->v)
        )
    )
}

;------------------------------------------------------------------------------
; QLinkedList
;------------------------------------------------------------------------------
QLinkedList<*>{
    preview
    (
        #if ($e.d->size >= 10) (
            #(
                "[", $e.d->size, "](",
                #list
                (
                    head: $c.d->n,
                    size: 10,
                    next: n
                ) : ( (*(QLinkedListNode<$T1>*)&$e).t ), ", ...)"
            )
        ) #else (
            #(
                "[", $e.d->size, "](",
                #list
                (
                    head: $c.d->n,
                    size: $c.d->size,
                    next: n
                ) : ( (*(QLinkedListNode<$T1>*)&$e).t ), ")"
            )
        )
    )
    children
    (
        #(
            #list
            (
                head: $c.d->n,
                size: $c.d->size,
                next: n
            ) : (*(QLinkedListNode<$T1>*)&$e).t
        )
    )
}

*::QLinkedList<*>{
    preview
    (
        #if ($e.d->size >= 10) (
            #(
                "[", $e.d->size, "](",
                #list
                (
                    head: $c.d->n,
                    size: 10,
                    next: n
                ) : ( (*($T1::QLinkedListNode<$T2>*)&$e).t ), ", ...)"
            )
        ) #else (
            #(
                "[", $e.d->size, "](",
                #list
                (
                    head: $c.d->n,
                    size: $c.d->size,
                    next: n
                ) : ( (*($T1::QLinkedListNode<$T2>*)&$e).t ), ")"
            )
        )
    )
    children
    (
        #(
            #list
            (
                head: $c.d->n,
                size: $c.d->size,
                next: n
            ) : (*($T1::QLinkedListNode<$T2>*)&$e).t
        )
    )
}

;------------------------------------------------------------------------------
; QLinkedList::iterator
;------------------------------------------------------------------------------
QLinkedList<*>::iterator|*::QLinkedList<*>::iterator|QLinkedList<*>::const_iterator|*::QLinkedList<*>::const_iterator{
    preview
    (
        #(
            $e.i->t
        )
    )
    children
    (
        #(
            ptr: $e.i->t
        )
    )
}

QLinkedListIterator<*>|*::QLinkedListIterator<*>{
    preview
    (
        #(
            $c.i
        )
    )
    children
    (
        #(
            value: $c.i
        )
    )
}

;------------------------------------------------------------------------------
; QVector, QStack
;
; By default, this visualizer supports only Qt 4.6.x. If you're going to use
; Qt 4.5.x code, then you may want to replace all expr lines with this:
;    expr: (((size_t)($c.d) + (size_t)(sizeof(QVectorData)) ))[$i],
;
; This will allow this visualizer to display Qt 4.5.x and Qt 4.6.x QVector
; objects. But be aware of some limitations. For example enum types can't be
; displayed properly this way.
;
; Qt 4.5.x:
;     QVector::d is QVectorTypedData<T>
;     QVector::p is QVectorData
;     expr: $c.d->array[$i]
;
; Qt 4.6.x:
;     QVector::d is QVectorData
;     QVector::p is QVectorTypedData<T>
;     expr: $c.p->array[$i]
;
;------------------------------------------------------------------------------
QVector<*>|*::QVector<*>|QStack<*>|*::QStack<*>{
    preview
    (
        #if ($c.d->size <= 10) (
            #(
                "[", $c.d->size, "](",
                #array
                (
                    expr: $c.p->array[$i],
                    size: $c.d->size
                ), ")"
            )
        ) #else (
            #(
                "[", $c.d->size, "](",
                #array
                (
                    expr: $c.p->array[$i],
                    size: 10
                ), ", ...)"
            )
        )
    )
    children
    (
        #array
        (
            expr: $c.p->array[$i],
            size: $c.d->size
        )
    )
}

;------------------------------------------------------------------------------
; QMap
;------------------------------------------------------------------------------
QMapNode<*,*>{
    preview
    (
        #(
            "(",
            $e.key,
            "; ",
            $e.value,
            ")"
        )
    )

    children
    (
        #(
            key: $e.key,
            value: $e.value
        )
    )
}

QMap<*>{
    children
    (
        #(
            raw data: [$c,!],
            #tree
            (
                head : $c.d->forward[0],
                skip : $c.d,
                size : $c.d->size,
                left : backward,
                right : forward
            ) : ( (QMapNode<$T1>*)((char*)&$e - (sizeof(QMapPayloadNode<$T1>) - sizeof(QMapData::Node*))) )
        )
    )

    preview
    (
        #(
            "[",
            $e.d->size,
            "](",
                #tree
                (
                    head : $c.d->forward[0],
                    size : $c.d->size,
                    left : backward,
                    right : forward
                ) : $e,
            ")"
        )
    )
}

;------------------------------------------------------------------------------
; QHash
;------------------------------------------------------------------------------
QHash<*>{
    preview
    (
        #(
            "[", $e.d->size, "] (...)"
        )
    )
    children
    (
        #if ($e.d->size <= 255) (
            #(
                #array (
                    expr: (QHashNode<$T1>*)$c.d->buckets[$i],
                    size: $c.d->numBuckets
                ) : #list (
                    head: $e,
                    next: next
                ) : #switch ($e.next != 0) #case 1 (
                    $e
                )
            )
        ) #else (
            #(
                #array (
                    expr: (QHashNode<$T1>*)$c.d->buckets[$i],
                    size: 255
                ) : #list (
                    head: $e,
                    next: next
                ) : #switch ($e.next != 0) #case 1 (
                    $e
                )
            )
        )
    )
}

*::QHash<*>{
    preview
    (
        #(
             "[", $e.d->size, "] (...)"
        )
    )
    children
    (
        #if ($e.d->size <= 255) (
            #(
                #array (
                    expr: ($T1::QHashNode<$T2> *)$c.d->buckets[$i],
                    size: $c.d->numBuckets
                ) : #list (
                    head: $e,
                    next: next
                ) : #switch ($e.next != 0) #case 1 (
                    $e
                )
            )
        ) #else (
            #(
                #array (
                    expr: ($T1::QHashNode<$T2> *)$c.d->buckets[$i],
                    size: 255
                ) : #list (
                    head: $e,
                    next: next
                ) : #switch ($e.next != 0) #case 1 (
                    $e
                )
            )
        )
    )
}

;------------------------------------------------------------------------------
; QMultiHash
;------------------------------------------------------------------------------
QMultiHash<*>{
    preview
    (
        (*(QHash<$T1>*)(&$c))
    )
}

*::QMultiHash<*>{
    preview
    (
        (*($T1::QHash<$T2>*)(&$c))
    )
}

;------------------------------------------------------------------------------
; QHash::iterator
;------------------------------------------------------------------------------
QHash<*>::iterator{
    preview
    (
        #(
            "(", ((QHashNode<$T1>*)($c.i))->key, ", ", ((QHashNode<$T1>*)($c.i))->value, ")"
        )
    )
    children
    (
        #(
            key: ((QHashNode<$T1>*)($c.i))->key,
            value: ((QHashNode<$T1>*)($c.i))->value
        )
    )
}

*::QHash<*>::iterator{
    preview
    (
        #(
            "(", (($T1::QHashNode<$T2>*)($c.i))->key, ", ", (($T1::QHashNode<$T2>*)($c.i))->key, ")"
        )
    )
    children
    (
        #(
            key: (($T1::QHashNode<$T2>*)($c.i))->key,
            value: (($T1::QHashNode<$T2>*)($c.i))->value
        )
    )
}

;------------------------------------------------------------------------------
; QHashIterator
;------------------------------------------------------------------------------
QHashIterator<*>{
    preview
    (
        #(
            "(", ((QHashNode<$T1>*)((($c).i).i))->key, ", ", ((QHashNode<$T1>*)((($c).i).i))->key, ")"
        )
    )
    children
    (
        #(
            key: ((QHashNode<$T1>*)((($c).i).i))->key,
            value: ((QHashNode<$T1>*)((($c).i).i))->value
        )
    )
}

*::QHashIterator<*>{
    preview
    (
        #(
            "(", (($T1::QHashNode<$T2>*)((($c).i).i))->key, ", ", (($T1::QHashNode<$T2>*)((($c).i).i))->key, ")"
        )
    )
    children
    (
        #(
            key: (($T1::QHashNode<$T2>*)((($c).i).i))->key,
            value: (($T1::QHashNode<$T2>*)((($c).i).i))->value
        )
    )
}

;------------------------------------------------------------------------------
; QHashNode
;------------------------------------------------------------------------------
QHashNode<*>|*::QHashNode<*>{
    preview
    (
        #(
            "(key = ", $c.key,"; value = ", $c.value, ")"
        )
    )
    children
    (
        #(
            key: $c.key,
            value: $c.value
        )
    )
}

;------------------------------------------------------------------------------
; QSet
;------------------------------------------------------------------------------
QSet<*>{
    preview
    (
        #(
             "[", $e.q_hash.d->size, "] (...)"
        )
    )
    children
    (
        #if ($e.q_hash.d->size <= 255) (
            #(
                #array (
                    expr: (QHashNode<$T1,QHashDummyValue> *)$c.q_hash.d->buckets[$i],
                    size: $c.q_hash.d->numBuckets
                ) : #list (
                    head: $e,
                    next: next
                ) : #switch ($e.next != 0) #case 1 (
                    $e.key
                )
            )
        ) #else (
            #(
                #array (
                    expr: (QHashNode<$T1,QHashDummyValue> *)$c.q_hash.d->buckets[$i],
                    size: 255
                ) : #list (
                    head: $e,
                    next: next
                ) : #switch ($e.next != 0) #case 1 (
                    $e.key
                )
            )
        )
    )
}

*::QSet<*>{
    preview
    (
        #(
             "[", $e.q_hash.d->size, "] (...)"
        )
    )
    children
    (
        #if ($e.q_hash.d->size <= 255) (
            #(
                #array (
                    expr: ($T1::QHashNode<$T2,QHashDummyValue> *)$c.q_hash.d->buckets[$i],
                    size: $c.q_hash.d->numBuckets
                ) : #list (
                    head: $e,
                    next: next
                ) : #switch ($e.next != 0) #case 1 (
                    $e.key
                )
            )
        ) #else (
            #(
                #array (
                    expr: ($T1::QHashNode<$T2,QHashDummyValue> *)$c.q_hash.d->buckets[$i],
                    size: 255
                ) : #list (
                    head: $e,
                    next: next
                ) : #switch ($e.next != 0) #case 1 (
                    $e.key
                )
            )
        )
    )
}

;------------------------------------------------------------------------------
; QPalette
;------------------------------------------------------------------------------
QPalette{
    children
    (
        #(
            WindowText_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 0)->d,
            Button_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 1)->d,
            Light_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 2)->d,
            Midlight_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 3)->d,
            Dark_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 4)->d,
            Mid_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 5)->d,
            Text_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 6)->d,
            BrightText_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 7)->d,
            ButtonText_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 8)->d,
            Base_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 9)->d,
            Window_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+10)->d,
            Shadow_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+11)->d,
            Highlight_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+12)->d,
            HighlightedText_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+13)->d,
            Link_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+14)->d,
            LinkVisited_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+15)->d,
            AlternateBase_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+16)->d,
            NoRole_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+17)->d,
            ToolTipBase_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+18)->d,
            ToolTipText_active:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+19)->d,

            WindowText_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 0)->d,
            Button_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 1)->d,
            Light_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 2)->d,
            Midlight_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 3)->d,
            Dark_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 4)->d,
            Mid_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 5)->d,
            Text_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 6)->d,
            BrightText_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 7)->d,
            ButtonText_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 8)->d,
            Base_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 9)->d,
            Window_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+10)->d,
            Shadow_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+11)->d,
            Highlight_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+12)->d,
            HighlightedText_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+13)->d,
            Link_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+14)->d,
            LinkVisited_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+15)->d,
            AlternateBase_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+16)->d,
            NoRole_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+17)->d,
            ToolTipBase_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+18)->d,
            ToolTipText_disabled:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+19)->d,

            WindowText_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 0)->d,
            Button_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 1)->d,
            Light_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 2)->d,
            Midlight_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 3)->d,
            Dark_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 4)->d,
            Mid_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 5)->d,
            Text_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 6)->d,
            BrightText_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 7)->d,
            ButtonText_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 8)->d,
            Base_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 9)->d,
            Window_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+10)->d,
            Shadow_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+11)->d,
            Highlight_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+12)->d,
            HighlightedText_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+13)->d,
            Link_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+14)->d,
            LinkVisited_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+15)->d,
            AlternateBase_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+16)->d,
            NoRole_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+17)->d,
            ToolTipBase_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+18)->d,
            ToolTipText_inactive:
                ((QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+19)->d
        )
    )
}

*::QPalette{
    children
    (
        #(
            WindowText_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 0)->d,
            Button_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 1)->d,
            Light_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 2)->d,
            Midlight_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 3)->d,
            Dark_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 4)->d,
            Mid_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 5)->d,
            Text_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 6)->d,
            BrightText_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 7)->d,
            ButtonText_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 8)->d,
            Base_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+ 9)->d,
            Window_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+10)->d,
            Shadow_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+11)->d,
            Highlight_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+12)->d,
            HighlightedText_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+13)->d,
            Link_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+14)->d,
            LinkVisited_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+15)->d,
            AlternateBase_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+16)->d,
            NoRole_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+17)->d,
            ToolTipBase_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+18)->d,
            ToolTipText_active:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+19)->d,

            WindowText_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 0)->d,
            Button_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 1)->d,
            Light_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 2)->d,
            Midlight_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 3)->d,
            Dark_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 4)->d,
            Mid_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 5)->d,
            Text_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 6)->d,
            BrightText_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 7)->d,
            ButtonText_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 8)->d,
            Base_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+ 9)->d,
            Window_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+10)->d,
            Shadow_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+11)->d,
            Highlight_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+12)->d,
            HighlightedText_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+13)->d,
            Link_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+14)->d,
            LinkVisited_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+15)->d,
            AlternateBase_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+16)->d,
            NoRole_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+17)->d,
            ToolTipBase_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+18)->d,
            ToolTipText_disabled:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+20+19)->d,

            WindowText_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 0)->d,
            Button_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 1)->d,
            Light_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 2)->d,
            Midlight_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 3)->d,
            Dark_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 4)->d,
            Mid_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 5)->d,
            Text_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 6)->d,
            BrightText_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 7)->d,
            ButtonText_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 8)->d,
            Base_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+ 9)->d,
            Window_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+10)->d,
            Shadow_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+11)->d,
            Highlight_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+12)->d,
            HighlightedText_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+13)->d,
            Link_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+14)->d,
            LinkVisited_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+15)->d,
            AlternateBase_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+16)->d,
            NoRole_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+17)->d,
            ToolTipBase_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+18)->d,
            ToolTipText_inactive:
                (($T1::QBrush*)((char*)$c.d+sizeof(QAtomicInt))+40+19)->d
        )
    )
}

;------------------------------------------------------------------------------
; QBrush
;------------------------------------------------------------------------------
QBrush|*::QBrush{
    preview
    (
        #(
            "[", $c.d->style, "] (...)"
        )
    )
    children
    (
        #(
            style: $c.d->style,
            color: $c.d->color,
            transform: $c.d->transform
        )
    )
}

QBrushData|*::QBrushData{
    preview
    (
        #(
            "[", $c.style, "] (...)"
        )
    )
    children
    (
        #(
            style: $c.style,
            color: $c.color,
            transform: $c.transform
        )
    )
}

;------------------------------------------------------------------------------
; QColor
;------------------------------------------------------------------------------
QColor|*::QColor{
    preview
    (
        #(
            #if ($c.cspec == 1) (
                #(
                    "[", $c.cspec, "] [", "r = ", [$c.ct.argb.red,x],
                                          ", g = ", [$c.ct.argb.green,x],
                                          ", b = ", [$c.ct.argb.blue,x], "] (...)"
                )
            ) #elif ($c.cspec == 2) (
                #(
                    "[", $c.cspec, "] [", "h = ", [$c.ct.ahsv.hue,x],
                                          ", s = ", [$c.ct.ahsv.saturation,x],
                                          ", v = ", [$c.ct.ahsv.value,x], "] (...)"
                )
            ) #elif ($c.cspec == 3) (
                #(
                    "[", $c.cspec, "] [", "c = ", [$c.ct.acmyk.cyan,x],
                                          ", m = ", [$c.ct.acmyk.magenta,x],
                                          ", y = ", [$c.ct.acmyk.yellow,x],
                                          ", k = ", [$c.ct.acmyk.black,x], "] (...)"
                )
            ) #else (
                #(
                    "[Invalid]"
                )
            )
        )
    )
    children
    (
        #(
            #if ($c.cspec == 1) (
                #(
                    red: [$c.ct.argb.red,x],
                    green: [$c.ct.argb.green,x],
                    blue: [$c.ct.argb.blue,x],
                    alpha: [$c.ct.argb.alpha,x],
            pad: [$c.ct.argb.pad,x]
                )
            ) #elif ($c.cspec == 2) (
                #(
                    hue: [$c.ct.ahsv.hue,x],
                    saturation: [$c.ct.ahsv.saturation,x],
                    value: [$c.ct.ahsv.value,x],
                    alpha: [$c.ct.ahsv.alpha,x],
            pad: [$c.ct.ahsv.pad,x]                    
                )
            ) #elif ($c.cspec == 3) (
                #(
                    cyan: [$c.ct.acmyk.cyan,x],
                    magenta: [$c.ct.acmyk.magenta,x],
                    yellow: [$c.ct.acmyk.yellow,x],
                    black: [$c.ct.acmyk.black,x],
                    alpha: [$c.ct.acmyk.alpha,x]
                )
            )
        )
    )
}

;------------------------------------------------------------------------------
; QTransform
;------------------------------------------------------------------------------
QTransform|*::QTransform{
    preview
    (
        #(
            "[",[$c.affine._m11,g]," ",[$c.affine._m12,g]," ",[$c.m_13,g],"]",
            "[",[$c.affine._m21,g]," ",[$c.affine._m22,g]," ",[$c.m_23,g],"]",
            "[",[$c.affine._dx,g]," ",[$c.affine._dy,g]," ",[$c.m_33,g],"]"
        )
    )
    children
    (
        #(
            translation_horizontal_m31_dx: [$c.affine._dx,g],
            translation_vertical_m32_dy: [$c.affine._dy,g],
            scaling_horizontal_m11: [$c.affine._m11,g],
            scaling_vertical_m22: [$c.affine._m22,g],
            projection_factor_m33: [$c.m_33,g],
            projection_horizontal_m13: [$c.m_13,g],
            projection_vertical_m23: [$c.m_23,g],
            shearing_horizontal_m21: [$c.affine._m21,g],
            shearing_vertical_m12: [$c.affine._m12,g],
            type: $c.m_type,
            dirty: (bool)$c.m_dirty
        )
    )
}

;------------------------------------------------------------------------------
; QMatrix
;------------------------------------------------------------------------------
QMatrix|*::QMatrix{
    preview
    (
        #(
            "[",[$c._m11,g]," ",[$c._m12,g],"]",
            "[",[$c._m21,g]," ",[$c._m22,g],"]",
            "[",[$c._dx,g]," ",[$c._dy,g],"]"
        )
    )
    children
    (
        #(
            translation_horizontal_dx: [$c._dx,g],
            translation_vertical_dy: [$c._dy,g],
            scaling_horizontal_m11: [$c._m11,g],
            scaling_vertical_m22: [$c._m22,g],
            shearing_horizontal_m21: [$c._m21,g],
            shearing_vertical_m12: [$c._m12,g]
        )
    )
}

;------------------------------------------------------------------------------
; QPolygon
;------------------------------------------------------------------------------
QPolygon{
    preview
    (
        #(
             "[", ((QVector<QPoint>*)(&$c))->d->size, "] (...)"
        )
    )
    children
    (
        #(
            #array
            (
                expr: ((QPoint*)(((void*)$c.d) + sizeof(QVectorData)))[$i],
                size: ((QVector<QPoint>*)(&$c))->d->size
            )
        )
    )
}
*::QPolygon{
    preview
    (
        #(
             "[", (($T1::QVector<$T1::QPoint>*)(&$c))->d->size, "] (...)"
        )
    )
    children
    (
        #(
            #array
            (
                expr: (($T1::QPoint*)(((void*)$c.d) + sizeof(QVectorData)))[$i],
                size: (($T1::QVector<$T1::QPoint>*)(&$c))->d->size
            )
        )
    )
}

;------------------------------------------------------------------------------
; QPolygonF
;------------------------------------------------------------------------------
QPolygonF{
    preview
    (
        #(
             "[", ((QVector<QPointF>*)(&$c))->d->size, "] (...)"
        )
    )
    children
    (
        #(
            #array
            (
                expr: ((QVector<QPointF>*)(&$c))->p->array[$i],
                size: ((QVector<QPointF>*)(&$c))->d->size
            )
        )
    )
}

*::QPolygonF{
    preview
    (
        #(
             "[", (($T1::QVector<$T1::QPointF>*)(&$c))->d->size, "] (...)"
        )
    )
    children
    (
        #(
            #array
            (
                expr: (($T1::QVector<$T1::QPointF>*)(&$c))->p->array[$i],
                size: (($T1::QVector<$T1::QPointF>*)(&$c))->d->size
            )
        )
    )
}

;------------------------------------------------------------------------------
; Nokia Qt 4.x visualizers -------------------------------------------[ end ]--
;QT_DEBUG_END

3.2  IntelliSense

IntelliSense settings for Qt can be added to Visual Studio's options for all projects or set at the project level. Setting the options at the project level allows the settings to be maintained across multiple Visual Studio installs. However, the settings will have to be set after each new project is created.

To setup IntelliSense for all projects on your Visual Studio install, add the following lines to the Visual Studio include file paths dialog.

Visual Studio 2008 and earlier (per installation):

  1. Go to Tools->Options->Projects and Solutions->VC++ Directories
  2. Change the Show directories to "Include Files".

Visual Studio 2010 (per user):

  1. Go to View->Property Manager
  2. Fully expand the tree
  3. Multi-select all .user files
  4. Right click and select properties
$(QTDIR)\include
$(QTDIR)\include\Qt
$(QTDIR)\include\QtCore
$(QTDIR)\include\QtGui
$(QTDIR)\include\ActiveQt
$(QTDIR)\include\Qt3Support
$(QTDIR)\include\QtAssistant
$(QTDIR)\include\QtDBus
$(QTDIR)\include\QtDeclarative
$(QTDIR)\include\QtDesigner
$(QTDIR)\include\QtHelp
$(QTDIR)\include\QtMultimedia
$(QTDIR)\include\QtNetwork
$(QTDIR)\include\QtOpenGL
$(QTDIR)\include\QtOpenVG
$(QTDIR)\include\QtScript
$(QTDIR)\include\QtScriptTools
$(QTDIR)\include\QtSql
$(QTDIR)\include\QtSvg
$(QTDIR)\include\QtTest
$(QTDIR)\include\QtUiTools
$(QTDIR)\include\QtWebKit
$(QTDIR)\include\QtXml
$(QTDIR)\include\QtXmlPatterns
$(QTDIR)\mkspecs\win32-msvc2008
$(QTDIR)\mkspecs\win32-msvc2010

  • When working with Qt (and qmake), running the rebuild command is often required. This primarily becomes an issue when changes are made to the .pro file or when Q_OBJECT is added or removed from files.
  • In order to not pollute the global namespace, the above .pro file examples use the no_keywords configuration option. This option disables Qt specific macros. Instead of using the standard Qt macros, use the Q_X equivalents (replacing X with the name of the macro, i.e. Q_SLOTS).
  • In order to use V-Tune with release builds of QT applications, the following needs to be added to the .pro file.

    QMAKE_CXXFLAGS += /Zi QMAKE_LFLAGS += /fixed:no QMAKE_LFLAGS += /DEBUG

4.  Qt Project Creation with Visual Studio

4.1  Using QtWizard

Because generating Qt makefile projects within Visual Studio can be tedious, especially when developing large numbers of smaller applications, a Visual Studio wizard has been produced that automates parts of the process. The installer for the wizard can be located at http://www.sanfordfreedman.com/utilities/. The QtWizard integrates into Visual Studio and lets the user generate a Qt makefile project in the same manner as a standard Win32 or other inherently supported project type.

4.2  Manual Project Creation

  1. Ensure the environment variable %QTDIR% points to your installation of QT.
  2. Open Visual Studio and select File -> New ->Project.
  3. Select General and then Makefile Project.
  4. After providing a name and location for the new Makefile project, click Ok.
  5. Configure nmake. Makefiles require that nmake be properly configured for the new project. This can be accomplished in two locations, within the Makefile Project Wizard or within the project properties dialog after the project has been fully created. (TODO: Complete Intellisense section)

    Configuring nmake with the Makefile Project Wizard.

    1. Select Debug Configuration Settings.
    2. Fill in the following fields:
      Build Command Line:

          %QTDIR%\bin\qmake
          nmake debug
      

      Rebuild All Command Line:

          %QTDIR%\bin\qmake
          nmake debug-clean
          nmake debug
      

      Clean Command Line:

          %QTDIR%\bin\qmake
          nmake debug-clean
      

      Output:

          debug\[ApplicationName].exe
      

    3. Select Release Configuration Settings.
    4. Uncheck the Same as debug configuration box.
    5. Fill in the follwing fields:
      Build Command Line:

          %QTDIR%\bin\qmake
          nmake release
      

      Rebuild All Command Line:

          %QTDIR%\bin\qmake
          nmake release-clean
          nmake release
      

      Clean Command Line:

          %QTDIR%\bin\qmake
          nmake release-clean
      

      Output:

          release\[ApplicationName].exe
      

    6. Click Finish to complete the creation of the new Makefile project.

    Configuring nmake with Properties Pages dialog

    1. With the project open, right click on the name of the project within the Solution Explorer toolbar (generally on the left side of the IDE).
    2. Select Properties in the popup menu.
    3. Select NMake to access the nmake configuration section.
    4. Under Configuration, select Debug to edit the Debug Configuration properties.
    5. Fill in the four properties listed under General.
      Build Command Line:

          %QTDIR%\bin\qmake
          nmake debug
      

      Rebuild All Command Line:

          %QTDIR%\bin\qmake
          nmake debug-clean
          nmake debug
      

      Clean Command Line:

          %QTDIR%\bin\qmake
          nmake debug-clean
      

      Output:

          debug\[ApplicationName].exe
      

    6. Under configuration, select Release to edit the Release Configuration properties. If asked to save settings, select Yes.
    7. Fill in the four properties listed under General.
      Build Command Line:

          %QTDIR%\bin\qmake
          nmake release
      

      Rebuild All Command Line:

          %QTDIR%\bin\qmake
          nmake release-clean
          nmake release
      

      Clean Command Line:

          %QTDIR%\bin\qmake
          nmake release-clean
      

      Output:

          release\[ApplicationName].exe
      

    8. Click Ok to finish configuring nmake.
    1. Create a file with an extension of .pro
    2. Depending on the desired type of project, copy the corresponding example into the .pro file (replacing ApplicationName with the application's name):
      GUI Application:

      TEMPLATE  += app
      CONFIG    += qt warn_on no_keywords embed_manifest_exe
      QT        +=
      TARGET     = ApplicationName
      SOURCES    = 
      HEADERS    =
      LIBS      +=
      
      
      # Treat warnings as errors
      win32:QMAKE_CXXFLAGS += /WX
      
      CONFIG(debug, debug|release){
      	# Debug build options
      	# Enable a read-only console window (i.e. for printf etc.)
      	# CONFIG   += console
      }
      else{
      	# Release build options
      	# Enable a read-only console window (i.e. for printf etc.)
      	# CONFIG   += console
      }
      

      Console Application:

      TEMPLATE  += app
      CONFIG	  += qt warn_on no_keywords console embed_manifest_exe
      QT        +=
      TARGET     = ApplicationName
      SOURCES	   =
      HEADERS	   =
      LIBS      +=
      
      
      # Treat warnings as errors
      win32:QMAKE_CXXFLAGS += /WX
      
      CONFIG(debug, debug|release){
      	# Debug build options
      }
      else{
      	# Release build options
      }
      

      DLL:

      TEMPLATE  += lib
      CONFIG	  += qt warn_on no_keywords dll embed_manifest_dll
      QT        +=
      TARGET     = ApplicationName
      SOURCES	   = 
      HEADERS	   =
      LIBS      +=
      
      
      # Treat warnings as errors
      win32:QMAKE_CXXFLAGS += /WX
      
      CONFIG(debug, debug|release){
      	# Debug build options
      }
      else{
      	# Release build options
      }
      

      Static Library:

      TEMPLATE  += lib
      CONFIG	  += qt warn_on no_keywords staticlib
      QT        +=
      TARGET     = ApplicationName
      SOURCES	   = 
      HEADERS	   =
      LIBS      +=
      
      
      # Treat warnings as errors
      win32:QMAKE_CXXFLAGS += /WX
      
      CONFIG(debug, debug|release){
      	# Debug build options
      }
      else{
      	# Release build options
      }
      

      Qt Plugin:

      TEMPLATE  += lib
      CONFIG	  += qt warn_on no_keywords plugin
      QT        +=
      TARGET     = ApplicationName
      SOURCES	   = 
      HEADERS	   =
      LIBS      +=
      
      
      # Treat warnings as errors
      win32:QMAKE_CXXFLAGS += /WX
      
      CONFIG(debug, debug|release){
      	# Debug build options
      }
      else{
      	# Release build options
      }
      

      If the Qt project will be linked against static libraries that will undergo development at the same time as the application, add the following to the .pro file:

        CONFIG(debug, debug|release){
      	# Debug build options
              LIBS += path/to/debug/library/library.lib
              POST_TARGETDEPS += $$LIBS
        }
        else{
      	# Release build options
              LIBS += path/to/release/library/library.lib
              POST_TARGETDEPS += $$LIBS
        }
      

    3. Create and fill in the application's source files. Each source and header file needs to be listed in the appropriate sections of the applications .pro file (HEADERS and SOURCES). Make sure to always updates this file when new header files and source files are added to the project. Additionally, this approach requires frequently rebuilding of the entire project to ensure that everything is up to date.

    5.  External References

    Official Qt 4.8 Documentation
    Official QT Website
    Qt Centre - A Qt Community Wiki and forum
    QtNode - A Qt Community Wiki