Home · All Classes · Annotated · Functions

QtopiaApplication Class Reference

The QtopiaApplication class implements the system services available to all Qtopia applications. More...

#include <QtopiaApplication>

Inherits QApplication.

Public Types

Public Functions

Signals

Static Public Members

Protected Functions

Additional Inherited Members


Detailed Description

The QtopiaApplication class implements the system services available to all Qtopia applications.

By using QtopiaApplication instead of QApplication, a standard Qt application becomes a Qtopia application. It automatically follows style changes, quits and raises, and in the case of document-oriented applications, changes the currently displayed document in response to the environment.

To create a document-oriented application use showMainDocumentWidget(); to create a non-document-oriented application use showMainWidget(). The keepRunning() function indicates whether the application will continue running after it has processed the last QCop message. This can be changed using setKeepRunning().

A variety of signals are emitted when certain events occur, for example:

The following signals are emitted:

When synching begins or ends the application should save and reload any data files involved in synching. Most of these signals will intially be received and unfiltered through the appMessage() signal.

This class also provides a set of useful static functions as follows:


Member Type Documentation

enum QtopiaApplication::InputMethodHint

ConstantValueDescription
QtopiaApplication::Normal0the widget sometimes needs text input.
QtopiaApplication::AlwaysOff1the widget never needs text input.
QtopiaApplication::AlwaysOn2the widget always needs text input.
QtopiaApplication::Number3the widget needs numeric input.
QtopiaApplication::PhoneNumber4the widget needs phone-style numeric input.
QtopiaApplication::Words5the widget needs word input.
QtopiaApplication::Text6the widget needs non-word input.
QtopiaApplication::Named7the widget needs special input, defined by param. Each input method may support a different range of special input types, but will default to Text if they do not know the type.

