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

QScreenInformationProvider Class Reference
[QtBaseModule]

The QScreenInformationProvider class provides the back end implementation of QScreenInformation. More...

    #include <QScreenInformationProvider>

Inherits QObject.

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QScreenInformationProvider class provides the back end implementation of QScreenInformation.

The following class represents a screen of type Television which by default is a clone of the primary LCD screen:

    class TvScreen : public QScreenInformationProvider
    {
        Q_OBJECT
    public:
        TvScreen(int screenNumber, QObject *parent=0);

    public slots:
        void videoCableInserted();
        void videoCableRemoved();

    protected:
        void changeClonedScreen(int value);
        void revertClonedScreen();
    };

    TvScreen::TvScreen(int screenNumber, QObject *parent)
        : QScreenInformationProvider(screenNumber, parent)
    {
        setType(QScreenInformation::Television);
        setVisible(false);
        setClonedScreen(QApplication::desktop()->primaryScreen());
    }

    void TvScreen::videoCableInserted()
    {
        setVisible(true);
    }

    void TvScreen::videoCableRemoved()
    {
        setVisible(false);
    }

    void TvScreen::changeClonedScreen(int value)
    {
        // Tell the hardware to change the clone mode.
        ...

        // Update the clone state as seen by client applications.
        setClonedScreen(value);
    }

    void TvScreen::revertClonedScreen()
    {
        // Change back to cloning the primary screen.
        changeClonedScreen(QApplication::desktop()->primaryScreen());
    }

See also QScreenInformation.


Member Function Documentation

QScreenInformationProvider::QScreenInformationProvider ( int screenNumber = -1, QObject * parent = 0 )

Constructs a screen information provider object for screenNumber and attaches it to parent. If screenNumber is -1, then the primary screen number is used.

Object construction should be followed by calls to setVisible(), setType(), and setClonedScreen() to populate the screen's initial properties.

See also setVisible(), setType(), and setClonedScreen().

QScreenInformationProvider::~QScreenInformationProvider ()

Destroys this screen information provider object.

void QScreenInformationProvider::changeClonedScreen ( int value )   [virtual protected]

Changes the cloned screen number to value. The default implementation does nothing. Sub-classes should change the screen and then call setClonedScreen() to update the cloned screen number for clients.

See also setClonedScreen() and revertClonedScreen().

void QScreenInformationProvider::changeLayer ( int value )   [virtual protected]

Changes the overlay layer number for this screen to value. The default implementation does nothing. Sub-classes should change the screen and then call setLayer() to update the value for clients.

Changing the layer on an overlay screen also makes it visible, so sub-classes should also call setVisible() to update that value for clients. The layer will be made invisible again when revertLayer() is called.

See also revertLayer().

void QScreenInformationProvider::revertClonedScreen ()   [virtual protected]

Reverts the cloned screen number to its default value. The default implementation does nothing. Sub-classes should revert the screen and then call setClonedScreen() to update the cloned screen number for clients.

See also setClonedScreen() and changeClonedScreen().

void QScreenInformationProvider::revertLayer ()   [virtual protected]

Reverts the overlay layer number for this screen to its default value and makes the layer invisible because the application that requested a layer change is no longer running. The default implementation does nothing. Sub-classes should revert the screen and then call setLayer() to update the value for clients.

See also changeLayer().

void QScreenInformationProvider::setClonedScreen ( int value )

Sets the state of QScreenInformation::clonedScreen() for this screen to value and cause QScreenInformation::changed() to be emitted.

The default value, as seen by QScreenInformation::clonedScreen(), will be -1.

See also QScreenInformation::clonedScreen() and QScreenInformation::changed().

void QScreenInformationProvider::setLayer ( int value )

Sets the state of QScreenInformation::layer() for this screen to value and cause QScreenInformation::changed() to be emitted.

The default value, as seen by QScreenInformation::layer(), will be 0.

See also QScreenInformation::layer() and QScreenInformation::changed().

void QScreenInformationProvider::setSupportedLayers ( const QList<int> & value )

Sets the state of QScreenInformation::supportedLayers() for this screen to value and cause QScreenInformation::changed() to be emitted.

The default value, as seen by QScreenInformation::supportedLayers(), will be an empty list.

See also QScreenInformation::supportedLayers() and QScreenInformation::changed().

void QScreenInformationProvider::setTransparencyColor ( const QColor & value )

Sets the state of QScreenInformation::transparencyColor() for this screen to value and cause QScreenInformation::changed() to be emitted.

The default value, as seen by QScreenInformation::transparencyColor(), will be a null QColor value.

See also QScreenInformation::transparencyColor() and QScreenInformation::changed().

void QScreenInformationProvider::setType ( QScreenInformation::Type value )

Sets the state of QScreenInformation::type() for this screen to value and cause QScreenInformation::changed() to be emitted.

The default value, as seen by QScreenInformation::type(), will be QScreenInformation::Normal.

See also QScreenInformation::type() and QScreenInformation::changed().

void QScreenInformationProvider::setVisible ( bool value )

Sets the state of QScreenInformation::isVisible() for this screen to value and cause QScreenInformation::changed() to be emitted.

The default value, as seen by QScreenInformation::isVisible(), will be true.

See also QScreenInformation::isVisible() and QScreenInformation::changed().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3