Home

QtXtWidget Class Reference

The QtXtWidget class allows mixing of Xt/Motif and Qt widgets. More...

 #include <QtXtWidget>

This class is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Inherits QWidget.

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QtXtWidget class allows mixing of Xt/Motif and Qt widgets.

QtXtWidget acts as a bridge between Xt and Qt. When utilizing old Xt widgets, it can be a QWidget based on a Xt widget class. When including Qt widgets in an existing Xt/Motif application, it can be a special Xt widget class that is a QWidget. See the constructors for the different behaviors.

Known Issues

This class is unsupported and has many known problems and limitations. It is provided only to keep existing source working; it should not be used in new code. These problems will not be fixed in future releases.

Below is an incomplete list of known issues:

  1. Keyboard focus navigation is impossible when using QtXtWidget. The mouse must be used to focus widgets in both Qt and Xt/Motif widgets. For example, when embedding a QtXtWidget into an Xt/Motif widget, key events will go to the QtXtWidget (and its children) while the mouse is over the QtXtWidget, regardless of where Xt/Motif has placed the focus.
  2. Reparenting does not work. You cannot use QWidget::reparent(). Since QWidget::showFullScreen() and QWidget::showNormal() rely on QWidget::reparent(), these functions will also not work as expected.

Member Function Documentation

QtXtWidget::QtXtWidget ( const char * name, Widget parent, bool managed = false )

Constructs a QtXtWidget with the given name and parent of the special Xt widget class known as "QWidget" to the resource manager.

Use this constructor to utilize Qt widgets in an Xt/Motif application. The QtXtWidget is a QWidget, so you can create subwidgets, layouts, and use other Qt features.

If the managed parameter is true and parent is not null, XtManageChild is used to manage the child; otherwise it is unmanaged.

QtXtWidget::QtXtWidget ( const char * name, WidgetClass widget_class, QWidget * parent = 0, ArgList args = 0, Cardinal num_args = 0, bool managed = false )

Constructs a QtXtWidget of the given widget_class called name.

Use this constructor to utilize Xt or Motif widgets in a Qt application. The QtXtWidget looks and behaves like an Xt widget, but can be used like any QWidget.

Note that Xt requires that the top level Xt widget is a shell. This means that if parent is a QtXtWidget, any kind of widget_class can be used. However, if there is no parent, or the parent is just a normal QWidget, widget_class should be something like topLevelShellWidgetClass.

The args and num_args arguments are passed on to XtCreateWidget.

If managed is true and parent is not null, XtManageChild is used to manage the child; otherwise it is unmanaged.

QtXtWidget::~QtXtWidget ()

Destroys the QtXtWidget.

void QtXtWidget::activateWindow ()

Activates the widget. Implements a degree of focus handling for Xt widgets.

bool QtXtWidget::isActiveWindow () const

Returns true if the widget is the active window; otherwise returns false.

bool QtXtWidget::x11Event ( XEvent * e )   [virtual protected]

Reimplemented to produce the Xt effect of getting focus when the mouse enters the widget. The event is passed in e.

Reimplemented from QWidget.

Widget QtXtWidget::xtWidget () const

Returns the underlying Xt widget.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions