SUMMARY:
java.lang.Object
com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QGraphicsWidget
- All Implemented Interfaces:
- QGraphicsItemInterface, QGraphicsLayoutItemInterface, QtJambiInterface
- Direct Known Subclasses:
- QGraphicsProxyWidget
public class QGraphicsWidget - extends QObject
- implements QGraphicsItemInterface, QGraphicsLayoutItemInterface
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene . QGraphicsWidget is an extended base item that provides extra functionality over QGraphicsItem . It is similar to QWidget in many ways: Unlike QGraphicsItem , QGraphicsWidget is not an abstract class; you can create instances of a QGraphicsWidget without having to subclass it. This approach is useful for widgets that only serve the purpose of organizing child widgets into a layout. QGraphicsWidget can be used as a base item for your own custom item if you require advanced input focus handling, e.g., tab focus and activation, or layouts. Since QGraphicsWidget resembles QWidget and has similar API, it is easier to port a widget from QWidget to QGraphicsWidget, instead of QGraphicsItem . Note:QWidget -based widgets can be directly embedded into a QGraphicsScene using QGraphicsProxyWidget . Noticeable differences between QGraphicsWidget and QWidget are: QGraphicsWidget | QWidget |
---|
Coordinates and geometry are defined with qreals (doubles or floats, depending on the platform). | QWidget uses integer geometry (QPoint , QRect ). | The widget is already visible by default; you do not have to call show() to display the widget. | QWidget is hidden by default until you call show() . | A subset of widget attributes are supported. | All widget attributes are supported. | A top-level item's style defaults to QGraphicsScene::style | A top-level widget's style defaults to QApplication::style | Graphics View provides a custom drag and drop framework, different from QWidget . | Standard drag and drop framework. | Widget items do not support modality. | Full modality support. | QGraphicsWidget supports a subset of Qt's widget attributes, (Qt::WidgetAttribute ), as shown in the table below. Any attributes not listed in this table are unsupported, or otherwise unused. Although QGraphicsWidget inherits from both QObject and QGraphicsItem , you should use the functions provided by QGraphicsItem , notQObject , to manage the relationships between parent and child items. These functions control the stacking order of items as well as their ownership. Note: The QObject::parent() should always return 0 for QGraphicsWidgets, but this policy is not strictly defined. See also:
QGraphicsProxyWidget , QGraphicsItem , and Widgets and Layouts.
QGraphicsWidget
public QGraphicsWidget(QGraphicsItemInterface parent,
Qt.WindowType[] wFlags)
QGraphicsWidget
public QGraphicsWidget(QGraphicsItemInterface parent)
- Constructs a QGraphicsWidget instance. The optional parent argument is passed to
QGraphicsItem 's constructor. The optional wFlags argument specifies the widget's window flags (e.g., whether the widget should be a window, a tool, a popup, etc).
QGraphicsWidget
public QGraphicsWidget()
- Constructs a QGraphicsWidget instance. The optional parent argument is passed to
QGraphicsItem 's constructor. The optional wFlags argument specifies the widget's window flags (e.g., whether the widget should be a window, a tool, a popup, etc).
QGraphicsWidget
public QGraphicsWidget(QGraphicsItemInterface parent,
Qt.WindowFlags wFlags)
- Constructs a QGraphicsWidget instance. The optional parent argument is passed to
QGraphicsItem 's constructor. The optional wFlags argument specifies the widget's window flags (e.g., whether the widget should be a window, a tool, a popup, etc).
|