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  · 

QDesignerWidgetBoxInterface Class Reference
[QtDesigner module]

The QDesignerWidgetBoxInterface class allows you to control the contents of Qt Designer's widget box. More...

 #include <QDesignerWidgetBoxInterface>

This class is not part of the Qt GUI Framework Edition.

Inherits QWidget.


Public Functions

QDesignerWidgetBoxInterface ( QWidget * parent = 0, Qt::WindowFlags flags = 0 )
virtual ~QDesignerWidgetBoxInterface ()
virtual QString fileName () const = 0
virtual bool load () = 0
virtual bool save () = 0
virtual void setFileName ( const QString & fileName ) = 0
  • 217 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 13 public functions 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
  • 1 signal inherited from QWidget
  • 1 signal 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 QDesignerWidgetBoxInterface class allows you to control the contents of Qt Designer's widget box.

QDesignerWidgetBoxInterface contains a collection of functions that is typically used to manipulate the contents of Qt Designer's widget box.

Qt Designer uses an XML file to populate its widget box. The name of that file is one of the widget box's properties, and you can retrieve it using the fileName() function.

QDesignerWidgetBoxInterface also provides the save() function that saves the contents of the widget box in the file specified by the widget box's file name property. If you have made changes to the widget box, for example by dropping a widget into the widget box, without calling the save() function, the original content can be restored by a simple invocation of the load() function:

         QDesignerWidgetBoxInterface *widgetBox = 0:
         widgetBox = formEditor->widgetBox();

         widgetBox->load();

The QDesignerWidgetBoxInterface class is not intended to be instantiated directly. You can retrieve an interface to Qt Designer's widget box using the QDesignerFormEditorInterface::widgetBox() function. A pointer to Qt Designer's current QDesignerFormEditorInterface object (formEditor in the example above) is provided by the QDesignerCustomWidgetInterface::initialize() function's parameter. When implementing a custom widget plugin, you must subclass the QDesignerCustomWidgetInterface to expose your plugin to Qt Designer.

If you want to save your changes, and at the same time preserve the original contents, you can use the save() function combined with the setFileName() function to save your changes into another file. Remember to store the name of the original file first:

         QString originalFile = widgetBox->fileName();

         widgetBox->setFileName("myWidgetBox.xml");
         widgetBox->save();

Then you can restore the original contents of the widget box by resetting the file name to the original file and calling load():

         widgetBox->setFileName(originalFile);
         widgetBox->load();

In a similar way, you can later use your customized XML file:

         if (widgetBox->filename() != "myWidgetBox.xml") {
             widgetBox->setFileName("myWidgetBox.xml");
             widgetBox->load();
         }

See also QDesignerFormEditorInterface.


Member Function Documentation

QDesignerWidgetBoxInterface::QDesignerWidgetBoxInterface ( QWidget * parent = 0, Qt::WindowFlags flags = 0 )

Constructs a widget box interface with the given parent and the specified window flags.

QDesignerWidgetBoxInterface::~QDesignerWidgetBoxInterface ()   [virtual]

Destroys the widget box interface.

QString QDesignerWidgetBoxInterface::fileName () const   [pure virtual]

Returns the name of the XML file Qt Designer is currently using to populate its widget box.

See also setFileName().

bool QDesignerWidgetBoxInterface::load ()   [pure virtual]

Populates Qt Designer's widget box by loading (or reloading) the currently specified XML file. Returns true if the file is successfully loaded; otherwise false.

See also setFileName().

bool QDesignerWidgetBoxInterface::save ()   [pure virtual]

Saves the contents of Qt Designer's widget box in the file specified by the fileName() function. Returns true if the content is successfully saved; otherwise false.

See also fileName() and setFileName().

void QDesignerWidgetBoxInterface::setFileName ( const QString & fileName )   [pure virtual]

Sets the XML file that Qt Designer will use to populate its widget box, to fileName. You must call load() to update the widget box with the new XML file.

See also fileName() and load().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 9
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le blog Digia au hasard

Logo

Créer des applications avec un style Metro avec Qt, exemples en QML et C++, un article de Digia Qt traduit par Thibaut Cuvelier

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. 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.6
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