Qt 4.8
Public Types | Public Functions | Private Functions | Properties | Friends | List of all members
QWSWindow Class Reference

The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux. More...

#include <qwindowsystem_qws.h>

Public Types

enum  State {
  NoState, Hidden, Showing, Visible,
  Hiding, Raising, Lowering, Moving,
  ChangingGeometry, Destroyed
}
 This enum describes the state of a window. More...
 

Public Functions

QRegion allocatedRegion () const
 Returns the region that the window is allowed to draw onto, including any window decorations but excluding regions covered by other windows. More...
 
const QStringcaption () const
 Returns the window's caption. More...
 
QWSClientclient () const
 Returns a reference to the QWSClient object that owns this window. More...
 
QRegion dirtyOnScreen () const
 Returns the region that has been repainted since the previous QScreen::exposeRegion(), and needs to be copied to the screen. More...
 
void hide ()
 Hides the window. More...
 
bool isFullyObscured () const
 Returns true if the window is completely obsured by another window or by the bounds of the screen; otherwise returns false. More...
 
bool isOpaque () const
 Returns true if the window is opaque, i. More...
 
bool isPartiallyObscured () const
 Returns true if the window is partially obsured by another window or by the bounds of the screen; otherwise returns false. More...
 
bool isVisible () const
 Returns true if the window is visible; otherwise returns false. More...
 
void lower ()
 Lowers the window below other windows. More...
 
const QStringname () const
 Returns the window's name, which is taken from the QWidget::objectName() at the time of QWidget::show() . More...
 
uint opacity () const
 Returns the window's alpha channel value. More...
 
QRegion paintedRegion () const
 Returns the region that the window is known to have drawn into. More...
 
 QWSWindow (int i, QWSClient *client)
 
void raise ()
 Raises the window above all other windows except "Stay on top" windows. More...
 
const QRegionrequestedRegion () const
 Returns the region that the window has requested to draw onto, including any window decorations. More...
 
