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  · 

QCategorySelector Class Reference
[QtBaseModule]

The QCategorySelector widget allows users to select categories for filtering or for applying to an item. More...

    #include <QCategorySelector>

Inherits QWidget.

Public Types

Public Functions

  • 206 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 14 public functions inherited from QPaintDevice

Public Slots

  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Signals

Additional Inherited Members

  • 57 properties inherited from QWidget
  • 1 property inherited from QObject
  • 1 public type inherited from QObject
  • 4 static public members inherited from QWidget
  • 4 static public members inherited from QObject
  • 38 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice
  • 1 protected slot inherited from QWidget
  • 2 protected variables inherited from QObject
  • 1 protected type inherited from QPaintDevice

Detailed Description

The QCategorySelector widget allows users to select categories for filtering or for applying to an item.

QCategorySelector is a widget that shows categories the user can choose from. Its appearance and behavior are determined by flags given to the constructor. Control over the categories that are visible is achieved via the select...() functions.

QCategorySelector automatically updates when the system's categories are changed. It provides an interface for the user to add/edit/delete user categories.

QCategorySelector is typically used as a QCategorySelector::Filter or QCategorySelector::Editor;

Here's an example of using it as a filter.

    MyWidget::MyWidget()
    {
        QCategorySelector *sel = new QCategorySelector( "myappscope", QCategorySelector::Filter );
        connect( sel, SIGNAL(filterSelected(QCategoryFilter)),
                 this, SLOT(filterCategories(QCategoryFilter)) );
        QSettings settings("mycompany", "myapp");
        QCategoryFilter f;
        f.readConfig( settings, "filter" );
        sel->selectFilter( f );
    }

    void MyWidget::filterCategories( const QCategoryFilter &filter )
    {
        QSettings settings("mycompany", "myapp");
        filter.writeConfig( settings, "filter" );
        foreach ( item, itemList )
            item->setVisible( filter.accepted( item->categories() ) );
    }

Here's an example of using QCategorySelector an editor.

    MyWidget::MyWidget( MyRecord *item )
    {
        QCategorySelector *sel = new QCategorySelector( "myappscope", QCategorySelector::Editor );
        sel->selectCategories( item->categories() );
        connect( sel, SIGNAL(categoriesSelected(QList<QString>)),
                 item, SLOT(setCategories(QList<QString>)) );
    }

See also Categories.


Member Type Documentation

enum QCategorySelector::ContentFlag
flags QCategorySelector::ContentFlags

ConstantValueDescription
QCategorySelector::IncludeAll0x04Include the All categories option.
QCategorySelector::IncludeUnfiled0x08Include the Unfiled categories option.
QCategorySelector::SingleSelection0x80Allow selection of a single category. The default is to allow combinations of categories.
QCategorySelector::ListView0x10Display as a list view.
QCategorySelector::ComboView0x20Display as a combo box. Note that this will encourage exclusive selection of categories.
QCategorySelector::DialogView0x40Display as a button that opens a dialog containing a list view.
QCategorySelector::FilterIncludeAll | IncludeUnfiledAlias for IncludeAll|IncludeUnfiled.
QCategorySelector::EditorIncludeUnfiledAlias for IncludeUnfiled.
QCategorySelector::ViewMaskListView | ComboView | DialogViewMasks the view selection flags.

The list view looks like this.

[Missing image qcategoryselector-list.png]

The combo box looks like this.

[Missing image qcategoryselector-combo-down.png]

[Missing image qcategoryselector-combo-up.png]

The button looks like this.

[Missing image qcategoryselector-button.png]

The ContentFlags type is a typedef for QFlags<ContentFlag>. It stores an OR combination of ContentFlag values.


Member Function Documentation

QCategorySelector::QCategorySelector ( QWidget * parent = 0 )

Constructs a QCategorySelector as an editor widget with the given parent.

QCategorySelector::QCategorySelector ( const QString & scope, ContentFlags f = Editor, QWidget * parent = 0 )

Constructs a QCategorySelector with the given parent. Unless it is null, scope limits the categories that can be seen. The flags in f determine the apperance and behavior of the QCategorySelector.

QCategorySelector::~QCategorySelector ()   [virtual]

Destroys a QCategorySelector.

void QCategorySelector::categoriesSelected ( const QList<QString> & list )   [signal]

This signal is emitted when the selected categories changes. The selected categories are indicated by list.

Note that this function does not indicate if All or Unfiled is selected. Use filterSelected() to determine if these items are selected.

void QCategorySelector::filterSelected ( const QCategoryFilter & filter )   [signal]

This signal is emitted when the selected categories changes. The selected categories are indicated by filter.

See also QCategoryFilter::requiredCategories().

void QCategorySelector::selectAll ()   [slot]

Selects the All entry (all categories are selected).

void QCategorySelector::selectCategories ( const QString & categoryids )   [slot]

Selects the categories with identifiers in the comma-separated list categoryids.

void QCategorySelector::selectCategories ( const QStringList & categoryids )   [slot]

This is an overloaded member function, provided for convenience.

Selects the categories with identifiers in list categoryids.

void QCategorySelector::selectFilter ( const QCategoryFilter & filter )   [slot]

Selects the categories specified by filter.

void QCategorySelector::selectUnfiled ()   [slot]

Selects the Unfiled entry (no categories are selected).

QStringList QCategorySelector::selectedCategories () const

Returns the list of selected categories.

Note that this function does not indicate if All or Unfiled is selected. Use selectedFilter() to determine if these items are selected.

QCategoryFilter QCategorySelector::selectedFilter () const

Returns the QCategoryFilter that indicates the selected categories.

See also QCategoryFilter::requiredCategories().

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 68
  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. 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. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
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 qtextended4.4
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