summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/designer/layout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdevdesigner/designer/layout.cpp')
-rw-r--r--kdevdesigner/designer/layout.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/kdevdesigner/designer/layout.cpp b/kdevdesigner/designer/layout.cpp
index 17592f0f..450f4633 100644
--- a/kdevdesigner/designer/layout.cpp
+++ b/kdevdesigner/designer/layout.cpp
@@ -45,18 +45,18 @@ bool operator<( const TQGuardedPtr<TQWidget> &p1, const TQGuardedPtr<TQWidget> &
/*!
\class Layout tqlayout.h
- \brief Baseclass for tqlayouting widgets in the Designer
+ \brief Baseclass for layouting widgets in the Designer
- Classes derived from this abstract base class are used for tqlayouting
+ Classes derived from this abstract base class are used for layouting
operations in the Designer.
*/
-/*! \a p specifies the tqparent of the tqlayoutBase \a lb. The tqparent
- might be changed in setup(). If the tqlayoutBase is a
- container, the tqparent and the tqlayoutBase are the same. Also they
+/*! \a p specifies the tqparent of the layoutBase \a lb. The tqparent
+ might be changed in setup(). If the layoutBase is a
+ container, the tqparent and the layoutBase are the same. Also they
always have to be a widget known to the designer (e.g. in the case
- of the tabwidget tqparent and tqlayoutBase are the tabwidget and not the
+ of the tabwidget tqparent and layoutBase are the tabwidget and not the
page which actually gets laid out. For actual usage the correct
widget is found later by Layout.)
*/
@@ -65,13 +65,13 @@ Layout::Layout( const TQWidgetList &wl, TQWidget *p, FormWindow *fw, TQWidget *l
: widgets( wl ), tqparent( p ), formWindow( fw ), isBreak( !doSetup ), useSplitter( splitter )
{
widgets.setAutoDelete( FALSE );
- tqlayoutBase = lb;
- if ( !doSetup && tqlayoutBase )
- oldGeometry = tqlayoutBase->tqgeometry();
+ layoutBase = lb;
+ if ( !doSetup && layoutBase )
+ oldGeometry = layoutBase->tqgeometry();
}
/*! The widget list we got in the constructor might contain too much
- widgets (like widgets with different tqparents, already laid out
+ widgets (like widgets with different parents, already laid out
widgets, etc.). Here we set up the list and so the only the "best"
widgets get laid out.
*/
@@ -91,14 +91,14 @@ void Layout::setup()
// childs which has the most entries.
// Widgets which are already laid out are thrown away here too
for ( w = widgets.first(); w; w = widgets.next() ) {
- if ( w->tqparentWidget() && WidgetFactory::tqlayoutType( w->tqparentWidget() ) != WidgetFactory::NoLayout )
+ if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout )
continue;
- if ( lastParent != w->tqparentWidget() ) {
+ if ( lastParent != w->parentWidget() ) {
lastList = 0;
- lastParent = w->tqparentWidget();
+ lastParent = w->parentWidget();
TQValueList<TQWidgetList>::Iterator it = lists.begin();
for ( ; it != lists.end(); ++it ) {
- if ( ( *it ).first()->tqparentWidget() == w->tqparentWidget() )
+ if ( ( *it ).first()->parentWidget() == w->parentWidget() )
lastList = &( *it );
}
if ( !lastList ) {
@@ -123,9 +123,9 @@ void Layout::setup()
// best list has only one entry and we do not tqlayout a container,
// we leave here.
if ( !lastList || ( lastList->count() < 2 &&
- ( !tqlayoutBase ||
- ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(tqlayoutBase) ) ) ) &&
- tqlayoutBase != formWindow->mainContainer() ) )
+ ( !layoutBase ||
+ ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(layoutBase) ) ) ) &&
+ layoutBase != formWindow->mainContainer() ) )
) ) {
widgets.clear();
startPoint = TQPoint( 0, 0 );
@@ -136,7 +136,7 @@ void Layout::setup()
// to tqlayout
widgets = *lastList;
// Also use the only correct tqparent later, so store it
- tqparent = WidgetFactory::widgetOfContainer( widgets.first()->tqparentWidget() );
+ tqparent = WidgetFactory::widgetOfContainer( widgets.first()->parentWidget() );
// Now calculate the position where the tqlayout-meta-widget should
// be placed and connect to widgetDestroyed() signals of the
// widgets to get informed if one gets deleted to be able to
@@ -166,17 +166,17 @@ bool Layout::prepareLayout( bool &needMove, bool &needRetqparent )
return FALSE;
for ( TQWidget *w = widgets.first(); w; w = widgets.next() )
w->raise();
- needMove = !tqlayoutBase;
- needRetqparent = needMove || ::tqqt_cast<TQLayoutWidget*>(tqlayoutBase) || ::tqqt_cast<TQSplitter*>(tqlayoutBase);
- if ( !tqlayoutBase ) {
+ needMove = !layoutBase;
+ needRetqparent = needMove || ::tqqt_cast<TQLayoutWidget*>(layoutBase) || ::tqqt_cast<TQSplitter*>(layoutBase);
+ if ( !layoutBase ) {
if ( !useSplitter )
- tqlayoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQLAYOUTWIDGET_OBJECT_NAME_STRING ),
+ layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQLAYOUTWIDGET_OBJECT_NAME_STRING ),
WidgetFactory::containerOfWidget( tqparent ) );
else
- tqlayoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQSPLITTER_OBJECT_NAME_STRING ),
+ layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQSPLITTER_OBJECT_NAME_STRING ),
WidgetFactory::containerOfWidget( tqparent ) );
} else {
- WidgetFactory::deleteLayout( tqlayoutBase );
+ WidgetFactory::deleteLayout( layoutBase );
}
return TRUE;
@@ -185,21 +185,21 @@ bool Layout::prepareLayout( bool &needMove, bool &needRetqparent )
void Layout::finishLayout( bool needMove, TQLayout *tqlayout )
{
if ( needMove )
- tqlayoutBase->move( startPoint );
- TQRect g( TQRect( tqlayoutBase->pos(), tqlayoutBase->size() ) );
- if ( WidgetFactory::tqlayoutType( tqlayoutBase->tqparentWidget() ) == WidgetFactory::NoLayout && !isBreak )
- tqlayoutBase->adjustSize();
+ layoutBase->move( startPoint );
+ TQRect g( TQRect( layoutBase->pos(), layoutBase->size() ) );
+ if ( WidgetFactory::layoutType( layoutBase->parentWidget() ) == WidgetFactory::NoLayout && !isBreak )
+ layoutBase->adjustSize();
else if ( isBreak )
- tqlayoutBase->setGeometry( oldGeometry );
+ layoutBase->setGeometry( oldGeometry );
oldGeometry = g;
- tqlayoutBase->show();
+ layoutBase->show();
tqlayout->activate();
- formWindow->insertWidget( tqlayoutBase );
- formWindow->selectWidget( TQT_TQOBJECT(tqlayoutBase) );
- TQString n = tqlayoutBase->name();
+ formWindow->insertWidget( layoutBase );
+ formWindow->selectWidget( TQT_TQOBJECT(layoutBase) );
+ TQString n = layoutBase->name();
if ( n.tqfind( "qt_dead_widget_" ) != -1 ) {
n.remove( 0, TQString( "qt_dead_widget_" ).length() );
- tqlayoutBase->setName( n );
+ layoutBase->setName( n );
}
}
@@ -214,15 +214,15 @@ void Layout::undoLayout()
it.key()->reparent( WidgetFactory::containerOfWidget( tqparent ), 0, ( *it ).topLeft(), it.key()->isVisibleTo( formWindow ) );
it.key()->resize( ( *it ).size() );
}
- formWindow->selectWidget( TQT_TQOBJECT(tqlayoutBase), FALSE );
- WidgetFactory::deleteLayout( tqlayoutBase );
- if ( tqparent != tqlayoutBase && !::tqqt_cast<TQMainWindow*>(tqlayoutBase) ) {
- tqlayoutBase->hide();
- TQString n = tqlayoutBase->name();
+ formWindow->selectWidget( TQT_TQOBJECT(layoutBase), FALSE );
+ WidgetFactory::deleteLayout( layoutBase );
+ if ( tqparent != layoutBase && !::tqqt_cast<TQMainWindow*>(layoutBase) ) {
+ layoutBase->hide();
+ TQString n = layoutBase->name();
n.prepend( "qt_dead_widget_" );
- tqlayoutBase->setName( n );
+ layoutBase->setName( n );
} else {
- tqlayoutBase->setGeometry( oldGeometry );
+ layoutBase->setGeometry( oldGeometry );
}
if ( widgets.first() )
formWindow->selectWidget( TQT_TQOBJECT(widgets.first()) );
@@ -238,33 +238,33 @@ void Layout::breakLayout()
for ( w = widgets.first(); w; w = widgets.next() )
rects.insert( w, w->tqgeometry() );
}
- WidgetFactory::deleteLayout( tqlayoutBase );
- bool needRetqparent = qstrcmp( tqlayoutBase->className(), TQLAYOUTWIDGET_OBJECT_NAME_STRING ) == 0 ||
- qstrcmp( tqlayoutBase->className(), TQSPLITTER_OBJECT_NAME_STRING ) == 0 ||
- ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(tqlayoutBase) ) ) ) &&
- tqlayoutBase != formWindow->mainContainer() );
- bool needResize = qstrcmp( tqlayoutBase->className(), TQSPLITTER_OBJECT_NAME_STRING ) == 0;
+ WidgetFactory::deleteLayout( layoutBase );
+ bool needRetqparent = qstrcmp( layoutBase->className(), TQLAYOUTWIDGET_OBJECT_NAME_STRING ) == 0 ||
+ qstrcmp( layoutBase->className(), TQSPLITTER_OBJECT_NAME_STRING ) == 0 ||
+ ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(layoutBase) ) ) ) &&
+ layoutBase != formWindow->mainContainer() );
+ bool needResize = qstrcmp( layoutBase->className(), TQSPLITTER_OBJECT_NAME_STRING ) == 0;
bool add = geometries.isEmpty();
for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) {
if ( needRetqparent )
- w->reparent( tqlayoutBase->tqparentWidget(), 0,
- tqlayoutBase->pos() + w->pos(), TRUE );
+ w->reparent( layoutBase->parentWidget(), 0,
+ layoutBase->pos() + w->pos(), TRUE );
if ( needResize ) {
TQMap<TQWidget*, TQRect>::Iterator it = rects.tqfind( w );
if ( it != rects.end() )
- w->setGeometry( TQRect( tqlayoutBase->pos() + (*it).topLeft(), (*it).size() ) );
+ w->setGeometry( TQRect( layoutBase->pos() + (*it).topLeft(), (*it).size() ) );
}
if ( add )
geometries.insert( w, TQRect( w->pos(), w->size() ) );
}
if ( needRetqparent ) {
- tqlayoutBase->hide();
- tqparent = tqlayoutBase->tqparentWidget();
- TQString n = tqlayoutBase->name();
+ layoutBase->hide();
+ tqparent = layoutBase->parentWidget();
+ TQString n = layoutBase->name();
n.prepend( "qt_dead_widget_" );
- tqlayoutBase->setName( n );
+ layoutBase->setName( n );
} else {
- tqparent = tqlayoutBase;
+ tqparent = layoutBase;
}
if ( widgets.first() && widgets.first()->isVisibleTo( formWindow ) )
formWindow->selectWidget( TQT_TQOBJECT(widgets.first()) );
@@ -311,11 +311,11 @@ void HorizontalLayout::doLayout()
if ( !prepareLayout( needMove, needRetqparent ) )
return;
- TQHBoxLayout *tqlayout = (TQHBoxLayout*)WidgetFactory::createLayout( tqlayoutBase, 0, WidgetFactory::HBox );
+ TQHBoxLayout *tqlayout = (TQHBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::HBox );
for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) {
- if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(tqlayoutBase) )
- w->reparent( tqlayoutBase, 0, TQPoint( 0, 0 ), FALSE );
+ if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(layoutBase) )
+ w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE );
if ( !useSplitter ) {
if ( qstrcmp( w->className(), "Spacer" ) == 0 )
tqlayout->addWidget( w, 0, ( (Spacer*)w )->tqalignment() );
@@ -327,8 +327,8 @@ void HorizontalLayout::doLayout()
w->show();
}
- if ( ::tqqt_cast<TQSplitter*>(tqlayoutBase) )
- ( (TQSplitter*)tqlayoutBase )->setOrientation( Qt::Horizontal );
+ if ( ::tqqt_cast<TQSplitter*>(layoutBase) )
+ ( (TQSplitter*)layoutBase )->setOrientation( Qt::Horizontal );
finishLayout( needMove, tqlayout );
}
@@ -375,11 +375,11 @@ void VerticalLayout::doLayout()
if ( !prepareLayout( needMove, needRetqparent ) )
return;
- TQVBoxLayout *tqlayout = (TQVBoxLayout*)WidgetFactory::createLayout( tqlayoutBase, 0, WidgetFactory::VBox );
+ TQVBoxLayout *tqlayout = (TQVBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::VBox );
for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) {
- if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(tqlayoutBase) )
- w->reparent( tqlayoutBase, 0, TQPoint( 0, 0 ), FALSE );
+ if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(layoutBase) )
+ w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE );
if ( !useSplitter ) {
if ( qstrcmp( w->className(), "Spacer" ) == 0 )
tqlayout->addWidget( w, 0, ( (Spacer*)w )->tqalignment() );
@@ -391,8 +391,8 @@ void VerticalLayout::doLayout()
w->show();
}
- if ( ::tqqt_cast<TQSplitter*>(tqlayoutBase) )
- ( (TQSplitter*)tqlayoutBase )->setOrientation( Qt::Vertical );
+ if ( ::tqqt_cast<TQSplitter*>(layoutBase) )
+ ( (TQSplitter*)layoutBase )->setOrientation( Qt::Vertical );
finishLayout( needMove, tqlayout );
}
@@ -747,7 +747,7 @@ void GridLayout::doLayout()
if ( !prepareLayout( needMove, needRetqparent ) )
return;
- QDesignerGridLayout *tqlayout = (QDesignerGridLayout*)WidgetFactory::createLayout( tqlayoutBase, 0, WidgetFactory::Grid );
+ QDesignerGridLayout *tqlayout = (QDesignerGridLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::Grid );
if ( !grid )
buildGrid();
@@ -756,8 +756,8 @@ void GridLayout::doLayout()
int r, c, rs, cs;
for ( w = widgets.first(); w; w = widgets.next() ) {
if ( grid->locateWidget( w, r, c, rs, cs) ) {
- if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(tqlayoutBase) )
- w->reparent( tqlayoutBase, 0, TQPoint( 0, 0 ), FALSE );
+ if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(layoutBase) )
+ w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE );
if ( rs * cs == 1 ) {
tqlayout->addWidget( w, r, c, ::tqqt_cast<Spacer*>(w) ? ( (Spacer*)w )->tqalignment() : 0 );
} else {
@@ -908,7 +908,7 @@ void Spacer::paintEvent( TQPaintEvent * )
void Spacer::resizeEvent( TQResizeEvent* e)
{
TQWidget::resizeEvent( e );
- if ( !tqparentWidget() || WidgetFactory::tqlayoutType( tqparentWidget() ) == WidgetFactory::NoLayout )
+ if ( !parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout )
sh = size();
}
@@ -974,7 +974,7 @@ TQSize Spacer::tqsizeHint() const
void Spacer::setSizeHint( const TQSize &s )
{
sh = s;
- if ( !tqparentWidget() || WidgetFactory::tqlayoutType( tqparentWidget() ) == WidgetFactory::NoLayout )
+ if ( !parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout )
resize( tqsizeHint() );
updateGeometry();
}
@@ -994,7 +994,7 @@ void Spacer::setOrientation( Qt::Orientation o )
setSizeType( st );
if ( interactive ) {
sh = TQSize( sh.height(), sh.width() );
- if (!tqparentWidget() || WidgetFactory::tqlayoutType( tqparentWidget() ) == WidgetFactory::NoLayout )
+ if (!parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout )
resize( height(), width() );
}
updateMask();