-rw-r--r-- | core/launcher/serverinterface.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/core/launcher/serverinterface.cpp b/core/launcher/serverinterface.cpp index 7002243..9eb7f75 100644 --- a/core/launcher/serverinterface.cpp +++ b/core/launcher/serverinterface.cpp | |||
@@ -74,68 +74,70 @@ bool LayoutManager::eventFilter( QObject *object, QEvent *event ) | |||
74 | 74 | ||
75 | switch ( event->type() ) { | 75 | switch ( event->type() ) { |
76 | case QEvent::Destroy: | 76 | case QEvent::Destroy: |
77 | item = findWidget( (QWidget *)object ); | 77 | item = findWidget( (QWidget *)object ); |
78 | if ( item ) { | 78 | if ( item ) { |
79 | docked.removeRef( item ); | 79 | docked.removeRef( item ); |
80 | layout(); | 80 | layout(); |
81 | } | 81 | } |
82 | break; | 82 | break; |
83 | 83 | ||
84 | case QEvent::Hide: | 84 | case QEvent::Hide: |
85 | case QEvent::Show: | 85 | case QEvent::Show: |
86 | item = findWidget( (QWidget *)object ); | 86 | item = findWidget( (QWidget *)object ); |
87 | if ( item ) | 87 | if ( item ) |
88 | layout(); | 88 | layout(); |
89 | break; | 89 | break; |
90 | 90 | ||
91 | default: | 91 | default: |
92 | break; | 92 | break; |
93 | } | 93 | } |
94 | 94 | ||
95 | return QObject::eventFilter( object, event ); | 95 | return QObject::eventFilter( object, event ); |
96 | } | 96 | } |
97 | 97 | ||
98 | void LayoutManager::layout() | 98 | void LayoutManager::layout() |
99 | { | 99 | { |
100 | QRect mwr( qApp->desktop()->geometry() ); | 100 | QRect mwr( qApp->desktop()->geometry() ); |
101 | QListIterator<Item> it( docked ); | 101 | QListIterator<Item> it( docked ); |
102 | Item *item; | 102 | Item *item; |
103 | for ( ; (item = it.current()); ++it ) { | 103 | for ( ; (item = it.current()); ++it ) { |
104 | QWidget *w = item->w; | 104 | QWidget *w = item->w; |
105 | if ( !w->isVisible() ) | 105 | if ( !w->isVisible() ) |
106 | continue; | 106 | continue; |
107 | |||
108 | QSize sh = w->sizeHint(); | ||
107 | switch ( item->p ) { | 109 | switch ( item->p ) { |
108 | case ServerInterface::Top: | 110 | case ServerInterface::Top: |
109 | w->resize( mwr.width(), w->sizeHint().height() ); | 111 | w->setGeometry( mwr.left(), mwr.top(), |
110 | w->move( mwr.topLeft() ); | 112 | mwr.width(), sh.height() ); |
111 | mwr.setTop( w->geometry().bottom() + 1 ); | 113 | mwr.setTop( w->geometry().bottom() + 1 ); |
112 | break; | 114 | break; |
113 | case ServerInterface::Bottom: | 115 | case ServerInterface::Bottom: |
114 | w->resize( mwr.width(), w->sizeHint().height() ); | 116 | w->setGeometry( mwr.left(), mwr.bottom() - sh.height(), |
115 | w->move( mwr.left(), mwr.bottom()-w->height()+1 ); | 117 | mwr.width(), sh.height() ); |
116 | mwr.setBottom( w->geometry().top() - 1 ); | 118 | mwr.setBottom( w->geometry().top() - 1 ); |
117 | break; | 119 | break; |
118 | case ServerInterface::Left: | 120 | case ServerInterface::Left: |
119 | w->resize( w->sizeHint().width(), mwr.height() ); | 121 | w->setGeometry( mwr.left(), mwr.top(), |
120 | w->move( mwr.topLeft() ); | 122 | sh.width(), mwr.height() ); |
121 | mwr.setLeft( w->geometry().right() + 1 ); | 123 | mwr.setLeft( w->geometry().right() + 1 ); |
122 | break; | 124 | break; |
123 | case ServerInterface::Right: | 125 | case ServerInterface::Right: |
124 | w->resize( w->sizeHint().width(), mwr.height() ); | 126 | w->setGeometry( mwr.right() - sh.width(), mwr.top(), |
125 | w->move( mwr.right()-w->width()+1, mwr.top() ); | 127 | sh.width(), mwr.height() ); |
126 | mwr.setRight( w->geometry().left() - 1 ); | 128 | mwr.setRight( w->geometry().left() - 1 ); |
127 | break; | 129 | break; |
128 | } | 130 | } |
129 | } | 131 | } |
130 | 132 | ||
131 | #ifdef Q_WS_QWS | 133 | #ifdef Q_WS_QWS |
132 | # if QT_VERSION < 0x030000 | 134 | # if QT_VERSION < 0x030000 |
133 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(mwr, | 135 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(mwr, |
134 | QSize(qt_screen->width(),qt_screen->height())) ); | 136 | QSize(qt_screen->width(),qt_screen->height())) ); |
135 | # else | 137 | # else |
136 | QWSServer::setMaxWindowRect( mwr ); | 138 | QWSServer::setMaxWindowRect( mwr ); |
137 | # endif | 139 | # endif |
138 | #endif | 140 | #endif |
139 | } | 141 | } |
140 | 142 | ||
141 | LayoutManager::Item *LayoutManager::findWidget( const QWidget *w ) const | 143 | LayoutManager::Item *LayoutManager::findWidget( const QWidget *w ) const |
@@ -323,33 +325,33 @@ LayoutManager::Item *LayoutManager::findWidget( const QWidget *w ) const | |||
323 | <ul> | 325 | <ul> |
324 | <li> \c Top - the top of the screen. | 326 | <li> \c Top - the top of the screen. |
325 | <li> \c Bottom - the Bottom of the screen. | 327 | <li> \c Bottom - the Bottom of the screen. |
326 | <li> \c Left - the Left of the screen. | 328 | <li> \c Left - the Left of the screen. |
327 | <li> \c Right - the Right of the screen. | 329 | <li> \c Right - the Right of the screen. |
328 | </ul> | 330 | </ul> |
329 | */ | 331 | */ |
330 | 332 | ||
331 | /*! | 333 | /*! |
332 | \fn ServerInterface::dockWidget(QWidget *w, DockArea placement) | 334 | \fn ServerInterface::dockWidget(QWidget *w, DockArea placement) |
333 | 335 | ||
334 | Docks a top-level widget \a w on a side of the screen specified by | 336 | Docks a top-level widget \a w on a side of the screen specified by |
335 | \a placement. The widget is placed | 337 | \a placement. The widget is placed |
336 | according to the order that it was docked, its sizeHint() and whether | 338 | according to the order that it was docked, its sizeHint() and whether |
337 | previously docked widgets are visible. The desktop area available to | 339 | previously docked widgets are visible. The desktop area available to |
338 | QWidget::showMaximized() will exclude any visible docked widgets. | 340 | QWidget::showMaximized() will exclude any visible docked widgets. |
339 | 341 | ||
340 | For example, if a widget is | 342 | For example, if a widget is |
341 | docked at the bottom of the screen, its sizeHint() will define its | 343 | docked at the bottom of the screen, its sizeHint() will define its |
342 | height and it will use the full width of the screen. If a widget is | 344 | height and it will use the full width of the screen. If a widget is |
343 | then docked to the right, its sizeHint() will define its width and | 345 | then docked to the right, its sizeHint() will define its width and |
344 | it will be as high as possible without covering | 346 | it will be as high as possible without covering |
345 | the widget docked at the bottom. | 347 | the widget docked at the bottom. |
346 | 348 | ||
347 | This function is useful for reserving system areas such as taskbars | 349 | This function is useful for reserving system areas such as taskbars |
348 | and input methods that should not be covered by applications. | 350 | and input methods that should not be covered by applications. |
349 | */ | 351 | */ |
350 | 352 | ||
351 | 353 | ||
352 | ServerInterface::~ServerInterface() | 354 | ServerInterface::~ServerInterface() |
353 | { | 355 | { |
354 | } | 356 | } |
355 | 357 | ||