-rw-r--r-- | libopie2/opiecore/oapplication.cpp | 14 | ||||
-rw-r--r-- | libopie2/opiecore/oapplication.h | 16 |
2 files changed, 30 insertions, 0 deletions
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp index a0abcc2..12418d5 100644 --- a/libopie2/opiecore/oapplication.cpp +++ b/libopie2/opiecore/oapplication.cpp @@ -91,13 +91,15 @@ void OApplication::init() qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); } } + void OApplication::setMainWidget( QWidget* widget ) { showMainWidget( widget ); } + void OApplication::showMainWidget( QWidget* widget, bool nomax ) { #ifdef Q_WS_QWS QPEApplication::showMainWidget( widget, nomax ); @@ -105,6 +107,18 @@ void OApplication::showMainWidget( QWidget* widget, bool nomax ) QApplication::setMainWidget( widget ); widget->show(); #endif widget->setCaption( _appname ); +} + +void OApplication::setTitle( QString title ) const +{ + if ( mainWidget() ) + { + if ( !title.isNull() ) + mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); + else + mainWidget()->setCaption( _appname ); } +} + diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h index 736e786..4d25202 100644 --- a/libopie2/opiecore/oapplication.h +++ b/libopie2/opiecore/oapplication.h @@ -68,8 +68,9 @@ class OApplication: public OApplicationBaseClass * allows access to the single global OApplication object, since * more than one cannot be created in the same application. It * saves you the trouble of having to pass the pointer explicitly * to every function that may require it. + * * @return the current application object */ static const OApplication* oApplication() { return _instance; }; @@ -91,17 +92,32 @@ class OApplication: public OApplicationBaseClass /** * Sets the main widget - reimplemented to call showMainWidget() * on Qt/Embedded. + * + * @param mainWidget the widget to become the main widget + * @see QWidget object */ virtual void setMainWidget( QWidget *mainWidget ); /** * Shows the main widget - reimplemented to call setMainWidget() * on platforms other than Qt/Embedded. + * + * @param mainWidget the widget to become the main widget + * @see QWidget object */ virtual void showMainWidget( QWidget* widget, bool nomax = false ); + /** + * Set the application title. The application title will be concatenated + * to the application name given in the constructor. + * + * @param title the title. If not given, resets caption to appname + */ + virtual void setTitle( QString title = QString::null ) const; + //virtual void setTitle() const; + protected: void init(); private: |