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

# Qt Motif Extension

## Introduction

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:

- QMotif - Provides the basis of the Qt Motif Extension.
- QMotifWidget - Provides the QWidget API for Motif widgets.
- QMotifDialog - Provides the QDialog API for Motif dialogs.
- QXtWidget - The Xt/Motif integration widget from the previous Xt/Motif extension. This class is unsupported, and only provided for projects moving to the new Motif extension.

### Additional Documentation

- Examples
- Migration Walkthrough - A complete migration of a Motif based program to the Qt toolkit.

## Common Problems

- 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

- 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>
          ...

## Known Problems and Limitations

- In some situations, clipboard transfers between Motif and Qt widgets will fail, and neither Motif nor Qt seem to recover. This will occur when Motif and Qt are using the same X11 display connection. This typically happens in 2 situations: 1) QApplication was created with a foreign display, or 2) QMotifWidget is used in the widget heirarchy.

  The only way to work around this problem is to ensure that Motif and Qt use a different X11 connection. However, this solution will not work when using QMotifWidget in the widget heirarchy (since QMotifWidget uses the same X11 display connection that Qt does).

  This problem will be fixed in a future release.