Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

Qt Motif Extension

This module is part of the Qt Enterprise Edition and is not part of the Free or Non-Commercial Editions.


The Qt Motif Extension assists the migration of old Xt and Motif based applications to the more comfortable Qt toolkit. This extension replaces the older Xt/Motif Support Extension included with earlier versions of Qt.

The Qt Motif Extension consists of the following classes:

Additional Documentation

Common Problems

Incorrect CDE Color Scheme

QMotifWidget and QMotifDialog will use the same Visual, Colormap and color depth that QApplication uses. When using CDE, the color scheme may be incorrect when using a Visual, Colormap and color depth that is not the default. To work around this problem, add the following resource string to your startup files (for example, $HOME/.dt/sessions/current/dt.resources):

    *userColorObj: false

X11 Header Conflicts

The X11 headers define some constants that conflict with the Qt headers. The solution is to include all Qt headers first, followed by headers from this extension, and all Xt/Motif and X11 headers last. For example:

    // Qt headers first
    #include <qapplication.h>
    #include <qpushbutton.h>
    #include <qsocket.h>

    // QMotif* headers next
    #include <qmotif.h>
    #include <qmotifdialog.h>
    #include <qmotifwidget.h>

    // Xt/Motif and X11 headers last
    #include <X11/Xlib.h>
    #include <Xt/Intrinsic.h>
    #include <Xm/Xm.h>

Multiple Screen Support

QMotifWidget can be used together with QDesktopWidget to create top-level windows on multiple screens. A common mistake is to create a QMotifWidget on a non-default screen while the Xt/Motif widgets are created on the default screen. The solution is to specify the screen to both QMotifWidget and the Xt/Motif child. For example:

    Display *dpy = QMotif::x11Display();
    Arg args[1];

    // make sure both QMotifWidget and the XmMainWindow are on screen 1
    XtSetArg(args[0], XtNscreen, ScreenOfDisplay(dpy, 1));
    QMotifWidget *toplevel =
        new QMotifWidget(QApplication::desktop()->screen(1),
                         xmMainWindowWidgetClass, args, 1, "mainwindow");

Copyright © 2007 TrolltechTrademarks
Qt 3.3.8