Home · All Classes · Main Classes · Deprecated
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties

MWindow Class Reference

MWindow is the base class for all MeeGo Touch UI windows. More...

Inherits QGraphicsView.

Inherited by MApplicationWindow.

List of all members.

Public Slots

void setOrientationAngle (M::OrientationAngle angle)
void setLandscapeOrientation ()
void setPortraitOrientation ()
void lockOrientationAngle ()
void unlockOrientationAngle ()
void lockOrientation ()
void unlockOrientation ()
void enableNotificationPreviews ()
void disableNotificationPreviews ()

Signals

void orientationAngleChanged (M::OrientationAngle)
void orientationChanged (M::Orientation)
void orientationChangeFinished (M::Orientation)
void displayEntered ()
void displayExited ()
void switcherEntered ()
void switcherExited ()

Public Member Functions

 MWindow (QWidget *parent=0)
 MWindow (MSceneManager *sceneManager, QWidget *parent=0)
virtual ~MWindow ()
void setTranslucentBackground (bool enabled)
void setGlobalAlpha (qreal level)
qreal globalAlpha ()
void setVideoGlobalAlpha (qreal level)
qreal videoGlobalAlpha ()
MScenescene ()
void setSceneManager (MSceneManager *sceneManager)
MSceneManagersceneManager () const
MSceneManagersceneManager ()
M::Orientation orientation () const
M::OrientationAngle orientationAngle () const
QSize visibleSceneSize (M::Orientation) const
QSize visibleSceneSize () const
bool isOrientationAngleLocked () const
void setOrientationAngleLocked (bool locked)
bool isOrientationLocked () const
void setOrientationLocked (bool locked)
bool isOnDisplay () const
bool isInSwitcher () const
void setCloseOnLazyShutdown (bool enable)
bool closeOnLazyShutdown () const
void setNotificationPreviewsVisible (bool visible)
bool notificationPreviewsVisible () const
bool isRoundedCornersEnabled () const
void setRoundedCornersEnabled (bool enabled)

Protected Member Functions

virtual void onDisplayChangeEvent (MOnDisplayChangeEvent *event)
virtual void enterDisplayEvent ()
virtual void exitDisplayEvent ()

Properties

bool orientationAngleLocked
bool orientationLocked
qreal globalAlpha
qreal videoGlobalAlpha
bool notificationPreviewsVisible
bool roundedCornersEnabled

Detailed Description

MWindow is the base class for all MeeGo Touch UI windows.

An MWindow is completely empty by default. For developing an application conforming to the MeeGo Touch UI style, use MApplicationWindow instead.

MWindow is a QGraphicsView widget that visualizes the contents of the application scene. The key differences compared to the standard QGraphicsView is:

Example: Showing scene windows on MWindow.

      MApplication app;
      MWindow window;
      MSceneWindow *sceneWindow = new MMessageBox("Hello World!");

      window.show();

      sceneWindow->appear(&window);

      app.exec();

Constructor & Destructor Documentation

MWindow::MWindow ( QWidget parent = 0  )  [explicit]

Creates a MWindow without a scene manager.

parent is passed to QGraphicsView's constructor.

By default MWindow doesn't create a scene manager. It can be assigned later by calling setSceneManager(). Also, a default scene manager will be automatically created as needed unless explicitly set whenever any scene management is required (adding a managed class like MDialog to the application).

See also:
setSceneManager(), sceneManager()
MWindow::MWindow ( MSceneManager sceneManager,
QWidget parent = 0 
) [explicit]

Creates a MWindow with a provided scenemanager.

parent is passed to QGraphicsView's constructor.

MWindow will take ownership of the given scene manager.

MWindow::~MWindow (  )  [virtual]

Destructs the MWindow object.

If a scene manager is associated with the window, it is destroyed as well.


Member Function Documentation

bool MWindow::closeOnLazyShutdown (  )  const

Returns true if window closes on lazy shutdown.

void MWindow::disableNotificationPreviews (  )  [slot]

Prevents notification preview banners from appearing over this window. Equal to calling setNotificationPreviewsVisible(false).

