Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQDesktopWidget Class Reference

The TQDesktopWidget class provides access to screen information on multi-head systems. More...

#include <tqdesktopwidget.h>

Inherits TQWidget.

List of all member functions.

Public Members

Signals


Detailed Description

The TQDesktopWidget class provides access to screen information on multi-head systems.

Systems with more than one graphics card and monitor can manage the physical screen space available either as multiple desktops, or as a large virtual desktop, which usually has the size of the bounding rectangle of all the screens (see isVirtualDesktop()). For an application, one of the available screens is the primary screen, i.e. the screen where the main widget resides (see primaryScreen()). All windows opened in the context of the application must be constrained to the boundaries of the primary screen; for example, it would be inconvenient if a dialog box popped up on a different screen, or split over two screens.

The TQDesktopWidget provides information about the geometry of the available screens with screenGeometry(). The number of screens available is returned by numScreens(). The screen number that a particular point or widget is located in is returned by screenNumber().

Widgets provided by TQt use this class, for example, to place tooltips, menus and dialog boxes according to the parent or application widget.

Applications can use this class to save window positions, or to place child widgets on one screen.

Managing Multiple Screens

In the illustration above, Application One's primary screen is screen 0, and App Two's primary screen is screen 1.

See also Advanced Widgets and Environment Classes.


Member Function Documentation

TQDesktopWidget::TQDesktopWidget ()

Creates the desktop widget.

If the system supports a virtual desktop, this widget will have the size of the virtual desktop; otherwise this widget will have the size of the primary screen.

Instead of using TQDesktopWidget directly, use TQApplication::desktop().

TQDesktopWidget::~TQDesktopWidget ()

Destroy the object and free allocated resources.

const TQRect & TQDesktopWidget::availableGeometry ( int screen = -1 ) const

Returns the available geometry of the screen with index screen. What is available will be subrect of screenGeometry() based on what the platform decides is available (for example excludes the Dock and Menubar on Mac OS X, or the taskbar on Windows).

See also screenNumber() and screenGeometry().

const TQRect & TQDesktopWidget::availableGeometry ( TQWidget * widget ) const

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

Returns the available geometry of the screen which contains widget.

See also screenGeometry().

const TQRect & TQDesktopWidget::availableGeometry ( const TQPoint & p ) const

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

Returns the available geometry of the screen which contains p.

See also screenGeometry().

bool TQDesktopWidget::isVirtualDesktop () const

Returns TRUE if the system manages the available screens in a virtual desktop; otherwise returns FALSE.

For virtual desktops, screen() will always return the same widget. The size of the virtual desktop is the size of this desktop widget.

int TQDesktopWidget::numScreens () const

Returns the number of available screens.

See also primaryScreen().

int TQDesktopWidget::primaryScreen () const

Returns the index of the primary screen.

See also numScreens().

void TQDesktopWidget::resized ( int screen ) [signal]

This signal is emitted when the size of screen changes.

TQWidget * TQDesktopWidget::screen ( int screen = -1 )

Returns a widget that represents the screen with index screen. This widget can be used to draw directly on the desktop, using an unclipped painter like this:

    TQPainter paint( TQApplication::desktop()->screen( 0 ), TRUE );
    paint.draw...
    ...
    paint.end();
    

If the system uses a virtual desktop, the returned widget will have the geometry of the entire virtual desktop i.e. bounding every screen.

See also primaryScreen(), numScreens(), and isVirtualDesktop().

const TQRect & TQDesktopWidget::screenGeometry ( int screen = -1 ) const

Returns the geometry of the screen with index screen.

See also screenNumber().

const TQRect & TQDesktopWidget::screenGeometry ( TQWidget * widget ) const

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

Returns the geometry of the screen which contains widget.

const TQRect & TQDesktopWidget::screenGeometry ( const TQPoint & p ) const

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

Returns the geometry of the screen which contains p.

int TQDesktopWidget::screenNumber ( TQWidget * widget = 0 ) const

Returns the index of the screen that contains the largest part of widget, or -1 if the widget not on a screen.

See also primaryScreen().

int TQDesktopWidget::screenNumber ( const TQPoint & point ) const

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

Returns the index of the screen that contains point, or -1 if no screen contains the point.

See also primaryScreen().


This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8