Qt API | Qtopia API | Qtopia Documentation |

# CategorySelect Class Reference

The CategorySelect widget allows users to select Categories with a combobox interface. More...

`#include <qtopia/categoryselect.h>`

Inherits QHBox.

List of all member functions.

## Public Members

- CategorySelect ( QWidget * parent = 0, const char * name = 0, int width = 0 )
- CategorySelect ( const QArray<int> & vl, const QString & appName, QWidget * parent = 0, const char * name = 0, int width = 0 )
- CategorySelect ( const QArray<int> & vl, const QString & appName, const QString & visibleName, QWidget * parent = 0, const char * name = 0, int width = 0 )
- CategorySelect ( const QArray<int> & vlCats, const QString & appName, const QString & visibleName, bool add, QWidget * parent = 0, const char * name = 0, int width = 0 )
- ~CategorySelect ()
- enum SelectorWidget { ComboBox, ListView }
- SelectorWidget widgetType () const
- bool containsCategory ( const QArray<int> & cats )
- void setRemoveCategoryEdit ( bool remove )
- void setAllCategories ( bool all )
- void setCurrentCategory ( int newCatUid )
- int currentCategory () const
- const QArray<int> & currentCategories () const
- QString setCategories ( const QArray<int> & rec, const QString & appName )
- QString setCategories ( const QArray<int> & rec, const QString & appName, const QString & visibleName )
- void setFixedWidth ( int width )

## Public Slots

- void slotNewCat ( int newUid )

## Signals

- void signalSelected ( int )
- void editCategoriesClicked ()

## Detailed Description

The CategorySelect widget allows users to select Categories with a combobox interface.

CategorySelect is useful to provide a QComboBox of Categories for filtering (such as in the Contacts table view) or to allow the user to select multiple Categories. The allCategories variable sets whether the CategorySelect is in filtering or selecting mode.

In filtering mode, the All and Unfiled categories are added. The

In selecting mode, the CategorySelect may either be a QComboBox and a QToolButton or a QListView with checkable items depending on the screen size.

CategorySelect automatically updates itself if Categories has been changed elsewhere in the environment.

Signals and slots are provided to notify the application of the users selections. A QToolButton is also provided so that users can edit the Categories manually.

See also Qtopia Classes.

## Member Type Documentation

### CategorySelect::SelectorWidget

Chooses a type of widget to use as the selection widget.

- `CategorySelect::ComboBox`
- `CategorySelect::ListView`

## Member Function Documentation

### CategorySelect::CategorySelect ( QWidget * parent = 0, const char * name = 0, int width = 0 )

Constructs a category selector with parent parent, name name and fixed width width.

This constructor is provided to make integration with Qt Designer easier.

### CategorySelect::CategorySelect ( const QArray<int> & vl, const QString & appName, QWidget * parent = 0, const char * name = 0, int width = 0 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This constructor accepts an array vl of integers representing Categories. appName is used as the visible name string.

### CategorySelect::CategorySelect ( const QArray<int> & vl, const QString & appName, const QString & visibleName, QWidget * parent = 0, const char * name = 0, int width = 0 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This constructor accepts an array vl of integers representing Categories. visibleName is the string used when the name of this widget is required to be displayed. width is an integer used as the fixed width of the widget.

### CategorySelect::CategorySelect ( const QArray<int> & vlCats, const QString & appName, const QString & visibleName, bool add, QWidget * parent = 0, const char * name = 0, int width = 0 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This constructor accepts an array vlCats of integers representing Categories. appName is the application Categories name to filter on. visibleName is the string used when the name of this widget is required to be displayed. allCategories sets whether the selector offers "All" and "Unfiled" as options. If set to FALSE, then the CategorySelect allows the user to select multiple categories. If set to TRUE, the CategorySelect allows for only a single category selection. width is an integer used as the fixed width of the widget.

### CategorySelect::~CategorySelect ()

Destructs a CategorySelect widget.

### bool CategorySelect::containsCategory ( const QArray<int> & cats )

Returns TRUE if the current category contains any categories in cats.

### const QArray<int> & CategorySelect::currentCategories () const

Returns a shallow copy of the categories in this CategorySelect.

### int CategorySelect::currentCategory () const

Return the value of the currently selected category.

### void CategorySelect::setAllCategories ( bool all )

Changes this CategorySelect to the All category if all is TRUE.

### QString CategorySelect::setCategories ( const QArray<int> & rec, const QString & appName, const QString & visibleName )

Resets the CategorySelect to select the vlCats for the Categories assoicated with appName and displays the visibleName if the user is selecting and therefore editing new Categories.

### QString CategorySelect::setCategories ( const QArray<int> & rec, const QString & appName )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Resets the CategorySelect to select the vlCats for the Categories assoicated with appName.

This function should only be called if filtering on Categories and not selecting and therefore possibly allowing the user to edit Categories.

### void CategorySelect::setFixedWidth ( int width )

Sets the fixed width of the widget to width.

### void CategorySelect::setRemoveCategoryEdit ( bool remove )

Hides the edit section of the CategorySelect widget if remove is TRUE.

### void CategorySelect::slotNewCat ( int newUid )`[slot]`

This slot is called when a new Category is available.

### SelectorWidget CategorySelect::widgetType () const

Returns the type of widget as a CategorySelect::SelectorWidget.

This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.