diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bd9e6617827818fd043452c08c606f07b78014a0 (patch) | |
tree | 425bb4c3168f9c02f10150f235d2cb998dcc6108 /kompare/libdialogpages/pagebase.cpp | |
download | tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kompare/libdialogpages/pagebase.cpp')
-rw-r--r-- | kompare/libdialogpages/pagebase.cpp | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/kompare/libdialogpages/pagebase.cpp b/kompare/libdialogpages/pagebase.cpp new file mode 100644 index 00000000..de062634 --- /dev/null +++ b/kompare/libdialogpages/pagebase.cpp @@ -0,0 +1,104 @@ +/*************************************************************************** + prefsbase.cpp - description + ------------------- + begin : Sun Mar 4 2001 + copyright : (C) 2001 by Otto Bruggeman + and John Firebaugh + email : otto.bruggeman@home.nl + jfirebaugh@kde.org +****************************************************************************/ + +/*************************************************************************** +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +***************************************************************************/ + +#include <qlayout.h> +#include <qobjectlist.h> + +#include "pagebase.h" + +PageBase::PageBase( QWidget* parent ) : KTabCtl( parent ) +{ + +} + +PageBase::~PageBase() +{ + +} + +/** No descriptions */ +QSize PageBase::sizeHintForWidget( QWidget* widget ) +{ + // + // The size is computed by adding the sizeHint().height() of all + // widget children and taking the width of the widest child and adding + // layout()->margin() and layout()->spacing() + // + + // this code in this method has been ripped out of a file in kbabel + // so copyright goes to the kbabel authors. + + QSize size; + + int numChild = 0; + QObjectList *l = (QObjectList*)(widget->children()); + + for( uint i=0; i < l->count(); i++ ) + { + QObject *o = l->at(i); + if( o->isWidgetType() ) + { + numChild += 1; + QWidget *w=((QWidget*)o); + + QSize s = w->sizeHint(); + if( s.isEmpty() == true ) + { + s = QSize( 50, 100 ); // Default size + } + size.setHeight( size.height() + s.height() ); + if( s.width() > size.width() ) + { + size.setWidth( s.width() ); + } + } + } + + if( numChild > 0 ) + { + size.setHeight( size.height() + widget->layout()->spacing()*(numChild-1) ); + size += QSize( widget->layout()->margin()*2, widget->layout()->margin()*2 + 1 ); + } + else + { + size = QSize( 1, 1 ); + } + + return( size ); +} + +/** No descriptions */ +void PageBase::apply() +{ + +} + +/** No descriptions */ +void PageBase::restore() +{ + +} + +/** No descriptions */ +void PageBase::setDefaults() +{ + +} + +#include "pagebase.moc" |