diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
commit | 48d4a26399959121f33d2bc3bfe51c7827b654fc (patch) | |
tree | 5ae5e6e00d3ba330b7b8be9bc097154b6bc739e8 /kdevdesigner/designer/layout.cpp | |
parent | 7e701ace6592d09e1f2c0cf28c7d6d872d78f4f5 (diff) | |
download | tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.tar.gz tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.zip |
TQt4 port kdevelop
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1236710 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdevdesigner/designer/layout.cpp')
-rw-r--r-- | kdevdesigner/designer/layout.cpp | 308 |
1 files changed, 154 insertions, 154 deletions
diff --git a/kdevdesigner/designer/layout.cpp b/kdevdesigner/designer/layout.cpp index 9757d5d9..83db3b7d 100644 --- a/kdevdesigner/designer/layout.cpp +++ b/kdevdesigner/designer/layout.cpp @@ -1,15 +1,15 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** -** This file is part of Qt Designer. +** This file is part of TQt Designer. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** -** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition -** licenses may use this file in accordance with the Qt Commercial License +** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition +** licenses may use this file in accordance with the TQt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -17,7 +17,7 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for -** information about Qt Commercial License Agreements. +** information about TQt Commercial License Agreements. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. @@ -25,7 +25,7 @@ **********************************************************************/ #include "formwindow.h" -#include "layout.h" +#include "tqlayout.h" #include <widgetdatabase.h> #include "widgetfactory.h" @@ -44,34 +44,34 @@ bool operator<( const TQGuardedPtr<TQWidget> &p1, const TQGuardedPtr<TQWidget> & } /*! - \class Layout layout.h - \brief Baseclass for layouting widgets in the Designer + \class Layout tqlayout.h + \brief Baseclass for tqlayouting widgets in the Designer - Classes derived from this abstract base class are used for layouting + Classes derived from this abstract base class are used for tqlayouting operations in the Designer. */ -/*! \a p specifies the parent of the layoutBase \a lb. The parent - might be changed in setup(). If the layoutBase is a - container, the parent and the layoutBase are the same. Also they +/*! \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 always have to be a widget known to the designer (e.g. in the case - of the tabwidget parent and layoutBase are the tabwidget and not the + of the tabwidget tqparent and tqlayoutBase are the tabwidget and not the page which actually gets laid out. For actual usage the correct widget is found later by Layout.) */ Layout::Layout( const TQWidgetList &wl, TQWidget *p, FormWindow *fw, TQWidget *lb, bool doSetup, bool splitter ) - : widgets( wl ), parent( p ), formWindow( fw ), isBreak( !doSetup ), useSplitter( splitter ) + : widgets( wl ), tqparent( p ), formWindow( fw ), isBreak( !doSetup ), useSplitter( splitter ) { widgets.setAutoDelete( FALSE ); - layoutBase = lb; - if ( !doSetup && layoutBase ) - oldGeometry = layoutBase->geometry(); + tqlayoutBase = lb; + if ( !doSetup && tqlayoutBase ) + oldGeometry = tqlayoutBase->tqgeometry(); } /*! The widget list we got in the constructor might contain too much - widgets (like widgets with different parents, already laid out + widgets (like widgets with different tqparents, already laid out widgets, etc.). Here we set up the list and so the only the "best" widgets get laid out. */ @@ -85,20 +85,20 @@ void Layout::setup() TQWidget *w = 0; // Go through all widgets of the list we got. As we can only - // layout widgets which have the same parent, we first do some - // sorting which means create a list for each parent containing + // tqlayout widgets which have the same tqparent, we first do some + // sorting which means create a list for each tqparent containing // its child here. After that we keep working on the list of // 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->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) + if ( w->tqparentWidget() && WidgetFactory::tqlayoutType( w->tqparentWidget() ) != WidgetFactory::NoLayout ) continue; - if ( lastParent != w->parentWidget() ) { + if ( lastParent != w->tqparentWidget() ) { lastList = 0; - lastParent = w->parentWidget(); + lastParent = w->tqparentWidget(); TQValueList<TQWidgetList>::Iterator it = lists.begin(); for ( ; it != lists.end(); ++it ) { - if ( ( *it ).first()->parentWidget() == w->parentWidget() ) + if ( ( *it ).first()->tqparentWidget() == w->tqparentWidget() ) lastList = &( *it ); } if ( !lastList ) { @@ -120,12 +120,12 @@ void Layout::setup() } // If we found no list (because no widget did fit at all) or the - // best list has only one entry and we do not layout a container, + // best list has only one entry and we do not tqlayout a container, // we leave here. if ( !lastList || ( lastList->count() < 2 && - ( !layoutBase || - ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) && - layoutBase != formWindow->mainContainer() ) ) + ( !tqlayoutBase || + ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(tqlayoutBase) ) ) ) && + tqlayoutBase != formWindow->mainContainer() ) ) ) ) { widgets.clear(); startPoint = TQPoint( 0, 0 ); @@ -133,23 +133,23 @@ void Layout::setup() } // Now we have a new and clean widget list, which makes sense - // to layout + // to tqlayout widgets = *lastList; - // Also use the only correct parent later, so store it - parent = WidgetFactory::widgetOfContainer( widgets.first()->parentWidget() ); - // Now calculate the position where the layout-meta-widget should + // Also use the only correct tqparent later, so store it + tqparent = WidgetFactory::widgetOfContainer( widgets.first()->tqparentWidget() ); + // 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 // handle that and do not crash in this case for ( w = widgets.first(); w; w = widgets.next() ) { connect( w, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( widgetDestroyed() ) ); - startPoint = TQPoint( QMIN( startPoint.x(), w->x() ), - QMIN( startPoint.y(), w->y() ) ); + startPoint = TQPoint( TQMIN( startPoint.x(), w->x() ), + TQMIN( startPoint.y(), w->y() ) ); geometries.insert( w, TQRect( w->pos(), w->size() ) ); // Change the Z-order, as saving/loading uses the Z-order for // writing/creating widgets and this has to be the same as in - // the layout. Else saving + loading will give different results + // the tqlayout. Else saving + loading will give different results w->raise(); } } @@ -160,46 +160,46 @@ void Layout::widgetDestroyed() widgets.removeRef( (TQWidget*)sender() ); } -bool Layout::prepareLayout( bool &needMove, bool &needReparent ) +bool Layout::prepareLayout( bool &needMove, bool &needRetqparent ) { if ( !widgets.count() ) return FALSE; for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) w->raise(); - needMove = !layoutBase; - needReparent = needMove || ::qt_cast<QLayoutWidget*>(layoutBase) || ::qt_cast<TQSplitter*>(layoutBase); - if ( !layoutBase ) { + needMove = !tqlayoutBase; + needRetqparent = needMove || ::tqqt_cast<TQLayoutWidget*>(tqlayoutBase) || ::tqqt_cast<TQSplitter*>(tqlayoutBase); + if ( !tqlayoutBase ) { if ( !useSplitter ) - layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQLAYOUTWIDGET_OBJECT_NAME_STRING ), - WidgetFactory::containerOfWidget( parent ) ); + tqlayoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQLAYOUTWIDGET_OBJECT_NAME_STRING ), + WidgetFactory::containerOfWidget( tqparent ) ); else - layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQSPLITTER_OBJECT_NAME_STRING ), - WidgetFactory::containerOfWidget( parent ) ); + tqlayoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQSPLITTER_OBJECT_NAME_STRING ), + WidgetFactory::containerOfWidget( tqparent ) ); } else { - WidgetFactory::deleteLayout( layoutBase ); + WidgetFactory::deleteLayout( tqlayoutBase ); } return TRUE; } -void Layout::finishLayout( bool needMove, TQLayout *layout ) +void Layout::finishLayout( bool needMove, TQLayout *tqlayout ) { if ( needMove ) - layoutBase->move( startPoint ); - TQRect g( TQRect( layoutBase->pos(), layoutBase->size() ) ); - if ( WidgetFactory::layoutType( layoutBase->parentWidget() ) == WidgetFactory::NoLayout && !isBreak ) - layoutBase->adjustSize(); + tqlayoutBase->move( startPoint ); + TQRect g( TQRect( tqlayoutBase->pos(), tqlayoutBase->size() ) ); + if ( WidgetFactory::tqlayoutType( tqlayoutBase->tqparentWidget() ) == WidgetFactory::NoLayout && !isBreak ) + tqlayoutBase->adjustSize(); else if ( isBreak ) - layoutBase->setGeometry( oldGeometry ); + tqlayoutBase->setGeometry( oldGeometry ); oldGeometry = g; - layoutBase->show(); - layout->activate(); - formWindow->insertWidget( layoutBase ); - formWindow->selectWidget( layoutBase ); - TQString n = layoutBase->name(); - if ( n.find( "qt_dead_widget_" ) != -1 ) { + tqlayoutBase->show(); + tqlayout->activate(); + formWindow->insertWidget( tqlayoutBase ); + formWindow->selectWidget( TQT_TQOBJECT(tqlayoutBase) ); + TQString n = tqlayoutBase->name(); + if ( n.tqfind( "qt_dead_widget_" ) != -1 ) { n.remove( 0, TQString( "qt_dead_widget_" ).length() ); - layoutBase->setName( n ); + tqlayoutBase->setName( n ); } } @@ -211,23 +211,23 @@ void Layout::undoLayout() for ( ; it != geometries.end(); ++it ) { if ( !it.key() ) continue; - it.key()->reparent( WidgetFactory::containerOfWidget( parent ), 0, ( *it ).topLeft(), it.key()->isVisibleTo( formWindow ) ); + it.key()->reparent( WidgetFactory::containerOfWidget( tqparent ), 0, ( *it ).topLeft(), it.key()->isVisibleTo( formWindow ) ); it.key()->resize( ( *it ).size() ); } - formWindow->selectWidget( layoutBase, FALSE ); - WidgetFactory::deleteLayout( layoutBase ); - if ( parent != layoutBase && !::qt_cast<TQMainWindow*>(layoutBase) ) { - layoutBase->hide(); - TQString n = layoutBase->name(); + formWindow->selectWidget( TQT_TQOBJECT(tqlayoutBase), FALSE ); + WidgetFactory::deleteLayout( tqlayoutBase ); + if ( tqparent != tqlayoutBase && !::tqqt_cast<TQMainWindow*>(tqlayoutBase) ) { + tqlayoutBase->hide(); + TQString n = tqlayoutBase->name(); n.prepend( "qt_dead_widget_" ); - layoutBase->setName( n ); + tqlayoutBase->setName( n ); } else { - layoutBase->setGeometry( oldGeometry ); + tqlayoutBase->setGeometry( oldGeometry ); } if ( widgets.first() ) - formWindow->selectWidget( widgets.first() ); + formWindow->selectWidget( TQT_TQOBJECT(widgets.first()) ); else - formWindow->selectWidget( formWindow ); + formWindow->selectWidget( TQT_TQOBJECT(formWindow) ); } void Layout::breakLayout() @@ -236,43 +236,43 @@ void Layout::breakLayout() if ( !widgets.isEmpty() ) { TQWidget *w; for ( w = widgets.first(); w; w = widgets.next() ) - rects.insert( w, w->geometry() ); - } - WidgetFactory::deleteLayout( layoutBase ); - bool needReparent = qstrcmp( layoutBase->className(), TQLAYOUTWIDGET_OBJECT_NAME_STRING ) == 0 || - qstrcmp( layoutBase->className(), TQSPLITTER_OBJECT_NAME_STRING ) == 0 || - ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) && - layoutBase != formWindow->mainContainer() ); - bool needResize = qstrcmp( layoutBase->className(), TQSPLITTER_OBJECT_NAME_STRING ) == 0; + 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; bool add = geometries.isEmpty(); for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) { - if ( needReparent ) - w->reparent( layoutBase->parentWidget(), 0, - layoutBase->pos() + w->pos(), TRUE ); + if ( needRetqparent ) + w->reparent( tqlayoutBase->tqparentWidget(), 0, + tqlayoutBase->pos() + w->pos(), TRUE ); if ( needResize ) { - TQMap<TQWidget*, TQRect>::Iterator it = rects.find( w ); + TQMap<TQWidget*, TQRect>::Iterator it = rects.tqfind( w ); if ( it != rects.end() ) - w->setGeometry( TQRect( layoutBase->pos() + (*it).topLeft(), (*it).size() ) ); + w->setGeometry( TQRect( tqlayoutBase->pos() + (*it).topLeft(), (*it).size() ) ); } if ( add ) geometries.insert( w, TQRect( w->pos(), w->size() ) ); } - if ( needReparent ) { - layoutBase->hide(); - parent = layoutBase->parentWidget(); - TQString n = layoutBase->name(); + if ( needRetqparent ) { + tqlayoutBase->hide(); + tqparent = tqlayoutBase->tqparentWidget(); + TQString n = tqlayoutBase->name(); n.prepend( "qt_dead_widget_" ); - layoutBase->setName( n ); + tqlayoutBase->setName( n ); } else { - parent = layoutBase; + tqparent = tqlayoutBase; } if ( widgets.first() && widgets.first()->isVisibleTo( formWindow ) ) - formWindow->selectWidget( widgets.first() ); + formWindow->selectWidget( TQT_TQOBJECT(widgets.first()) ); else - formWindow->selectWidget( formWindow ); + formWindow->selectWidget( TQT_TQOBJECT(formWindow) ); } -class HorizontalLayoutList : public QWidgetList +class HorizontalLayoutList : public TQWidgetList { public: HorizontalLayoutList( const TQWidgetList &l ) @@ -307,36 +307,36 @@ void HorizontalLayout::setup() void HorizontalLayout::doLayout() { - bool needMove, needReparent; - if ( !prepareLayout( needMove, needReparent ) ) + bool needMove, needRetqparent; + if ( !prepareLayout( needMove, needRetqparent ) ) return; - TQHBoxLayout *layout = (TQHBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::HBox ); + TQHBoxLayout *tqlayout = (TQHBoxLayout*)WidgetFactory::createLayout( tqlayoutBase, 0, WidgetFactory::HBox ); for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) { - if ( needReparent && w->parent() != layoutBase ) - w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE ); + if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(tqlayoutBase) ) + w->reparent( tqlayoutBase, 0, TQPoint( 0, 0 ), FALSE ); if ( !useSplitter ) { if ( qstrcmp( w->className(), "Spacer" ) == 0 ) - layout->addWidget( w, 0, ( (Spacer*)w )->alignment() ); + tqlayout->addWidget( w, 0, ( (Spacer*)w )->tqalignment() ); else - layout->addWidget( w ); - if ( ::qt_cast<QLayoutWidget*>(w) ) - ( (QLayoutWidget*)w )->updateSizePolicy(); + tqlayout->addWidget( w ); + if ( ::tqqt_cast<TQLayoutWidget*>(w) ) + ( (TQLayoutWidget*)w )->updateSizePolicy(); } w->show(); } - if ( ::qt_cast<TQSplitter*>(layoutBase) ) - ( (TQSplitter*)layoutBase )->setOrientation( Qt::Horizontal ); + if ( ::tqqt_cast<TQSplitter*>(tqlayoutBase) ) + ( (TQSplitter*)tqlayoutBase )->setOrientation( Qt::Horizontal ); - finishLayout( needMove, layout ); + finishLayout( needMove, tqlayout ); } -class VerticalLayoutList : public QWidgetList +class VerticalLayoutList : public TQWidgetList { public: VerticalLayoutList( const TQWidgetList &l ) @@ -371,30 +371,30 @@ void VerticalLayout::setup() void VerticalLayout::doLayout() { - bool needMove, needReparent; - if ( !prepareLayout( needMove, needReparent ) ) + bool needMove, needRetqparent; + if ( !prepareLayout( needMove, needRetqparent ) ) return; - TQVBoxLayout *layout = (TQVBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::VBox ); + TQVBoxLayout *tqlayout = (TQVBoxLayout*)WidgetFactory::createLayout( tqlayoutBase, 0, WidgetFactory::VBox ); for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) { - if ( needReparent && w->parent() != layoutBase ) - w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE ); + if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(tqlayoutBase) ) + w->reparent( tqlayoutBase, 0, TQPoint( 0, 0 ), FALSE ); if ( !useSplitter ) { if ( qstrcmp( w->className(), "Spacer" ) == 0 ) - layout->addWidget( w, 0, ( (Spacer*)w )->alignment() ); + tqlayout->addWidget( w, 0, ( (Spacer*)w )->tqalignment() ); else - layout->addWidget( w ); - if ( ::qt_cast<QLayoutWidget*>(w) ) - ( (QLayoutWidget*)w )->updateSizePolicy(); + tqlayout->addWidget( w ); + if ( ::tqqt_cast<TQLayoutWidget*>(w) ) + ( (TQLayoutWidget*)w )->updateSizePolicy(); } w->show(); } - if ( ::qt_cast<TQSplitter*>(layoutBase) ) - ( (TQSplitter*)layoutBase )->setOrientation( Qt::Vertical ); + if ( ::tqqt_cast<TQSplitter*>(tqlayoutBase) ) + ( (TQSplitter*)tqlayoutBase )->setOrientation( Qt::Vertical ); - finishLayout( needMove, layout ); + finishLayout( needMove, tqlayout ); } @@ -743,11 +743,11 @@ GridLayout::~GridLayout() void GridLayout::doLayout() { - bool needMove, needReparent; - if ( !prepareLayout( needMove, needReparent ) ) + bool needMove, needRetqparent; + if ( !prepareLayout( needMove, needRetqparent ) ) return; - QDesignerGridLayout *layout = (QDesignerGridLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::Grid ); + TQDesignerGridLayout *tqlayout = (TQDesignerGridLayout*)WidgetFactory::createLayout( tqlayoutBase, 0, WidgetFactory::Grid ); if ( !grid ) buildGrid(); @@ -756,21 +756,21 @@ 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 ( needReparent && w->parent() != layoutBase ) - w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE ); + if ( needRetqparent && TQT_BASE_OBJECT(w->tqparent()) != TQT_BASE_OBJECT(tqlayoutBase) ) + w->reparent( tqlayoutBase, 0, TQPoint( 0, 0 ), FALSE ); if ( rs * cs == 1 ) { - layout->addWidget( w, r, c, ::qt_cast<Spacer*>(w) ? ( (Spacer*)w )->alignment() : 0 ); + tqlayout->addWidget( w, r, c, ::tqqt_cast<Spacer*>(w) ? ( (Spacer*)w )->tqalignment() : 0 ); } else { - layout->addMultiCellWidget( w, r, r+rs-1, c, c+cs-1, ::qt_cast<Spacer*>(w) ? ( (Spacer*)w )->alignment() : 0 ); + tqlayout->addMultiCellWidget( w, r, r+rs-1, c, c+cs-1, ::tqqt_cast<Spacer*>(w) ? ( (Spacer*)w )->tqalignment() : 0 ); } - if ( ::qt_cast<QLayoutWidget*>(w) ) - ( (QLayoutWidget*)w )->updateSizePolicy(); + if ( ::tqqt_cast<TQLayoutWidget*>(w) ) + ( (TQLayoutWidget*)w )->updateSizePolicy(); w->show(); } else { - qWarning("ooops, widget '%s' does not fit in layout", w->name() ); + qWarning("ooops, widget '%s' does not fit in tqlayout", w->name() ); } } - finishLayout( needMove, layout ); + finishLayout( needMove, tqlayout ); } void GridLayout::setup() @@ -787,7 +787,7 @@ void GridLayout::buildGrid() // Pixel to cell conversion: // By keeping a list of start'n'stop values (x & y) for each widget, // it is possible to create a very small grid of cells to represent - // the widget layout. + // the widget tqlayout. // ----------------------------------------------------------------- // We need a list of both start and stop values for x- & y-axis @@ -798,7 +798,7 @@ void GridLayout::buildGrid() int index = 0; TQWidget* w = 0; for ( w = widgets.first(); w; w = widgets.next() ) { - TQRect widgetPos = w->geometry(); + TQRect widgetPos = w->tqgeometry(); x[index] = widgetPos.left(); x[index+1] = widgetPos.right(); y[index] = widgetPos.top(); @@ -829,7 +829,7 @@ void GridLayout::buildGrid() current++; } - // Create the smallest grid possible to represent the current layout + // Create the smallest grid possible to represent the current tqlayout // Since no widget will be placed in the last row and column, we'll // skip them to increase speed even further delete grid; @@ -837,7 +837,7 @@ void GridLayout::buildGrid() // Mark the cells in the grid that contains a widget for ( w = widgets.first(); w; w = widgets.next() ) { - TQRect c(0,0,0,0), widgetPos = w->geometry(); + TQRect c(0,0,0,0), widgetPos = w->tqgeometry(); // From left til right (not including) for (uint cw=0; cw<x.size(); cw++) { if ( x[cw] == widgetPos.left() ) @@ -863,9 +863,9 @@ void GridLayout::buildGrid() -Spacer::Spacer( TQWidget *parent, const char *name ) - : TQWidget( parent, name, WMouseNoMask ), - orient( Vertical ), interactive(TRUE), sh( TQSize(20,20) ) +Spacer::Spacer( TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name, WMouseNoMask ), + orient(Qt::Vertical ), interactive(TRUE), sh( TQSize(20,20) ) { setSizeType( Expanding ); setAutoMask( TRUE ); @@ -874,11 +874,11 @@ Spacer::Spacer( TQWidget *parent, const char *name ) void Spacer::paintEvent( TQPaintEvent * ) { TQPainter p( this ); - p.setPen( Qt::blue ); + p.setPen( TQt::blue ); - if ( orient == Horizontal ) { + if ( orient ==Qt::Horizontal ) { const int dist = 3; - const int amplitude = QMIN( 3, height() / 3 ); + const int amplitude = TQMIN( 3, height() / 3 ); const int base = height() / 2; int i = 0; p.setPen( white ); @@ -891,7 +891,7 @@ void Spacer::paintEvent( TQPaintEvent * ) p.drawLine( width() - 1, 0, width() - 1, height()); } else { const int dist = 3; - const int amplitude = QMIN( 3, width() / 3 ); + const int amplitude = TQMIN( 3, width() / 3 ); const int base = width() / 2; int i = 0; p.setPen( white ); @@ -908,20 +908,20 @@ void Spacer::paintEvent( TQPaintEvent * ) void Spacer::resizeEvent( TQResizeEvent* e) { TQWidget::resizeEvent( e ); - if ( !parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout ) + if ( !tqparentWidget() || WidgetFactory::tqlayoutType( tqparentWidget() ) == WidgetFactory::NoLayout ) sh = size(); } void Spacer::updateMask() { TQRegion r( rect() ); - if ( orient == Horizontal ) { - const int amplitude = QMIN( 3, height() / 3 ); + if ( orient ==Qt::Horizontal ) { + const int amplitude = TQMIN( 3, height() / 3 ); const int base = height() / 2; r = r.subtract( TQRect(1, 0, width() - 2, base - amplitude ) ); r = r.subtract( TQRect(1, base + amplitude, width() - 2, height() - base - amplitude ) ); } else { - const int amplitude = QMIN( 3, width() / 3 ); + const int amplitude = TQMIN( 3, width() / 3 ); const int base = width() / 2; r = r.subtract( TQRect(0, 1, base - amplitude, height() - 2 ) ); r = r.subtract( TQRect( base + amplitude, 1, width() - base - amplitude, height() - 2 ) ); @@ -932,40 +932,40 @@ void Spacer::updateMask() void Spacer::setSizeType( SizeType t ) { TQSizePolicy sizeP; - if ( orient == Vertical ) + if ( orient ==Qt::Vertical ) sizeP = TQSizePolicy( TQSizePolicy::Minimum, (TQSizePolicy::SizeType)t ); else sizeP = TQSizePolicy( (TQSizePolicy::SizeType)t, TQSizePolicy::Minimum ); - setSizePolicy( sizeP ); + tqsetSizePolicy( sizeP ); } Spacer::SizeType Spacer::sizeType() const { - if ( orient == Vertical ) - return (SizeType)sizePolicy().verData(); - return (SizeType)sizePolicy().horData(); + if ( orient ==Qt::Vertical ) + return (SizeType)tqsizePolicy().verData(); + return (SizeType)tqsizePolicy().horData(); } -int Spacer::alignment() const +int Spacer::tqalignment() const { - if ( orient == Vertical ) + if ( orient ==Qt::Vertical ) return AlignHCenter; return AlignVCenter; } -TQSize Spacer::minimumSize() const +TQSize Spacer::tqminimumSize() const { TQSize s = TQSize( 20,20 ); if ( sizeType() == Expanding ) - if ( orient == Vertical ) + if ( orient ==Qt::Vertical ) s.rheight() = 0; else s.rwidth() = 0; return s; } -TQSize Spacer::sizeHint() const +TQSize Spacer::tqsizeHint() const { return sh; } @@ -974,8 +974,8 @@ TQSize Spacer::sizeHint() const void Spacer::setSizeHint( const TQSize &s ) { sh = s; - if ( !parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout ) - resize( sizeHint() ); + if ( !tqparentWidget() || WidgetFactory::tqlayoutType( tqparentWidget() ) == 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 (!parentWidget() || WidgetFactory::layoutType( parentWidget() ) == WidgetFactory::NoLayout ) + if (!tqparentWidget() || WidgetFactory::tqlayoutType( tqparentWidget() ) == WidgetFactory::NoLayout ) resize( height(), width() ); } updateMask(); @@ -1003,13 +1003,13 @@ void Spacer::setOrientation( Qt::Orientation o ) } -void QDesignerGridLayout::addWidget( TQWidget *w, int row, int col, int align_ ) +void TQDesignerGridLayout::addWidget( TQWidget *w, int row, int col, int align_ ) { items.insert( w, Item(row, col, 1, 1) ); TQGridLayout::addWidget( w, row, col, align_ ); } -void QDesignerGridLayout::addMultiCellWidget( TQWidget *w, int fromRow, int toRow, +void TQDesignerGridLayout::addMultiCellWidget( TQWidget *w, int fromRow, int toRow, int fromCol, int toCol, int align_ ) { items.insert( w, Item(fromRow, fromCol, toRow - fromRow + 1, toCol - fromCol +1) ); |