By default, QLineEdit and QTextEdit have the Words hint unless they have a QIntValidator, in which case they have the Number hint. This is appropriate for most cases, including the input of names (new names being added to the user's dictionary). All other widgets default to Normal mode.

See also inputMethodHint() and setInputMethodHint().

enum QtopiaApplication::KeepRunningMode

Defines the user interface mode when the "keep running" state is set with QtopiaApplication::setKeepRunning().

ConstantValueDescription
QtopiaApplication::ShowUI0Continue running and show the user interface.
QtopiaApplication::HideUI1Continue running without displaying the user interface.

enum QtopiaApplication::ScreenSaverHint

ConstantValueDescription
QtopiaApplication::Disable0disables any screensaver activity
QtopiaApplication::DisableLightOff50the backlight will never be turned off (dimming remains active).
QtopiaApplication::DisableReturnToHomeScreen100the device will not go back to the homescreen (phone edition only).
QtopiaApplication::DisableSuspend900the device will not suspend (PDA edition only)
QtopiaApplication::Enable1000the screensaver will make use of any power saving tool that is available.

Less severe ScreenSaverHints always imply more severe hints (e.g DisableLightOff implies DisableSuspend). The exact implications are determined by the integer value that each hint is assigned to (enumeration value). A low valued hint will always imply a high valued hint.

See also setTemporaryScreenSaverMode().

enum QtopiaApplication::StylusMode

ConstantValueDescription
QtopiaApplication::LeftOnly0the stylus only generates LeftButton events (the default).
QtopiaApplication::RightOnHold1the stylus generates RightButton events if the user uses the press-and-hold gesture.

See also setStylusOperation() and stylusOperation().


Member Function Documentation

QtopiaApplication::QtopiaApplication ( int & argc, char ** argv, Type t = GuiClient )

Constructs a QtopiaApplication just as you would construct a QApplication, passing argc, argv, and t.

For applications, t should be the default, GuiClient. Only the Qtopia server passes GuiServer.

QtopiaApplication::~QtopiaApplication ()

Destroys the QtopiaApplication.

void QtopiaApplication::appMessage ( const QString & msg, const QByteArray & data )   [signal]

This signal is emitted when a message is received on the application's QPE/Application/appname QCop channel.

The slot to which you connect this signal uses msg and data in the following way:

    void MyWidget::receive( const QString& msg, const QByteArray& data )
    {
        QDataStream stream( data, QIODevice::ReadOnly );
        if ( msg == "someMessage(int,int,int)" ) {
            int a,b,c;
            stream >> a >> b >> c;
            ...
        } else if ( msg == "otherMessage(QString)" ) {
            ...
        }
    }

Note: Messages received here may be processed by QtopiaApplication and emitted as signals, such as flush() and reload().

void QtopiaApplication::categoriesChanged ()   [signal]

This signal is emitted whenever a category is added, removed or edited.

void QtopiaApplication::clockChanged ( bool ampm )   [signal]

This signal is emitted when the clock style is changed. If ampm is true, the clock style is a 12-hour AM/PM clock, otherwise, it is a 24-hour clock.

Warning: When using the QTimeString functions all strings obtained by QTimeString should be updated to reflect the changes.

See also dateFormatChanged().

void QtopiaApplication::contentChanged ( const QContentIdList & ids, QContent::ChangeType type )   [signal]

This signal is emitted whenever one or more QContent is stored, removed or edited. ids contains the list of Id's of the content that is being modified. type contains the type of change.

void QtopiaApplication::dateFormatChanged ()   [signal]

This signal is emitted whenever the date format is changed.

Warning: When using QTimeString functions, all QTimeString strings should be updated to reflect the changes.

See also clockChanged().

int QtopiaApplication::exec ()

Enters the main event loop and waits until exit() is called.

See also QApplication::exec().

int QtopiaApplication::execDialog ( QDialog * dialog, bool nomax = false )   [static]

Shows and calls exec() on dialog. An heuristic approach is taken to determine the size and maximization of the dialog.

nomax forces it to not be maximized.

void QtopiaApplication::grabKeyboard ()   [static]

Grabs the physical keyboard keys, e.g. the application's launching keys. Instead of launching applications when these keys are pressed the signals emitted are sent to this application instead. Some games programs take over the launch keys in this way to make interaction easier.

Under Qtopia Phone Edition this function does nothing. It is not possible to grab the keyboard under Qtopia Phone Edition.

See also ungrabKeyboard().

void QtopiaApplication::hideInputMethod ()   [static]

Explicitly hide the current input method.

The current input method is still indicated in the taskbar, but no longer takes up screen space, and can no longer be interacted with.

See also showInputMethod().

InputMethodHint QtopiaApplication::inputMethodHint ( QWidget * w )   [static]

Returns the currently set hint to the system as to whether widget w has any use for text input methods.

See also setInputMethodHint() and InputMethodHint.

QString QtopiaApplication::inputMethodHintParam ( QWidget * w )   [static]

Returns the currently set hint parameter for widget w.

See also setInputMethodHint() and InputMethodHint.

bool QtopiaApplication::isMenuLike ( const QDialog * diag )   [static]

Returns true if the dialog diag is set to have MenuLike behaviour when executed, otherwise returns false.

See also setMenuLike().

bool QtopiaApplication::keepRunning ()   [static]

Returns true if the application will quit after processing the current list of qcop messages, otherwise returns false.

See also setKeepRunning().

void QtopiaApplication::loadTranslations ( const QString & qms )   [static]

Loads the translation file specified by qms. qms can be the name of a library or application.

void QtopiaApplication::loadTranslations ( const QStringList & qms )   [static]

This is an overloaded member function, provided for convenience.

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

It is the same as calling loadTranslations(QString) for each entry of qms.

bool QtopiaApplication::qwsEventFilter ( QWSEvent * e )   [virtual protected]

Filters Qt event e to implement Qtopia-specific functionality.

Reimplemented from QApplication.

void QtopiaApplication::setDefaultRotation ( int r )   [static]

Rotates Qtopia by r degrees.

void QtopiaApplication::setInputMethodHint ( QWidget * w, InputMethodHint mode, const QString & param = QString() )   [static]

Hints to the system that widget w has use for text input methods as specified by mode. If mode is Named, then param specifies the name.

See also inputMethodHint() and InputMethodHint.

void QtopiaApplication::setInputMethodHint ( QWidget * w, const QString & named )   [static]

This is an overloaded member function, provided for convenience.

Hints to the system that widget w has use for the text input method specified by named. Such methods are input-method-specific and are defined by the files in [qt_prefix]/etc/im/ for each input method.

For example, the phone key input method includes support for the names input methods:

The effect in the phone key input method is to modify the binding of phone keys to characters (such as making "@" easier to input), and to add additional words to the recognition word lists, such as: www.

If the current input method doesn't understand the hint, it will be ignored.

See also inputMethodHint() and InputMethodHint.

void QtopiaApplication::setKeepRunning ( KeepRunningMode mode = ShowUI )   [static]

If an application is started via a QCop message, the application will process the QCop message and then quit. If the application calls this function while processing a QCop message, after processing its outstanding QCop messages the application will continue running and by defualt display the user interface.

To continue running without displaying the user interface use QtopiaApplication::HideUI as the mode.

See also keepRunning().

void QtopiaApplication::setMenuLike ( QDialog * diag, bool b )   [static]

b equal to true sets the dialog diag to have MenuLike behaviour when executed, otherwise sets dialog to have default dialog behaviour.

MenuLike dialogs typically have a single list of options, and should accept the dialog when the select key is pressed on the appropriate item, and when a mouse/stylus is used to click on an item. Key focus should be accepted by only one widget.

By marking a dialog as MenuLike Qtopia will map the Back key to reject the dialog and will not map any key to accept the dialog - that must be user-defined.

The default dialog behaviour is to include a cancel menu option in the context menu to reject the dialog and to map the Back key to accept the dialog.

See also isMenuLike().

void QtopiaApplication::setStylusOperation ( QWidget * w, StylusMode mode )   [static]

Causes widget w to receive mouse events according to the stylus mode.

See also stylusOperation() and StylusMode.

void QtopiaApplication::setTemporaryScreenSaverMode ( ScreenSaverHint hint )   [static]

This method temporarily overrides the current global screen saver with the ScreenSaverHint hint, allowing applications to control screensaver activation during their execution.

See also ScreenSaverHint.

void QtopiaApplication::showDialog ( QDialog * dialog, bool nomax = false )   [static]

Shows dialog. An heuristic approach is taken to determine the size and maximization of the dialog.

nomax forces it to not be maximized.

void QtopiaApplication::showInputMethod ()   [static]

Explicitly show the current input method.

Input methods are indicated in the taskbar by a small icon. If the input method is activated (shown) then it takes up some proportion of the bottom of the screen, to allow the user to interact (input characters) with it.

See also hideInputMethod().

void QtopiaApplication::showMainDocumentWidget ( QWidget * mw, bool nomaximize = false )

Sets widget mw as the mainWidget() and shows it. For small windows, consider passing true for nomaximize rather than the default false.

This calls designates the application as a document-oriented application.

The mw widget must have this slot: setDocument(const QString&).

See also showMainWidget().

void QtopiaApplication::showMainWidget ( QWidget * mw, bool nomaximize = false )

Sets widget mw as the mainWidget() and shows it. For small windows, consider passing true for nomaximize rather than the default false.

See also showMainDocumentWidget().

StylusMode QtopiaApplication::stylusOperation ( QWidget * w )   [static]

Returns the current StylusMode for widget w.

See also setStylusOperation() and StylusMode.

void QtopiaApplication::timeChanged ()   [signal]

This signal is emitted when the time changes outside the normal passage of time, that is, if the time is set backwards or forwards.

If the application offers the TimeMonitor service, it will get the QCop message that causes this signal even if it is not running, thus allowing it to update any alarms or other time-related records.

void QtopiaApplication::ungrabKeyboard ()   [static]

Reverses the effect of grabKeyboard(). This is called automatically on program exit.

void QtopiaApplication::volumeChanged ( bool muted )   [signal]

This signal is emitted whenever the mute state is changed. If muted is true, then sound output has been muted.

void QtopiaApplication::weekChanged ( bool startOnMonday )   [signal]

This signal is emitted if the week start day is changed. If startOnMonday is true then the first day of the week is Monday otherwise the first day of the week is Sunday.


Copyright © 2006 Trolltech Trademarks
Qtopia 4.1.7