Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QBluetoothRemoteDeviceDialogFilter Class Reference
[QtBluetoothModule]

The QBluetoothRemoteDeviceDialogFilter class provides a filter on the devices that are displayed by a QBluetoothRemoteDeviceDialog. More...

    #include <QBluetoothRemoteDeviceDialogFilter>

Public Functions


Detailed Description

The QBluetoothRemoteDeviceDialogFilter class provides a filter on the devices that are displayed by a QBluetoothRemoteDeviceDialog.

This clss allows the programmer to control whether particular devices should be displayed in a QBluetoothRemoteDeviceDialog.

For example, this will create a QBluetoothRemoteDeviceDialog that only displays computers and phones:

    QBluetoothRemoteDeviceDialogFilter filter;
    QSet<QBluetooth::DeviceMajor> majors;
    majors.insert(QBluetooth::Computer);
    majors.insert(QBluetooth::Phone);
    filter.setAcceptedDeviceMajors(majors);

    QBluetoothRemoteDeviceDialog dialog;
    dialog.setFilter(&filter);

By default the QBluetoothRemoteDeviceDialogFilter will accept all devices, including those with an invalid class of device information.

Note: The programmer should be careful when using device majors, device minors and service classes as a means of filtering devices, as some devices may not have the correct class of device information.

See also QBluetoothRemoteDeviceDialog.


Member Function Documentation

QBluetoothRemoteDeviceDialogFilter::QBluetoothRemoteDeviceDialogFilter ()

Constructs a QBluetoothRemoteDeviceDialogFilter that will accept all devices. The title is set to "Default".

QBluetoothRemoteDeviceDialogFilter::QBluetoothRemoteDeviceDialogFilter ( const QString & title )

Constructs a QBluetoothRemoteDeviceDialogFilter with title, that will accept all devices.

QBluetoothRemoteDeviceDialogFilter::~QBluetoothRemoteDeviceDialogFilter ()   [virtual]

Destroys the dialog filter.

QSet<QBluetooth::DeviceMajor> QBluetoothRemoteDeviceDialogFilter::acceptedDeviceMajors () const

Returns the device majors that are accepted by this filter. By default, this value is an empty set (i.e. the filter will accept devices with any device major).

See also setAcceptedDeviceMajors().

QBluetooth::ServiceClasses QBluetoothRemoteDeviceDialogFilter::acceptedServiceClasses () const

Returns the device majors that are accepted by this filter. By default, this value is QBluetooth::AllServiceClasses (i.e. the filter will accept devices with any service class).

See also setAcceptedServiceClasses().

bool QBluetoothRemoteDeviceDialogFilter::filterAcceptsDevice ( const QBluetoothRemoteDevice & device )   [virtual]

Returns whether this filter allows the device device to be displayed in the associated device selector.

If the accepted service class is QBluetooth::AllServiceClasses, the default implementation will also accept devices that have invalid service class values.

void QBluetoothRemoteDeviceDialogFilter::setAcceptedDeviceMajors ( const QSet<QBluetooth::DeviceMajor> & deviceMajors )

Sets the filter to accept devices that match at least one of the device majors contained in deviceMajors. If a device does not match at least one of the specified device majors, it will not be displayed in the associated device selector.

For example, to create a filter that only accepts computers and phones:

    QBluetoothRemoteDeviceDialogFilter filter;
    QSet<QBluetooth::DeviceMajor> majors;
    majors.insert(QBluetooth::Computer);
    majors.insert(QBluetooth::Phone);
    filter.setAcceptedDeviceMajors(majors);

If the filter should accept devices regardless of their device majors, pass an empty set to this method. (This is the default value.)

See also acceptedDeviceMajors().

void QBluetoothRemoteDeviceDialogFilter::setAcceptedServiceClasses ( QBluetooth::ServiceClasses serviceClasses )

Sets the filter to accept devices that match the given serviceClasses.

For example, to create a filter that only accepts devices with the ObjectTransfer and Telephony service classes:

    QBluetoothRemoteDeviceDialogFilter filter;
    filter.setAcceptedServiceClasses(QBluetooth::ObjectTransfer | QBluetooth::Telephony);

If the filter should accept devices regardless of their service classes, pass QBluetooth::AllServiceClasses to this method. (This is the default value.)

See also acceptedServiceClasses().

QString QBluetoothRemoteDeviceDialogFilter::title () const

Returns the title for this filter.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3