KTutorial  0.5.1
Public Member Functions
ktutorial::WaitForWindow Class Reference

Waits for a specific window to be shown. More...

#include <WaitForWindow.h>

Inheritance diagram for ktutorial::WaitForWindow:
Inheritance graph
[legend]
Collaboration diagram for ktutorial::WaitForWindow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Q_INVOKABLE WaitForWindow ()
 Creates a new WaitForWindow.
 WaitForWindow (const QString &windowObjectName)
 Creates a new WaitForWindow.
virtual ~WaitForWindow ()
 Destroys this WaitForWindow.
Q_INVOKABLE void setWindowObjectName (const QString &windowObjectName)
 Sets the object name of the window to wait for.
virtual bool conditionMet () const
 Returns true if the window was shown while active, false otherwise.
virtual void setActive (bool active)
 Sets this WaitForWindow active or inactive.

Detailed Description

Waits for a specific window to be shown.

When the window with the expected object name is shown and the WaitForEvent is active, the wait ends.

Note that if the window is shown while the WaitFor isn't active, it won't be registered and the condition won't be met. In order to met the condition, the window must be shown while the WaitForEvent is active.

The term "window" is used here in a general sense: WaitForWindow can wait either for true windows or for dialogs. In fact, WaitForWindow must be used whenever there is a modal dialog; waiting for the user to click a button that causes a modal dialog to appear will not work, as the modal dialog will halt further processing of the clicked() signal until it is closed (if the modal dialog was created in a slot connected to the clicked() signal, which is very likely).

Definition at line 45 of file WaitForWindow.h.


Constructor & Destructor Documentation

Creates a new WaitForWindow.

This constructor is needed to dynamically create WaitForWindow objects in scripts using ScriptingModule::newWaitFor(const QString&). Method setWindowObjectName(const QString&) must be called to finish setting up the object. For C++ tutorials, use WaitForWindow(const QString&) constructor instead of this one.

Definition at line 30 of file WaitForWindow.cpp.

References ktutorial::common::WindowVisibilitySpy::addWidgetToSpy(), ktutorial::WaitForWindowPrivate::mConditionMet, and ktutorial::KTutorial::self().

ktutorial::WaitForWindow::WaitForWindow ( const QString &  windowObjectName) [explicit]

Creates a new WaitForWindow.

Note that the name is the object name, not the window title.

Parameters:
windowObjectNameThe object name of the window to wait for.

Definition at line 40 of file WaitForWindow.cpp.

References ktutorial::common::WindowVisibilitySpy::addWidgetToSpy(), ktutorial::WaitForWindowPrivate::mConditionMet, ktutorial::KTutorial::self(), and setWindowObjectName().


Member Function Documentation

bool ktutorial::WaitForWindow::conditionMet ( ) const [virtual]

Returns true if the window was shown while active, false otherwise.

Returns:
True if the window was shown while active, false otherwise.

Implements ktutorial::WaitFor.

Definition at line 60 of file WaitForWindow.cpp.

References ktutorial::WaitForWindowPrivate::mConditionMet.

void ktutorial::WaitForWindow::setActive ( bool  active) [virtual]

Sets this WaitForWindow active or inactive.

Activating it resets its condition.

Parameters:
activeTrue to set it active, false otherwise.

Reimplemented from ktutorial::WaitFor.

Definition at line 64 of file WaitForWindow.cpp.

References ktutorial::WaitForWindowPrivate::mConditionMet.

void ktutorial::WaitForWindow::setWindowObjectName ( const QString &  windowObjectName)

Sets the object name of the window to wait for.

Note that the name is the object name, not the window title. This method can be invoked from a script.

In fact, you should only invoke this method from a script, and only once, to set up the object. For C++ tutorials, use WaitForWindow(const QString&) constructor when creating this WaitForWindow.

Parameters:
windowObjectNameThe object name of the window to wait for.

Definition at line 56 of file WaitForWindow.cpp.

References ktutorial::WaitForWindowPrivate::mWindowObjectName.

Referenced by WaitForWindow().


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