author | simon <simon> | 2003-03-25 20:30:12 (UTC) |
---|---|---|
committer | simon <simon> | 2003-03-25 20:30:12 (UTC) |
commit | 3a4ee8d8a53ca17703b34f84e1a411056ee7e50f (patch) (side-by-side diff) | |
tree | 6010cc8c464767725a7ab8b973428945dca62994 | |
parent | f7395e72a415322101ee3e22cb0e10b6bdf60a63 (diff) | |
download | opie-3a4ee8d8a53ca17703b34f84e1a411056ee7e50f.zip opie-3a4ee8d8a53ca17703b34f84e1a411056ee7e50f.tar.gz opie-3a4ee8d8a53ca17703b34f84e1a411056ee7e50f.tar.bz2 |
- keep an eye on resize events on the desktop widget, which are an
indication for things like life rotation. upon a resize re-layout things
(taskbar, tabs and maxwindow rect)
-rw-r--r-- | core/launcher/desktop.cpp | 31 | ||||
-rw-r--r-- | core/launcher/desktop.h | 2 | ||||
-rw-r--r-- | core/launcher/taskbar.h | 3 |
3 files changed, 28 insertions, 8 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 86527f6..6def126 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp @@ -509,3 +509,3 @@ Desktop::Desktop() : setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); - tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); + layout(); @@ -526,2 +526,3 @@ Desktop::Desktop() : qApp->installEventFilter( this ); + qApp->desktop()->installEventFilter( this ); @@ -734,8 +735,3 @@ void Desktop::styleChange( QStyle &s ) QWidget::styleChange( s ); - int displayw = qApp->desktop() ->width(); - int displayh = qApp->desktop() ->height(); - - QSize sz = tb->sizeHint(); - - tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); + layout(); } @@ -808,2 +804,13 @@ void DesktopApplication::restart() +void Desktop::layout() +{ + int displayw = qApp->desktop() ->width(); + int displayh = qApp->desktop() ->height(); + + QSize sz = tb->sizeHint(); + + tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); + tb->calcMaxWindowRect(); +} + void Desktop::startTransferServer() @@ -832,2 +839,12 @@ void Desktop::timerEvent( QTimerEvent *e ) +bool Desktop::eventFilter( QObject *o, QEvent *ev ) +{ + if ( o != qApp->desktop() || ev->type() != QEvent::Resize ) + return QWidget::eventFilter( o, ev ); + + layout(); + + return QWidget::eventFilter( o, ev ); +} + void Desktop::terminateServers() diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index 4024c38..86d8aa8 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h @@ -136,2 +136,3 @@ protected: void timerEvent( QTimerEvent *e ); + virtual bool eventFilter( QObject *o, QEvent *ev ); @@ -142,2 +143,3 @@ protected: private: + void layout(); void startTransferServer(); diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h index cd631ef..a0bf395 100644 --- a/core/launcher/taskbar.h +++ b/core/launcher/taskbar.h @@ -63,4 +63,5 @@ protected: -private slots: +public slots: void calcMaxWindowRect(); +private slots: void receive( const QCString &msg, const QByteArray &data ); |