summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/serverinterface.cpp22
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
@@ -66,84 +66,86 @@ bool LayoutManager::eventFilter( QObject *object, QEvent *event )
{
if ( object == qApp->desktop() ) {
if ( event->type() == QEvent::Resize )
layout();
return QObject::eventFilter( object, event );
}
Item *item;
switch ( event->type() ) {
case QEvent::Destroy:
item = findWidget( (QWidget *)object );
if ( item ) {
docked.removeRef( item );
layout();
}
break;
case QEvent::Hide:
case QEvent::Show:
item = findWidget( (QWidget *)object );
if ( item )
layout();
break;
-
+
default:
break;
}
return QObject::eventFilter( object, event );
}
void LayoutManager::layout()
{
QRect mwr( qApp->desktop()->geometry() );
QListIterator<Item> it( docked );
Item *item;
for ( ; (item = it.current()); ++it ) {
QWidget *w = item->w;
if ( !w->isVisible() )
continue;
+
+ QSize sh = w->sizeHint();
switch ( item->p ) {
case ServerInterface::Top:
- w->resize( mwr.width(), w->sizeHint().height() );
- w->move( mwr.topLeft() );
+ w->setGeometry( mwr.left(), mwr.top(),
+ mwr.width(), sh.height() );
mwr.setTop( w->geometry().bottom() + 1 );
break;
case ServerInterface::Bottom:
- w->resize( mwr.width(), w->sizeHint().height() );
- w->move( mwr.left(), mwr.bottom()-w->height()+1 );
+ w->setGeometry( mwr.left(), mwr.bottom() - sh.height(),
+ mwr.width(), sh.height() );
mwr.setBottom( w->geometry().top() - 1 );
break;
case ServerInterface::Left:
- w->resize( w->sizeHint().width(), mwr.height() );
- w->move( mwr.topLeft() );
+ w->setGeometry( mwr.left(), mwr.top(),
+ sh.width(), mwr.height() );
mwr.setLeft( w->geometry().right() + 1 );
break;
case ServerInterface::Right:
- w->resize( w->sizeHint().width(), mwr.height() );
- w->move( mwr.right()-w->width()+1, mwr.top() );
+ w->setGeometry( mwr.right() - sh.width(), mwr.top(),
+ sh.width(), mwr.height() );
mwr.setRight( w->geometry().left() - 1 );
break;
}
}
#ifdef Q_WS_QWS
# if QT_VERSION < 0x030000
QWSServer::setMaxWindowRect( qt_screen->mapToDevice(mwr,
QSize(qt_screen->width(),qt_screen->height())) );
# else
QWSServer::setMaxWindowRect( mwr );
# endif
#endif
}
LayoutManager::Item *LayoutManager::findWidget( const QWidget *w ) const
{
QListIterator<Item> it( docked );
Item *item;
for ( ; (item = it.current()); ++it ) {
if ( item->w == w )
return item;
}
@@ -315,49 +317,49 @@ LayoutManager::Item *LayoutManager::findWidget( const QWidget *w ) const
Return TRUE if the custom launcher requires the server to scan for
documents.
*/
/*!
\enum ServerInterface::DockArea
The DockArea enum type defines the areas where widgets can be docked:
<ul>
<li> \c Top - the top of the screen.
<li> \c Bottom - the Bottom of the screen.
<li> \c Left - the Left of the screen.
<li> \c Right - the Right of the screen.
</ul>
*/
/*!
\fn ServerInterface::dockWidget(QWidget *w, DockArea placement)
Docks a top-level widget \a w on a side of the screen specified by
\a placement. The widget is placed
according to the order that it was docked, its sizeHint() and whether
previously docked widgets are visible. The desktop area available to
QWidget::showMaximized() will exclude any visible docked widgets.
-
+
For example, if a widget is
docked at the bottom of the screen, its sizeHint() will define its
height and it will use the full width of the screen. If a widget is
then docked to the right, its sizeHint() will define its width and
it will be as high as possible without covering
the widget docked at the bottom.
This function is useful for reserving system areas such as taskbars
and input methods that should not be covered by applications.
*/
ServerInterface::~ServerInterface()
{
}
void ServerInterface::dockWidget( QWidget *w, DockArea placement )
{
static LayoutManager *lm = 0;
if ( !lm )
lm = new LayoutManager;
lm->addDocked( w, placement );