void setActiveWindow ()
 Make this the active window (i. More...
 
void show ()
 Shows the window. More...
 
State state () const
 Returns the current state of the window. More...
 
Qt::WindowFlags windowFlags () const
 Returns the window flags of the window. More...
 
QWSWindowSurfacewindowSurface () const
 
int winId () const
 Returns the window's ID. More...
 
 ~QWSWindow ()
 Destructor. More...
 

Private Functions

void createSurface (const QString &key, const QByteArray &data)
 
void focus (bool get)
 
int focusPriority () const
 
bool forClient (const QWSClient *cl) const
 
bool hidden () const
 
void operation (QWSWindowOperationEvent::Operation o)
 
void setAllocatedRegion (const QRegion &region)
 
void setCaption (const QString &c)
 Sets the window's caption to c. More...
 
void setName (const QString &n)
 
void shuttingDown ()
 
void startEmbed (QWSWindow *window)
 
void stopEmbed (QWSWindow *window)
 

Properties

uint _opacity
 
QWSClientc
 
QWSWindowPrivated
 
QRegion exposed
 
int id
 
int last_focus_time
 
bool modified
 
bool onTop
 
bool opaque
 
QRegion requested_region
 
QString rgnCaption
 
QString rgnName
 
QWSWindowSurfacesurface
 

Friends

class QWSServer
 
class QWSServerPrivate
 

Detailed Description

The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.

When you run a Qt for Embedded Linux application, it either runs as a server or connects to an existing server. As applications add and remove windows, the server process maintains information about each window. In Qt for Embedded Linux, top-level windows are encapsulated as QWSWindow objects. Note that you should never construct the QWSWindow class yourself; the current top-level windows can be retrieved using the QWSServer::clientWindows() function.

With a window at hand, you can retrieve its caption, name, opacity and ID using the caption(), name(), opacity() and winId() functions, respectively. Use the client() function to retrieve a pointer to the client that owns the window.

Use the isVisible() function to find out if the window is visible. You can find out if the window is completely obscured by another window or by the bounds of the screen, using the isFullyObscured() function. The isOpaque() function returns true if the window has an alpha channel equal to 255. Finally, the requestedRegion() function returns the region of the display the window wants to draw on.

See also
QWSServer, QWSClient, {Qt for Embedded Linux Architecture}

Definition at line 94 of file qwindowsystem_qws.h.

Enumerations

◆ State

This enum describes the state of a window.

Most of the transitional states are set just before a call to QScreen::exposeRegion() and reset immediately afterwards.

  • NoState Initial state before the window is properly initialized.
  • Hidden The window is not visible.
  • Showing The window is being shown.
  • Visible The window is visible, and not in a transition.
  • Hiding The window is being hidden.
  • Raising The windoe is being raised.
  • Lowering The window is being raised.
  • Moving The window is being moved.
  • ChangingGeometry The window's geometry is being changed.
  • Destroyed The window is destroyed.
See also
state(), QScreen::exposeRegion()
Enumerator
NoState 
Hidden 
Showing 
Visible 
Hiding 
Raising 
Lowering 
Moving 
ChangingGeometry 
Destroyed 

Definition at line 114 of file qwindowsystem_qws.h.

Constructors and Destructors

◆ QWSWindow()

QWSWindow::QWSWindow ( int  i,
QWSClient client 
)
Warning
This function is not part of the public interface.

Constructs a new top-level window, associated with the client client and giving it the id i.

Definition at line 409 of file qwindowsystem_qws.cpp.

410  : id(i), modified(false),
411  onTop(false), c(client), last_focus_time(0), _opacity(255),
412  opaque(true), d(new QWSWindowPrivate)
413 {
414  surface = 0;
415 }
QWSWindowSurface * surface
QWSWindowPrivate * d
QWSClient * c

◆ ~QWSWindow()

QWSWindow::~QWSWindow ( )

Destructor.

Warning
This function is not part of the public interface.

Definition at line 625 of file qwindowsystem_qws.cpp.

626 {
627 #ifndef QT_NO_QWS_INPUTMETHODS
628  if (current_IM_composing_win == this)
630 #endif
631 #ifndef QT_NO_QWSEMBEDWIDGET
632  QWSWindow *embedder = d->embedder;
633  if (embedder) {
634  embedder->d->embedded.removeAll(this);
635  d->embedder = 0;
636  }
637  while (!d->embedded.isEmpty())
639 #endif
640 
641 #ifndef QT_NO_QWS_MULTIPROCESS
642  if (surface && !surface->isBuffered()) {
643  if (c && c->d_func()) // d_func() will be 0 if client is deleted
645  }
646 #endif
647 
648  delete surface;
649  delete d;
650 }
QWSWindowSurface * surface
void removeUnbufferedSurface()
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindowPrivate * d
QList< QWSWindow * > embedded
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
QWSClient * c
static QWSWindow * current_IM_composing_win
void stopEmbed(QWSWindow *window)
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

Functions

◆ allocatedRegion()

QRegion QWSWindow::allocatedRegion ( ) const

Returns the region that the window is allowed to draw onto, including any window decorations but excluding regions covered by other windows.

Warning
This function is not part of the public interface.
See also
paintedRegion(), requestedRegion()

Definition at line 664 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::_q_clientClosed(), QWSTtyKbPrivate::handleConsoleSwitch(), QWSServerPrivate::invokeEmbed(), QWSServerPrivate::invokeSelectCursor(), QWSServerPrivate::invokeSetOpacity(), QWSServerPrivate::lowerWindow(), QWSServerPrivate::moveWindowRegion(), QWSServerPrivate::raiseWindow(), QWSServerPrivate::request_region(), QWSServerPrivate::setWindowRegion(), QWSServerPrivate::update_regions(), and QWSServer::windowAt().

665 {
666  return d->allocatedRegion;
667 }
QWSWindowPrivate * d

◆ caption()

const QString & QWSWindow::caption ( ) const
inline

Returns the window's caption.

See also
name(), winId()

Definition at line 105 of file qwindowsystem_qws.h.

Referenced by QWSServerPrivate::invokeRegionName().

105 { return rgnCaption; }
QString rgnCaption

◆ client()

QWSClient * QWSWindow::client ( ) const
inline

◆ createSurface()

void QWSWindow::createSurface ( const QString key,
const QByteArray data 
)
private

Definition at line 473 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::request_region().

474 {
475 #ifndef QT_NO_QWS_MULTIPROCESS
476  if (surface && !surface->isBuffered())
478 #endif
479 
480  delete surface;
482  surface->setPermanentState(data);
483 
484 #ifndef QT_NO_QWS_MULTIPROCESS
485  if (!surface->isBuffered())
487 #endif
488 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
QWSWindowSurface * surface
void removeUnbufferedSurface()
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
virtual QWSWindowSurface * createSurface(QWidget *widget) const
Creates and returns a new window surface for the given widget.
void addUnbufferedSurface()
QWSClient * c
virtual void setPermanentState(const QByteArray &state)
Implement this function to attach a server-side surface instance to the corresponding client side ins...

◆ dirtyOnScreen()

QRegion QWSWindow::dirtyOnScreen ( ) const

Returns the region that has been repainted since the previous QScreen::exposeRegion(), and needs to be copied to the screen.

Since
4.3

Definition at line 468 of file qwindowsystem_qws.cpp.

469 {
470  return d->dirtyOnScreen;
471 }
QWSWindowPrivate * d

◆ focus()

void QWSWindow::focus ( bool  get)
private

Definition at line 596 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::setFocus().

597 {
598  if (get)
600  if (c) {
602  event.simpleData.window = id;
603  event.simpleData.get_focus = get;
604  c->sendEvent(&event);
605  }
606 }
void sendEvent(QWSEvent *event)
EventRef event
QWSClient * c
static int global_focus_time_counter

◆ focusPriority()

int QWSWindow::focusPriority ( ) const
inlineprivate

Definition at line 138 of file qwindowsystem_qws.h.

Referenced by QWSServerPrivate::setFocus().

138 { return last_focus_time; }

◆ forClient()

bool QWSWindow::forClient ( const QWSClient cl) const
inlineprivate

◆ hidden()

bool QWSWindow::hidden ( ) const
inlineprivate

Definition at line 131 of file qwindowsystem_qws.h.

Referenced by QWSServerPrivate::setFocus().

131 { return requested_region.isEmpty(); }
QRegion requested_region
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098

◆ hide()

void QWSWindow::hide ( )

Hides the window.

Warning
This function is not part of the public interface.

Definition at line 548 of file qwindowsystem_qws.cpp.

Referenced by hide().

549 {
551 #ifndef QT_NO_QWSEMBEDWIDGET
552  const int n = d->embedded.size();
553  for (int i = 0; i < n; ++i)
554  d->embedded.at(i)->hide();
555 #endif
556 }
void hide()
Hides the window.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QWSWindowPrivate * d
QList< QWSWindow * > embedded
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void operation(QWSWindowOperationEvent::Operation o)

◆ isFullyObscured()

bool QWSWindow::isFullyObscured ( ) const
inline

Returns true if the window is completely obsured by another window or by the bounds of the screen; otherwise returns false.

See also
isVisible()

Definition at line 112 of file qwindowsystem_qws.h.

112 { return allocatedRegion().isEmpty(); }
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098

◆ isOpaque()

bool QWSWindow::isOpaque ( ) const
inline

Returns true if the window is opaque, i.

e., if its alpha channel equals 255; otherwise returns false.

See also
opacity()

Definition at line 125 of file qwindowsystem_qws.h.

Referenced by QScreen::compose(), QDirectFBScreen::exposeRegion(), QWSServerPrivate::invokeSetOpacity(), QWSServerPrivate::lowerWindow(), QWSServerPrivate::raiseWindow(), and QWSServerPrivate::update_regions().

125 {return opaque && _opacity == 255;}

◆ isPartiallyObscured()

bool QWSWindow::isPartiallyObscured ( ) const
inline

Returns true if the window is partially obsured by another window or by the bounds of the screen; otherwise returns false.

Warning
This function is not part of the public interface.

Definition at line 111 of file qwindowsystem_qws.h.

111 { return requested_region != allocatedRegion(); }
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
QRegion requested_region

◆ isVisible()

bool QWSWindow::isVisible ( ) const
inline

Returns true if the window is visible; otherwise returns false.

See also
isFullyObscured()

Definition at line 110 of file qwindowsystem_qws.h.

Referenced by QWSServerPrivate::request_region().

110 { return !requested_region.isEmpty(); }
QRegion requested_region
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098

◆ lower()

void QWSWindow::lower ( )

Lowers the window below other windows.

Warning
This function is not part of the public interface.

Definition at line 514 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::invokeSetAltitude(), and lower().

515 {
517 #ifndef QT_NO_QWSEMBEDWIDGET
518  const int n = d->embedded.size();
519  for (int i = 0; i < n; ++i)
520  d->embedded.at(i)->lower();
521 #endif
522 }
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void lowerWindow(QWSWindow *, int=-1)
QWSWindowPrivate * d
static QWSServerPrivate * qwsServerPrivate
QList< QWSWindow * > embedded
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void lower()
Lowers the window below other windows.

◆ name()

const QString & QWSWindow::name ( ) const
inline

Returns the window's name, which is taken from the QWidget::objectName() at the time of QWidget::show() .

See also
caption(), winId()

Definition at line 104 of file qwindowsystem_qws.h.

Referenced by QWSServerPrivate::invokeRegionName().

104 { return rgnName; }

◆ opacity()

uint QWSWindow::opacity ( ) const
inline

Returns the window's alpha channel value.

See also
isOpaque()

Definition at line 126 of file qwindowsystem_qws.h.

Referenced by QScreen::compose(), and QDirectFBScreen::exposeRegion().

126 { return _opacity; }

◆ operation()

void QWSWindow::operation ( QWSWindowOperationEvent::Operation  o)
private

Definition at line 608 of file qwindowsystem_qws.cpp.

Referenced by hide(), and show().

609 {
610  if (!c)
611  return;
613  event.simpleData.window = id;
614  event.simpleData.op = o;
615  c->sendEvent(&event);
616 }
void sendEvent(QWSEvent *event)
EventRef event
QWSClient * c

◆ paintedRegion()

QRegion QWSWindow::paintedRegion ( ) const

Returns the region that the window is known to have drawn into.

Warning
This function is not part of the public interface.
See also
allocatedRegion(), requestedRegion()

Definition at line 691 of file qwindowsystem_qws.cpp.

Referenced by QScreen::blit(), and QScreen::compose().

692 {
693  return (d->painted ? d->allocatedRegion : QRegion());
694 }
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QWSWindowPrivate * d

◆ raise()

void QWSWindow::raise ( )

Raises the window above all other windows except "Stay on top" windows.

Warning
This function is not part of the public interface.

Definition at line 497 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::invokeSetAltitude(), and raise().

498 {
500 #ifndef QT_NO_QWSEMBEDWIDGET
501  const int n = d->embedded.size();
502  for (int i = 0; i < n; ++i)
503  d->embedded.at(i)->raise();
504 #endif
505 }
void raise()
Raises the window above all other windows except "Stay on top" windows.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void raiseWindow(QWSWindow *, int=0)
QWSWindowPrivate * d
static QWSServerPrivate * qwsServerPrivate
QList< QWSWindow * > embedded
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ requestedRegion()

QRegion QWSWindow::requestedRegion ( ) const
inline

Returns the region that the window has requested to draw onto, including any window decorations.

See also
client()

Definition at line 107 of file qwindowsystem_qws.h.

Referenced by QScreen::blit(), and QScreen::compose().

107 { return requested_region; }
QRegion requested_region

◆ setActiveWindow()

void QWSWindow::setActiveWindow ( )

Make this the active window (i.

Warning
This function is not part of the public interface. e., sets the keyboard focus to this window).

Definition at line 566 of file qwindowsystem_qws.cpp.

Referenced by setActiveWindow().

567 {
568  qwsServerPrivate->setFocus(this, true);
569 #ifndef QT_NO_QWSEMBEDWIDGET
570  const int n = d->embedded.size();
571  for (int i = 0; i < n; ++i)
572  d->embedded.at(i)->setActiveWindow();
573 #endif
574 }
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void setActiveWindow()
Make this the active window (i.
QWSWindowPrivate * d
static QWSServerPrivate * qwsServerPrivate
QList< QWSWindow * > embedded
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void setFocus(QWSWindow *, bool gain)

◆ setAllocatedRegion()

void QWSWindow::setAllocatedRegion ( const QRegion region)
inlineprivate

Definition at line 696 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::enablePainting(), QWSServerPrivate::moveWindowRegion(), and QWSServerPrivate::update_regions().

697 {
698  d->allocatedRegion = region;
699 }
QWSWindowPrivate * d

◆ setCaption()

void QWSWindow::setCaption ( const QString c)
private

Sets the window's caption to c.

Warning
This function is not part of the public interface.

Definition at line 588 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::invokeRegionName().

589 {
590  rgnCaption = c;
591 }
QString rgnCaption
QWSClient * c

◆ setName()

void QWSWindow::setName ( const QString n)
private

Definition at line 576 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::invokeRegionName().

577 {
578  rgnName = n;
579 }

◆ show()

void QWSWindow::show ( )

Shows the window.

Warning
This function is not part of the public interface.

Definition at line 531 of file qwindowsystem_qws.cpp.

Referenced by show().

532 {
534 #ifndef QT_NO_QWSEMBEDWIDGET
535  const int n = d->embedded.size();
536  for (int i = 0; i < n; ++i)
537  d->embedded.at(i)->show();
538 #endif
539 }
void show()
Shows the window.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QWSWindowPrivate * d
QList< QWSWindow * > embedded
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void operation(QWSWindowOperationEvent::Operation o)

◆ shuttingDown()

void QWSWindow::shuttingDown ( )
inlineprivate

◆ startEmbed()

void QWSWindow::startEmbed ( QWSWindow window)
inlineprivate

Definition at line 702 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::invokeEmbed().

703 {
704  d->embedded.append(w);
705  w->d->embedder = this;
706 }
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QWSWindowPrivate * d
QList< QWSWindow * > embedded

◆ state()

QWSWindow::State QWSWindow::state ( ) const

Returns the current state of the window.

Since
4.3

Definition at line 447 of file qwindowsystem_qws.cpp.

Referenced by QScreen::exposeRegion().

448 {
449  return d->state;
450 }
QWSWindowPrivate * d
QWSWindow::State state

◆ stopEmbed()

void QWSWindow::stopEmbed ( QWSWindow window)
inlineprivate

Definition at line 708 of file qwindowsystem_qws.cpp.

Referenced by QWSServerPrivate::invokeEmbed(), and ~QWSWindow().

709 {
710  w->d->embedder = 0;
711  w->client()->sendEmbedEvent(w->winId(), QWSEmbedEvent::Region, QRegion());
712  d->embedded.removeAll(w);
713 }
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QWSWindowPrivate * d
QList< QWSWindow * > embedded
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ windowFlags()

Qt::WindowFlags QWSWindow::windowFlags ( ) const

Returns the window flags of the window.

This value is only available after the first paint event.

Since
4.3

Definition at line 458 of file qwindowsystem_qws.cpp.

459 {
460  return d->windowFlags;
461 }
Qt::WindowFlags windowFlags
QWSWindowPrivate * d

◆ windowSurface()

QWSWindowSurface * QWSWindow::windowSurface ( ) const
inline

◆ winId()

int QWSWindow::winId ( ) const
inline

Friends and Related Functions

◆ QWSServer

friend class QWSServer
friend

Definition at line 96 of file qwindowsystem_qws.h.

◆ QWSServerPrivate

friend class QWSServerPrivate
friend

Definition at line 97 of file qwindowsystem_qws.h.

Properties

◆ _opacity

uint QWSWindow::_opacity
private

Definition at line 166 of file qwindowsystem_qws.h.

Referenced by QWSServerPrivate::invokeSetOpacity().

◆ c

QWSClient* QWSWindow::c
private

◆ d

QWSWindowPrivate* QWSWindow::d
private

◆ exposed

QRegion QWSWindow::exposed
private

Definition at line 163 of file qwindowsystem_qws.h.

◆ id

int QWSWindow::id
private

◆ last_focus_time

int QWSWindow::last_focus_time
private

Definition at line 164 of file qwindowsystem_qws.h.

Referenced by focus().

◆ modified

bool QWSWindow::modified
private

Definition at line 159 of file qwindowsystem_qws.h.

◆ onTop

bool QWSWindow::onTop
private

◆ opaque

bool QWSWindow::opaque
private

◆ requested_region

QRegion QWSWindow::requested_region
private

◆ rgnCaption

QString QWSWindow::rgnCaption
private

Definition at line 158 of file qwindowsystem_qws.h.

Referenced by setCaption().

◆ rgnName

QString QWSWindow::rgnName
private

Definition at line 157 of file qwindowsystem_qws.h.

Referenced by setName().

◆ surface

QWSWindowSurface* QWSWindow::surface
private

Definition at line 165 of file qwindowsystem_qws.h.

Referenced by createSurface(), QWSWindow(), and ~QWSWindow().


The documentation for this class was generated from the following files: