Notice: Undefined offset: 1 in /home/developpez/www/developpez-com/upload/qt/doc/redir.php on line 39 Qt 4.7: QX11EmbedContainer Class Reference
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  · 

QX11EmbedContainer Class Reference

The QX11EmbedContainer class provides an XEmbed container widget. More...

 #include <QX11EmbedContainer>

Inherits: QWidget.

Public Types

enum Error { Unknown, InvalidWindowID }

Public Functions

QX11EmbedContainer ( QWidget * parent = 0 )
~QX11EmbedContainer ()
WId clientWinId () const
void discardClient ()
void embedClient ( 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 clientClosed ()
void clientIsEmbedded ()
void error ( QX11EmbedContainer::Error error )

Reimplemented Protected Functions

virtual bool event ( QEvent * event )
virtual void paintEvent ( QPaintEvent * e )
  • 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 QX11EmbedContainer class provides an XEmbed container widget.

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

An XEmbed container is the graphical location that embeds an external client widget. A client widget is a window that is embedded into a container.

When a widget 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.

QX11EmbedContainer is commonly used for writing panels or toolbars that hold applets, or for swallowing X11 applications. When writing a panel application, one container widget is created on the toolbar, and it can then either swallow another widget using embed(), or allow an XEmbed widget to be embedded into itself. The container's X11 window ID, which is retrieved with winId(), must then be known to the client widget. After embedding, the client's window ID can be retrieved with clientWinId().

In the following example, a container widget is created as the main widget. It then invokes an application called "playmovie", passing its window ID as a command line argument. The "playmovie" program is an XEmbed client widget. The widget embeds itself into the container using the container's window ID.

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

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

     QX11EmbedContainer container;
     container.show();

     QProcess process(&container);
     QString executable(app.arguments()[1]);
     QStringList arguments;
     arguments << QString::number(container.winId());
     process.start(executable, arguments);

     int status = app.exec();
     process.close();
     return status;
 }

When the client widget is embedded, the container emits the signal clientIsEmbedded(). The signal clientClosed() is emitted when a widget is closed.

It is possible for QX11EmbedContainer to embed XEmbed widgets from toolkits other than Qt, such as GTK+. Arbitrary (non-XEmbed) X11 widgets can also be embedded, but the XEmbed-specific features such as window activation and focus handling are then lost.

The GTK+ equivalent of QX11EmbedContainer is GtkSocket. The corresponding KDE 3 widget is called QXEmbed.

See also QX11EmbedWidget and XEmbed Specification.

Member Type Documentation

enum QX11EmbedContainer::Error

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

Member Function Documentation

QX11EmbedContainer::QX11EmbedContainer ( QWidget * parent = 0 )

Creates a QX11EmbedContainer object with the given parent.

QX11EmbedContainer::~QX11EmbedContainer ()

Destructs a QX11EmbedContainer.

void QX11EmbedContainer::clientClosed () [signal]

This signal is emitted by the container when the client widget closes.

void QX11EmbedContainer::clientIsEmbedded () [signal]

This signal is emitted by the container when a client widget has been embedded.

WId QX11EmbedContainer::clientWinId () const

If the container has an embedded widget, this function returns the X11 window ID of the client; otherwise it returns 0.

void QX11EmbedContainer::discardClient ()

Detaches the client from the embedder. The client will appear as a standalone window on the desktop.

void QX11EmbedContainer::embedClient ( WId id )

Instructs the container to embed the X11 window with window ID id. The client widget will then move on top of the container window and be resized to fit into the container.

The id should be the ID of a window controlled by an XEmbed enabled application, but this is not mandatory. If id does not belong to an XEmbed client widget, then focus handling, activation, accelerators and other features will not work properly.

Error QX11EmbedContainer::error () const

Returns the last error that occurred.

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

This signal is emitted if an error occurred when embedding or communicating with a client. The specified error describes the problem that occurred.

See also QX11EmbedContainer::Error.

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

Reimplemented from QObject::event().

void QX11EmbedContainer::paintEvent ( QPaintEvent * e ) [virtual protected]

Reimplemented from QWidget::paintEvent().

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. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 12
  5. 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
  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 Developer Network au hasard

Logo

Compiler l'add-in Qt de Visual Studio

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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