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.cpp124
1 files changed, 62 insertions, 62 deletions
diff --git a/kdevdesigner/designer/layout.cpp b/kdevdesigner/designer/layout.cpp
index b8fb737c..b776b97b 100644
--- a/kdevdesigner/designer/layout.cpp
+++ b/kdevdesigner/designer/layout.cpp
@@ -64,7 +64,7 @@ bool operator<( const TQGuardedPtr<TQWidget> &p1, const TQGuardedPtr<TQWidget> &
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.setAutoDelete( FALSE );
+ widgets.setAutoDelete( false );
layoutBase = lb;
if ( !doSetup && layoutBase )
oldGeometry = layoutBase->geometry();
@@ -103,7 +103,7 @@ void Layout::setup()
}
if ( !lastList ) {
TQWidgetList l;
- l.setAutoDelete( FALSE );
+ l.setAutoDelete( false );
lists.append( l );
lastList = &lists.last();
}
@@ -124,7 +124,7 @@ void Layout::setup()
// we leave here.
if ( !lastList || ( lastList->count() < 2 &&
( !layoutBase ||
- ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(layoutBase) ) ) ) &&
+ ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) &&
layoutBase != formWindow->mainContainer() ) )
) ) {
widgets.clear();
@@ -142,8 +142,8 @@ void Layout::setup()
// 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() ) );
+ connect( w, TQ_SIGNAL( destroyed() ),
+ this, TQ_SLOT( widgetDestroyed() ) );
startPoint = TQPoint( TQMIN( startPoint.x(), w->x() ),
TQMIN( startPoint.y(), w->y() ) );
geometries.insert( w, TQRect( w->pos(), w->size() ) );
@@ -163,23 +163,23 @@ void Layout::widgetDestroyed()
bool Layout::prepareLayout( bool &needMove, bool &needReparent )
{
if ( !widgets.count() )
- return FALSE;
+ return false;
for ( TQWidget *w = widgets.first(); w; w = widgets.next() )
w->raise();
needMove = !layoutBase;
- needReparent = needMove || ::tqqt_cast<TQLayoutWidget*>(layoutBase) || ::tqqt_cast<TQSplitter*>(layoutBase);
+ needReparent = needMove || ::tqt_cast<TQLayoutWidget*>(layoutBase) || ::tqt_cast<TQSplitter*>(layoutBase);
if ( !layoutBase ) {
if ( !useSplitter )
- layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQLAYOUTWIDGET_OBJECT_NAME_STRING ),
+ layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( "TQLayoutWidget" ),
WidgetFactory::containerOfWidget( parent ) );
else
- layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( TQSPLITTER_OBJECT_NAME_STRING ),
+ layoutBase = WidgetFactory::create( WidgetDatabase::idFromClassName( "TQSplitter" ),
WidgetFactory::containerOfWidget( parent ) );
} else {
WidgetFactory::deleteLayout( layoutBase );
}
- return TRUE;
+ return true;
}
void Layout::finishLayout( bool needMove, TQLayout *layout )
@@ -195,7 +195,7 @@ void Layout::finishLayout( bool needMove, TQLayout *layout )
layoutBase->show();
layout->activate();
formWindow->insertWidget( layoutBase );
- formWindow->selectWidget( TQT_TQOBJECT(layoutBase) );
+ formWindow->selectWidget( layoutBase );
TQString n = layoutBase->name();
if ( n.find( "qt_dead_widget_" ) != -1 ) {
n.remove( 0, TQString( "qt_dead_widget_" ).length() );
@@ -214,9 +214,9 @@ void Layout::undoLayout()
it.key()->reparent( WidgetFactory::containerOfWidget( parent ), 0, ( *it ).topLeft(), it.key()->isVisibleTo( formWindow ) );
it.key()->resize( ( *it ).size() );
}
- formWindow->selectWidget( TQT_TQOBJECT(layoutBase), FALSE );
+ formWindow->selectWidget( layoutBase, false );
WidgetFactory::deleteLayout( layoutBase );
- if ( parent != layoutBase && !::tqqt_cast<TQMainWindow*>(layoutBase) ) {
+ if ( parent != layoutBase && !::tqt_cast<TQMainWindow*>(layoutBase) ) {
layoutBase->hide();
TQString n = layoutBase->name();
n.prepend( "qt_dead_widget_" );
@@ -225,9 +225,9 @@ void Layout::undoLayout()
layoutBase->setGeometry( oldGeometry );
}
if ( widgets.first() )
- formWindow->selectWidget( TQT_TQOBJECT(widgets.first()) );
+ formWindow->selectWidget( widgets.first() );
else
- formWindow->selectWidget( TQT_TQOBJECT(formWindow) );
+ formWindow->selectWidget( formWindow );
}
void Layout::breakLayout()
@@ -239,16 +239,16 @@ void Layout::breakLayout()
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( TQT_TQOBJECT(layoutBase) ) ) ) &&
+ bool needReparent = qstrcmp( layoutBase->className(), "TQLayoutWidget" ) == 0 ||
+ qstrcmp( layoutBase->className(), "TQSplitter" ) == 0 ||
+ ( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) &&
layoutBase != formWindow->mainContainer() );
- bool needResize = qstrcmp( layoutBase->className(), TQSPLITTER_OBJECT_NAME_STRING ) == 0;
+ bool needResize = qstrcmp( layoutBase->className(), "TQSplitter" ) == 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 );
+ layoutBase->pos() + w->pos(), true );
if ( needResize ) {
TQMap<TQWidget*, TQRect>::Iterator it = rects.find( w );
if ( it != rects.end() )
@@ -267,9 +267,9 @@ void Layout::breakLayout()
parent = layoutBase;
}
if ( widgets.first() && widgets.first()->isVisibleTo( formWindow ) )
- formWindow->selectWidget( TQT_TQOBJECT(widgets.first()) );
+ formWindow->selectWidget( widgets.first() );
else
- formWindow->selectWidget( TQT_TQOBJECT(formWindow) );
+ formWindow->selectWidget( formWindow );
}
class HorizontalLayoutList : public TQWidgetList
@@ -314,21 +314,21 @@ void HorizontalLayout::doLayout()
TQHBoxLayout *layout = (TQHBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::HBox );
for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) {
- if ( needReparent && TQT_BASE_OBJECT(w->parent()) != TQT_BASE_OBJECT(layoutBase) )
- w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE );
+ if ( needReparent && w->parent() != layoutBase )
+ w->reparent( layoutBase, 0, TQPoint( 0, 0 ), false );
if ( !useSplitter ) {
if ( qstrcmp( w->className(), "Spacer" ) == 0 )
layout->addWidget( w, 0, ( (Spacer*)w )->alignment() );
else
layout->addWidget( w );
- if ( ::tqqt_cast<TQLayoutWidget*>(w) )
+ if ( ::tqt_cast<TQLayoutWidget*>(w) )
( (TQLayoutWidget*)w )->updateSizePolicy();
}
w->show();
}
- if ( ::tqqt_cast<TQSplitter*>(layoutBase) )
- ( (TQSplitter*)layoutBase )->setOrientation( Qt::Horizontal );
+ if ( ::tqt_cast<TQSplitter*>(layoutBase) )
+ ( (TQSplitter*)layoutBase )->setOrientation( TQt::Horizontal );
finishLayout( needMove, layout );
}
@@ -378,21 +378,21 @@ void VerticalLayout::doLayout()
TQVBoxLayout *layout = (TQVBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::VBox );
for ( TQWidget *w = widgets.first(); w; w = widgets.next() ) {
- if ( needReparent && TQT_BASE_OBJECT(w->parent()) != TQT_BASE_OBJECT(layoutBase) )
- w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE );
+ if ( needReparent && w->parent() != layoutBase )
+ w->reparent( layoutBase, 0, TQPoint( 0, 0 ), false );
if ( !useSplitter ) {
if ( qstrcmp( w->className(), "Spacer" ) == 0 )
layout->addWidget( w, 0, ( (Spacer*)w )->alignment() );
else
layout->addWidget( w );
- if ( ::tqqt_cast<TQLayoutWidget*>(w) )
+ if ( ::tqt_cast<TQLayoutWidget*>(w) )
( (TQLayoutWidget*)w )->updateSizePolicy();
}
w->show();
}
- if ( ::tqqt_cast<TQSplitter*>(layoutBase) )
- ( (TQSplitter*)layoutBase )->setOrientation( Qt::Vertical );
+ if ( ::tqt_cast<TQSplitter*>(layoutBase) )
+ ( (TQSplitter*)layoutBase )->setOrientation( TQt::Vertical );
finishLayout( needMove, layout );
}
@@ -495,10 +495,10 @@ bool Grid::isWidgetStartCol( int c ) const
int r;
for ( r = 0; r < nrows; r++ ) {
if ( cell( r, c ) && ( (c==0) || (cell( r, c) != cell( r, c-1) )) ) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
bool Grid::isWidgetEndCol( int c ) const
@@ -506,9 +506,9 @@ bool Grid::isWidgetEndCol( int c ) const
int r;
for ( r = 0; r < nrows; r++ ) {
if ( cell( r, c ) && ((c == ncols-1) || (cell( r, c) != cell( r, c+1) )) )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool Grid::isWidgetStartRow( int r ) const
@@ -516,9 +516,9 @@ bool Grid::isWidgetStartRow( int r ) const
int c;
for ( c = 0; c < ncols; c++ ) {
if ( cell( r, c ) && ( (r==0) || (cell( r, c) != cell( r-1, c) )) )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool Grid::isWidgetEndRow( int r ) const
@@ -526,9 +526,9 @@ bool Grid::isWidgetEndRow( int r ) const
int c;
for ( c = 0; c < ncols; c++ ) {
if ( cell( r, c ) && ((r == nrows-1) || (cell( r, c) != cell( r+1, c) )) )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
@@ -536,7 +536,7 @@ bool Grid::isWidgetTopLeft( int r, int c ) const
{
TQWidget* w = cell( r, c );
if ( !w )
- return FALSE;
+ return false;
return ( !r || cell( r-1, c) != w ) && (!c || cell( r, c-1) != w);
}
@@ -677,16 +677,16 @@ void Grid::merge()
{
int r,c;
for ( c = 0; c < ncols; c++ )
- cols[c] = FALSE;
+ cols[c] = false;
for ( r = 0; r < nrows; r++ )
- rows[r] = FALSE;
+ rows[r] = false;
for ( c = 0; c < ncols; c++ ) {
for ( r = 0; r < nrows; r++ ) {
if ( isWidgetTopLeft( r, c ) ) {
- rows[r] = TRUE;
- cols[c] = TRUE;
+ rows[r] = true;
+ cols[c] = true;
}
}
}
@@ -718,11 +718,11 @@ bool Grid::locateWidget( TQWidget* w, int& row, int& col, int& rowspan, int & co
if ( cols[ c2] )
colspan++;
}
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
@@ -756,14 +756,14 @@ 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 && TQT_BASE_OBJECT(w->parent()) != TQT_BASE_OBJECT(layoutBase) )
- w->reparent( layoutBase, 0, TQPoint( 0, 0 ), FALSE );
+ if ( needReparent && w->parent() != layoutBase )
+ w->reparent( layoutBase, 0, TQPoint( 0, 0 ), false );
if ( rs * cs == 1 ) {
- layout->addWidget( w, r, c, ::tqqt_cast<Spacer*>(w) ? ( (Spacer*)w )->alignment() : 0 );
+ layout->addWidget( w, r, c, ::tqt_cast<Spacer*>(w) ? ( (Spacer*)w )->alignment() : 0 );
} else {
- layout->addMultiCellWidget( w, r, r+rs-1, c, c+cs-1, ::tqqt_cast<Spacer*>(w) ? ( (Spacer*)w )->alignment() : 0 );
+ layout->addMultiCellWidget( w, r, r+rs-1, c, c+cs-1, ::tqt_cast<Spacer*>(w) ? ( (Spacer*)w )->alignment() : 0 );
}
- if ( ::tqqt_cast<TQLayoutWidget*>(w) )
+ if ( ::tqt_cast<TQLayoutWidget*>(w) )
( (TQLayoutWidget*)w )->updateSizePolicy();
w->show();
} else {
@@ -865,10 +865,10 @@ void GridLayout::buildGrid()
Spacer::Spacer( TQWidget *parent, const char *name )
: TQWidget( parent, name, WMouseNoMask ),
- orient(Qt::Vertical ), interactive(TRUE), sh( TQSize(20,20) )
+ orient(TQt::Vertical ), interactive(true), sh( TQSize(20,20) )
{
setSizeType( Expanding );
- setAutoMask( TRUE );
+ setAutoMask( true );
}
void Spacer::paintEvent( TQPaintEvent * )
@@ -876,7 +876,7 @@ void Spacer::paintEvent( TQPaintEvent * )
TQPainter p( this );
p.setPen( TQt::blue );
- if ( orient ==Qt::Horizontal ) {
+ if ( orient ==TQt::Horizontal ) {
const int dist = 3;
const int amplitude = TQMIN( 3, height() / 3 );
const int base = height() / 2;
@@ -915,7 +915,7 @@ void Spacer::resizeEvent( TQResizeEvent* e)
void Spacer::updateMask()
{
TQRegion r( rect() );
- if ( orient ==Qt::Horizontal ) {
+ if ( orient ==TQt::Horizontal ) {
const int amplitude = TQMIN( 3, height() / 3 );
const int base = height() / 2;
r = r.subtract( TQRect(1, 0, width() - 2, base - amplitude ) );
@@ -932,7 +932,7 @@ void Spacer::updateMask()
void Spacer::setSizeType( SizeType t )
{
TQSizePolicy sizeP;
- if ( orient ==Qt::Vertical )
+ if ( orient ==TQt::Vertical )
sizeP = TQSizePolicy( TQSizePolicy::Minimum, (TQSizePolicy::SizeType)t );
else
sizeP = TQSizePolicy( (TQSizePolicy::SizeType)t, TQSizePolicy::Minimum );
@@ -942,14 +942,14 @@ void Spacer::setSizeType( SizeType t )
Spacer::SizeType Spacer::sizeType() const
{
- if ( orient ==Qt::Vertical )
+ if ( orient ==TQt::Vertical )
return (SizeType)sizePolicy().verData();
return (SizeType)sizePolicy().horData();
}
int Spacer::alignment() const
{
- if ( orient ==Qt::Vertical )
+ if ( orient ==TQt::Vertical )
return AlignHCenter;
return AlignVCenter;
}
@@ -958,7 +958,7 @@ TQSize Spacer::minimumSize() const
{
TQSize s = TQSize( 20,20 );
if ( sizeType() == Expanding )
- if ( orient ==Qt::Vertical )
+ if ( orient ==TQt::Vertical )
s.rheight() = 0;
else
s.rwidth() = 0;
@@ -979,12 +979,12 @@ void Spacer::setSizeHint( const TQSize &s )
updateGeometry();
}
-Qt::Orientation Spacer::orientation() const
+TQt::Orientation Spacer::orientation() const
{
return orient;
}
-void Spacer::setOrientation( Qt::Orientation o )
+void Spacer::setOrientation( TQt::Orientation o )
{
if ( orient == o )
return;