See also:
setNotificationPreviewsVisible(), notificationPreviewsVisible()
void MWindow::displayEntered (  )  [signal]

This signal is emitted when:

  • the window becomes visible
  • is not obscured anymore by an opaque window

Calling show() will emit displayEntered() when the window becomes visible.

See also:
displayExited(), isOnDisplay()
void MWindow::displayExited (  )  [signal]

A signal that is emitted when:

  • the window has been obscured by an opaque window approximately for one second
  • the window gets hidden
  • the window gets closed

Calling close() will immediately emit displayExited().

See also:
displayEntered(), isOnDisplay()
void MWindow::enableNotificationPreviews (  )  [slot]

Allows notification preview banners to appear over this window. Equal to calling setNotificationPreviewsVisible(true).

See also:
setNotificationPreviewsVisible(), notificationPreviewsVisible()
void MWindow::enterDisplayEvent (  )  [protected, virtual]

A handler that is called just before displayEntered() is emitted.

void MWindow::exitDisplayEvent (  )  [protected, virtual]

A handler that is called just before displayExited() is emitted.

qreal MWindow::globalAlpha (  ) 

Returns the global alpha of the hardware graphics overlay for use by this window.

bool MWindow::isInSwitcher (  )  const

Returns true if the window is currently minimized to the switcher. It doesn't matter whether the window is visible or not in the switcher.

bool MWindow::isOnDisplay (  )  const

Returns true if user can see the window. This is different from QWidget::isVisible(), which is always explicitly set in the application. QWidget::isVisible() doesn't know if the window is e.g. covered by an opaque window and cannot be seen.

Note:
Translucent windows (windows that have an alpha channel) are not considered to obscure the windows behind them, even if all their pixels happen to have alpha 1.0.
See also:
displayEntered(), displayExited()
bool MWindow::isOrientationAngleLocked (  )  const

Returns true if the window orientation angle is not allowed to change when device orientation changes.

The default value is false.

See also:
setOrientationAngleLocked()
bool MWindow::isOrientationLocked (  )  const

Returns true if the window orientation is not allowed to change when device orientation changes.

The default value is false.

See also:
setOrientationLocked()
bool MWindow::isRoundedCornersEnabled (  )  const

Returns whether the window has/draws rounded corners.

See also:
setRoundedCornersEnabled()
void MWindow::lockOrientation (  )  [slot]

Locks window's orientation changes. Equal to calling setOrientationLocked(true).

See also:
setOrientationLocked(), unlockOrientation()
void MWindow::lockOrientationAngle (  )  [slot]

Locks window's orientation angle changes. Equal to calling setOrientationAngleLocked(true).

See also:
setOrientationAngleLocked(), unlockOrientationAngle()
bool MWindow::notificationPreviewsVisible (  )  const

Returns true if application notification preview banners are shown over this window

The value is true by default.

void MWindow::onDisplayChangeEvent ( MOnDisplayChangeEvent event  )  [protected, virtual]

This event handler allows a window to notify subscribers about changes in its presence on the display. enterDisplayEvent() and exitDisplayEvent() convenience handlers are called by the default implementation. MOnDisplayChangeEvent is sent e.g. if the window gets obscured by another window.

M::Orientation MWindow::orientation (  )  const

Returns the current orientation of the window's scene.

M::OrientationAngle MWindow::orientationAngle (  )  const

Returns the current orientation angle of the window's scene.

void MWindow::orientationAngleChanged ( M::OrientationAngle   )  [signal]

Emitted after the scene geometry has changed during rotation.

This is for widgets that need to react when the orientation is about to change, and is emitted after the scene geometry has changed and the rotation animation is about to start.

Note:
This signal is emitted at start of the rotation animation.
See also:
orientationChanged()
void MWindow::orientationChanged ( M::Orientation   )  [signal]

Emitted after scene geometry has changed for a rotation.

This is for widgets that need to react when the orientation is about to change, and is emitted after the scene geometry has changed and the rotation animation is about to start.

Note:
This signal is emitted at start of the rotation animation.
See also:
orientationAngleChanged()
void MWindow::orientationChangeFinished ( M::Orientation   )  [signal]

