Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QX11EmbedWidget Class Reference

The QX11EmbedWidget class provides an XEmbed client widget. More...

 #include <QX11EmbedWidget>

Inherits: QWidget.

Public Types

enum Error { Unknown, InvalidWindowID }

Public Functions

QX11EmbedWidget ( QWidget * parent = 0 )
~QX11EmbedWidget ()
WId containerWinId () const
void embedInto ( WId id )
Error error () const
  • 217 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 13 public functions inherited from QPaintDevice

Signals

void containerClosed ()
void embedded ()
void error ( QX11EmbedWidget::Error error )

Reimplemented Protected Functions

virtual bool event ( QEvent * event )
virtual void resizeEvent ( QResizeEvent * event )
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice

Additional Inherited Members

  • 58 properties inherited from QWidget
  • 1 property inherited from QObject
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject
  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice
  • 1 protected slot inherited from QWidget

Detailed Description

The QX11EmbedWidget class provides an XEmbed client widget.

XEmbed is an X11 protocol that supports the embedding of a widget from one application into another application.

An XEmbed client widget is a window that is embedded into a container. A container is the graphical location that embeds (or swallows) an external application.

QX11EmbedWidget is a widget used for writing XEmbed applets or plugins. When it has been embedded and the container receives tab focus, focus is passed on to the widget. When the widget reaches the end of its focus chain, focus is passed back to the container. Window activation, accelerator support, modality and drag and drop (XDND) are also handled.

The widget and container can both initiate the embedding. If the widget is the initiator, the X11 window ID of the container that it wants to embed itself into must be passed to embedInto().

If the container initiates the embedding, the window ID of the embedded widget must be known. The container calls embed(), passing the window ID.

This example shows an application that embeds a QX11EmbedWidget subclass into the window whose ID is passed as a command-line argument:

 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);

     if (app.arguments().count() != 2) {
         qFatal("Error - expected window id as argument");
         return 1;
     }

     QString windowId(app.arguments()[1]);
     EmbedWidget window;
     window.embedInto(windowId.toULong());
     window.show();

     return app.exec();
 }

The problem of obtaining the window IDs is often solved by the container invoking the application that provides the widget as a separate process (as a panel invokes a docked applet), passing its window ID to the new process as a command-line argument. The new process can then call embedInto() with the container's window ID, as shown in the example code above. Similarly, the new process can report its window ID to the container through IPC, in which case the container can embed the widget.

When the widget has been embedded, it emits the signal embedded(). If it is closed by the container, the widget emits containerClosed(). If an error occurs when embedding, error() is emitted.

There are XEmbed widgets available for KDE and GTK+. The GTK+ equivalent of QX11EmbedWidget is GtkPlug. The corresponding KDE 3 widget is called QXEmbed.

See also QX11EmbedContainer and XEmbed Specification.

Member Type Documentation

enum QX11EmbedWidget::Error

ConstantValueDescription
QX11EmbedWidget::Unknown0An unrecognized error occurred.
QX11EmbedWidget::InvalidWindowID2The X11 window ID of the container was invalid. This error is usually triggered by passing an invalid window ID to embedInto().

Member Function Documentation

QX11EmbedWidget::QX11EmbedWidget ( QWidget * parent = 0 )

Constructs a QX11EmbedWidget object with the given parent.

QX11EmbedWidget::~QX11EmbedWidget ()

Destructs the QX11EmbedWidget object. If the widget is embedded when deleted, it is hidden and then detached from its container, so that the container is free to embed a new widget.

void QX11EmbedWidget::containerClosed () [signal]

This signal is emitted by the client widget when the container closes the widget. This can happen if the container itself closes, or if the widget is rejected.

The container can reject a widget for any reason, but the most common cause of a rejection is when an attempt is made to embed a widget into a container that already has an embedded widget.

WId QX11EmbedWidget::containerWinId () const

If the widget is embedded, returns the window ID of the container; otherwize returns 0.

void QX11EmbedWidget::embedInto ( WId id )

When this function is called, the widget embeds itself into the container whose window ID is id.

If id is not the window ID of a container this function will behave unpredictably.

void QX11EmbedWidget::embedded () [signal]

This signal is emitted by the widget that has been embedded by an XEmbed container.

Error QX11EmbedWidget::error () const

Returns the type of error that occurred last. This is the same error code that is emitted by the error() signal.

See also Error.

void QX11EmbedWidget::error ( QX11EmbedWidget::Error error ) [signal]

This signal is emitted if an error occurred as a result of embedding into or communicating with a container. The specified error describes the problem that occurred.

See also QX11EmbedWidget::Error.

bool QX11EmbedWidget::event ( QEvent * event ) [virtual protected]

Reimplemented from QObject::event().

void QX11EmbedWidget::resizeEvent ( QResizeEvent * event ) [virtual protected]

Reimplemented from QWidget::resizeEvent().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
Page suivante

Le Qt Labs au hasard

Logo

La folie est de mettre en forme le même texte

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.7
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web