This signal is emitted when the rotation animation (if any) has finished. It's emitted in tandem with MSceneManager::orientationChangeFinished().

If window doesn't have the scene manager, this signal is emitted together with orientationChanged().

Note:
This signal is emitted with every orientation angle change.
See also:
orientationChanged()
MScene * MWindow::scene (  ) 

Returns the window's MScene.

Reimplemented from QGraphicsView.

MSceneManager * MWindow::sceneManager (  ) 

Returns the scene manager of the window. A scene manager will be automatically created if none was previously set.

The scene manager is responsible for positioning, animating and generally managing MSceneWindows such as MDialog and MApplicationPage inside the window's scene.

Note:
Scene manager takes over orientation angle management of a window. If window orientation angle was changed manually before creating a scene manager, the scene manager will override this setting.
See also:
setSceneManager()
MSceneManager * MWindow::sceneManager (  )  const

Returns the scene manager of the window, or 0 if not set.

The scene manager is responsible for positioning, animating and generally managing MSceneWindows such as MDialog and MApplicationPage inside the window's scene.

void MWindow::setCloseOnLazyShutdown ( bool  enable  ) 

Allows to force close instead of hide during lazy shutdown.

void MWindow::setGlobalAlpha ( qreal  level  ) 

Sets the global alpha of the hardware graphics overlay for use by this window.

Global alpha is used when you want to blend the contents of this window, which is rendering to the graphics overlay with the video overlay. This can be used to draw translucent controls on top of video, for example.

By default, each MWindow does not enable the global alpha. When this window is destroyed or hidden, the system will revert the global alpha back to its previous state.

Platform notes:

  • This is a Harmattan-specific implementation and will require interaction with the Harmattan compositing window manager (MCompositor)
Parameters:
level The valid range of global alpha can be 1.0 (completely opaque) to 0.0 (completely transparent).
void MWindow::setLandscapeOrientation (  )  [slot]

Sets the orientation of the window to landscape.

This is a convenience function that sets the current orientation angle to 0 if it is not already in a landscape orientation (either 0 or 180 degrees angle).

If the window is hidden or it hasn't been shown yet, the orientation change is immediate (i.e. without an rotation animation), otherwise there may be an animated transition.

void MWindow::setNotificationPreviewsVisible ( bool  visible  ) 

Controls whether notification preview banners are shown on top of the window.

Note:
System notifications (e.g. battery low) are still shown regardless of the property.
void MWindow::setOrientationAngle ( M::OrientationAngle  angle  )  [slot]

Sets the orientation angle of the window.

If the window is hidden or it hasn't been shown yet, the orientation angle change is immediate (i.e. without an rotation animation), otherwise there may be an animated transition.

void MWindow::setOrientationAngleLocked ( bool  locked  ) 

Controls whether the window orientation angle follows the device orientation.

If you require your window to be displayed only in a certain orientation angle, set the desired angle using setOrientationAngle() and set this property to true.

Note: Locking the orientation is discouraged by the MeeGo Touch UI application style guidelines.

Example of locking the window orientation angle:

        MApplication app;
        MWindow window;

        // Forces an orientation angle.
        window.setOrientationAngle(M::Angle270);
        window.setOrientationAngleLocked(true);

        window.show();

        return app.exec();
See also:
lockOrientationAngle(), unlockOrientationAngle()
void MWindow::setOrientationLocked ( bool  locked  ) 

Controls whether the window orientation follows the device orientation.

If you require your window to be displayed only in a certain orientation, set the desired angle using setOrientationAngle() and set this property to true.

Note: Locking the orientation is discouraged by the MeeGo TouchUI application style guidelines.

Note:
Setting this property to true locks orientation changes, but allows automatic adjustments of the angle for the given orientation. This means that a window locked in portrait mode will adjust between M::Angle90 and M::Angle270 to keep "top edge" always on top and avoid upside-down situations. In order to lock to a single specific orientation angle, use setOrientationAngleLocked().

Example of locking the window orientation:

        MApplication app;
        MWindow window;

        // Forces the orientation to be portrait
        window.setPortraitOrientation();
        window.setOrientationLocked(true);

        window.show();

        return app.exec();
See also:
lockOrientationAngle(), unlockOrientationAngle()
void MWindow::setPortraitOrientation (  )  [slot]

Sets the orientation of the window to portrait.

This is a convenience function that sets the current orientation angle to 270 if it is not already in a portrait orientation (either 90 or 270 degrees angle).

If the window is hidden or it hasn't been shown yet, the orientation change is immediate (i.e. without an rotation animation), otherwise there may be an animated transition.

void MWindow::setRoundedCornersEnabled ( bool  enabled  ) 

Sets whether the window should have/draw rounded corners.

See also:
isRoundedCornersEnabled()
void MWindow::setSceneManager ( MSceneManager sceneManager  ) 

Assigns a scene manager to the window.

The existing scene manager (if any) will be deleted and replaced by sceneManager. The new sceneManager can be 0.

MWindow will take ownership of the given scene manager.

Note:
Scene manager takes over orientation angle management of a window. If window orientation angle was changed manually before creating a scene manager, the scene manager will override this setting.
void MWindow::setTranslucentBackground ( bool  enabled  ) 

Sets the translucency of the window.

Background translucency is disabled by default.

Having a translucent background means that any window behind it will show through the parts not otherwise filled by the application, for example by widgets.

Calling this method is costly when invoking it after showing the window as it involves recreating the window's viewport. This method usually should be called only once, before showing the window.

Platform notes:

  • Device: This feature requires that a compositing manager is running and an EGL surface with alpha channels
  • Desktop/Scratchbox: MesaGL does not support ARGB GLX visuals. As a workaround, translucency also works in software mode.
void MWindow::setVideoGlobalAlpha ( qreal  level  ) 

Sets the alpha of the hardware video overlay for use by this window.

Video alpha is the is used to control the dimming of the video overlay where hardware accelerated video is rendering.

By default, each MWindow does not enable the video alpha. When this window is destroyed or hidden, the system will revert the video alpha back to its previous state.

Platform notes:

  • This is a Harmattan-specific implementation and will require interaction with the Harmattan compositing window manager (MCompositor)
Parameters:
level The valid range of video alpha can be 1.0 (completely opaque) to 0.0 (completely transparent)
void MWindow::switcherEntered (  )  [signal]

This signal is emitted when the window has entered the task switcer.

void MWindow::switcherExited (  )  [signal]

This signal is emitted when the window has exited the task switcer.

void MWindow::unlockOrientation (  )  [slot]

Unlocks window's orientation changes. Equal to calling setOrientationLocked(false).

See also:
setOrientationLocked(), lockOrientation()
void MWindow::unlockOrientationAngle (  )  [slot]

Unlocks window's orientation angle changes. Equal to calling setOrientationAngleLocked(false).

See also:
setOrientationAngleLocked(), lockOrientationAngle()
qreal MWindow::videoGlobalAlpha (  ) 

Returns the alpha of the hardware video overlay for use by this window.

QSize MWindow::visibleSceneSize (  )  const

Returns the visible size of the window (being also the size of its scene).

QSize MWindow::visibleSceneSize ( M::Orientation  orientation  )  const

Returns the visible size of the window (being also the size of its scene) for the given orientation.


Property Documentation

MWindow::globalAlpha [read, write]

The global alpha of the hardware graphics overlay for use by this window.

MWindow::notificationPreviewsVisible [read, write]

Are notification preview banners shown on top of the window.

MWindow::orientationAngleLocked [read, write]

Is the orientation angle locked

MWindow::orientationLocked [read, write]

Is the orientation locked

MWindow::roundedCornersEnabled [read, write]

This property defines whether the window should have rounded corners.

By default this property is false.

Get its current value with isRoundedCornersEnabled() and set it with setRoundedCornersEnabled();

Note:
Setting it to true will incur the creation of a scene manager and scene if the window doesn't have them yet.
MWindow::videoGlobalAlpha [read, write]

The global alpha of the hardware video overlay for use by this window.


Copyright © 2010 Nokia Corporation
MeeGo Touch