diff options
Diffstat (limited to 'kdevdesigner/designer/formwindow.cpp')
-rw-r--r-- | kdevdesigner/designer/formwindow.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/kdevdesigner/designer/formwindow.cpp b/kdevdesigner/designer/formwindow.cpp index e2520fde..312b543f 100644 --- a/kdevdesigner/designer/formwindow.cpp +++ b/kdevdesigner/designer/formwindow.cpp @@ -540,10 +540,10 @@ void FormWindow::handleContextMenu( TQContextMenuEvent *e, TQWidget *w ) selectWidget( TQT_TQOBJECT(w) ); // if widget is laid out, find the first non-laid out super-widget TQWidget *realWidget = w; // but store the original one - while ( w->tqparentWidget() && - ( WidgetFactory::tqlayoutType( w->tqparentWidget()) != WidgetFactory::NoLayout || + while ( w->parentWidget() && + ( WidgetFactory::layoutType( w->parentWidget()) != WidgetFactory::NoLayout || !insertedWidgets.tqfind(w) ) ) - w = w->tqparentWidget(); + w = w->parentWidget(); if ( ::tqqt_cast<TQMainWindow*>(mainContainer()) && ((TQMainWindow*)mainContainer())->centralWidget() == realWidget ) { e->accept(); mainwindow->popupFormWindowMenu( e->globalPos(), this ); @@ -578,7 +578,7 @@ void FormWindow::handleMousePress( TQMouseEvent *e, TQWidget *w ) case POINTER_TOOL: if ( !isMainContainer( TQT_TQOBJECT(w) ) && qstrcmp( w->name(), "central widget" ) != 0 ) { // press on a child widget // if the clicked widget is not in a tqlayout, raise it - if ( !w->tqparentWidget() || WidgetFactory::tqlayoutType( w->tqparentWidget() ) == WidgetFactory::NoLayout ) + if ( !w->parentWidget() || WidgetFactory::layoutType( w->parentWidget() ) == WidgetFactory::NoLayout ) w->raise(); if ( ( e->state() & ControlButton ) ) { // with control pressed, always start rubber band selection drawRubber = TRUE; @@ -593,7 +593,7 @@ void FormWindow::handleMousePress( TQMouseEvent *e, TQWidget *w ) clearSelection( FALSE ); } else { // ...widget selected // only if widget has a tqlayout (it is a tqlayout meta widget or a laid out container!), unselect its childs - if ( WidgetFactory::tqlayoutType( w ) != WidgetFactory::NoLayout ) { + if ( WidgetFactory::layoutType( w ) != WidgetFactory::NoLayout ) { TQObjectList *l = w->queryList( TQWIDGET_OBJECT_NAME_STRING ); setPropertyShowingBlocked( TRUE ); for ( TQObject *o = l->first(); o; o = l->next() ) { @@ -618,9 +618,9 @@ void FormWindow::handleMousePress( TQMouseEvent *e, TQWidget *w ) selectWidget( TQT_TQOBJECT(w) ); // if widget is laid out, find the first non-laid out super-widget - while ( w->tqparentWidget() && - ( WidgetFactory::tqlayoutType( w->tqparentWidget()) != WidgetFactory::NoLayout || !insertedWidgets.tqfind(w) ) ) - w = w->tqparentWidget(); + while ( w->parentWidget() && + ( WidgetFactory::layoutType( w->parentWidget()) != WidgetFactory::NoLayout || !insertedWidgets.tqfind(w) ) ) + w = w->parentWidget(); if ( e->button() == Qt::LeftButton ) { // left button: store original tqgeometry and more as the widget might start moving widgetPressed = TRUE; @@ -629,10 +629,10 @@ void FormWindow::handleMousePress( TQMouseEvent *e, TQWidget *w ) origPressPos = oldPressPos; checkedSelectionsForMove = FALSE; moving.clear(); - if ( w->tqparentWidget() && !isMainContainer( TQT_TQOBJECT(w->tqparentWidget()) ) && !isCentralWidget( TQT_TQOBJECT(w->tqparentWidget()) ) ) { - targetContainer = w->tqparentWidget(); - hadOwnPalette = w->tqparentWidget()->ownPalette(); - restorePalette = w->tqparentWidget()->palette(); + if ( w->parentWidget() && !isMainContainer( TQT_TQOBJECT(w->parentWidget()) ) && !isCentralWidget( TQT_TQOBJECT(w->parentWidget()) ) ) { + targetContainer = w->parentWidget(); + hadOwnPalette = w->parentWidget()->ownPalette(); + restorePalette = w->parentWidget()->palette(); } } } else { // press was on the formwindow @@ -702,7 +702,7 @@ void FormWindow::handleMousePress( TQMouseEvent *e, TQWidget *w ) insertParent = WidgetFactory::containerOfWidget( wid ); // found another tqparent, store it break; } else { - wid = wid->tqparentWidget(); + wid = wid->parentWidget(); if ( !wid ) break; } @@ -756,9 +756,9 @@ void FormWindow::handleMouseMove( TQMouseEvent *e, TQWidget *w ) if ( widgetPressed && allowMove( w ) ) { // we are prepated for a move // if widget is laid out, find the first non-laid out super-widget - while ( w->tqparentWidget() && - ( WidgetFactory::tqlayoutType( w->tqparentWidget() ) != WidgetFactory::NoLayout || !insertedWidgets.tqfind(w ) ) ) - w = w->tqparentWidget(); + while ( w->parentWidget() && + ( WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout || !insertedWidgets.tqfind(w ) ) ) + w = w->parentWidget(); // calc correct position TQPoint pos = w->mapFromGlobal( e->globalPos() ); @@ -770,10 +770,10 @@ void FormWindow::handleMouseMove( TQMouseEvent *e, TQWidget *w ) pos.setX( w->mapFromParent( TQPoint( 0, mpos.y() ) ).x() ); if ( mpos.y() < 0 ) pos.setY( w->mapFromParent( TQPoint( mpos.x(), 0 ) ).y() ); - if ( mpos.x() > w->tqparentWidget()->width() ) - pos.setX( w->mapFromParent( TQPoint( w->tqparentWidget()->width(), mpos.y() ) ).x() ); - if ( mpos.y() > w->tqparentWidget()->height() ) - pos.setY( w->mapFromParent( TQPoint( mpos.x(), w->tqparentWidget()->height() ) ).y() ); + if ( mpos.x() > w->parentWidget()->width() ) + pos.setX( w->mapFromParent( TQPoint( w->parentWidget()->width(), mpos.y() ) ).x() ); + if ( mpos.y() > w->parentWidget()->height() ) + pos.setY( w->mapFromParent( TQPoint( mpos.x(), w->parentWidget()->height() ) ).y() ); #endif // calc move distance and store it @@ -876,7 +876,7 @@ void FormWindow::handleMouseMove( TQMouseEvent *e, TQWidget *w ) currentPos = mapFromGlobal( e->globalPos() ); tqApp->processEvents(); if ( drawRecRect ) - restoreRect( TQRect( mapToForm( ( (TQWidget*)oldendWidget )->tqparentWidget(), ( (TQWidget*)oldendWidget )->pos() ), + restoreRect( TQRect( mapToForm( ( (TQWidget*)oldendWidget )->parentWidget(), ( (TQWidget*)oldendWidget )->pos() ), ( (TQWidget*)oldendWidget )->size() ) ); drawConnectionLine(); break; @@ -906,7 +906,7 @@ void FormWindow::handleMouseMove( TQMouseEvent *e, TQWidget *w ) currentPos = mapFromGlobal( e->globalPos() ); tqApp->processEvents(); if ( drawRecRect && oldendWidget ) - restoreRect( TQRect( mapToForm( ( (TQWidget*)oldendWidget )->tqparentWidget(), ( (TQWidget*)oldendWidget )->pos() ), + restoreRect( TQRect( mapToForm( ( (TQWidget*)oldendWidget )->parentWidget(), ( (TQWidget*)oldendWidget )->pos() ), ( (TQWidget*)oldendWidget )->size() ) ); drawConnectionLine(); break; @@ -946,7 +946,7 @@ void FormWindow::handleMouseRelease( TQMouseEvent *e, TQWidget *w ) emitUpdateProperties( propertyWidget ); TQMapConstIterator<TQWidget*,TQPoint> it = moving.begin(); - TQWidget *oldParent = it.key()->tqparentWidget(); + TQWidget *oldParent = it.key()->parentWidget(); TQWidget *newParent = oldParent; // check whether we have to reparent the selection TQWidget* wa = containerAt( e->globalPos(), it.key() ); @@ -954,12 +954,12 @@ void FormWindow::handleMouseRelease( TQMouseEvent *e, TQWidget *w ) wa = WidgetFactory::containerOfWidget( wa ); // ok, looks like we moved onto a container - // check whether we really have different tqparents. - if ( wa == it.key()->tqparentWidget() ) + // check whether we really have different parents. + if ( wa == it.key()->parentWidget() ) goto make_move_command; // break tqlayout if necessary - if ( WidgetFactory::tqlayoutType( wa ) != WidgetFactory::NoLayout ) { + if ( WidgetFactory::layoutType( wa ) != WidgetFactory::NoLayout ) { if ( TQMessageBox::information( mainWindow(), i18n( "Inserting Widget" ), i18n( "You tried to insert a widget into the " "tqlayout Container Widget '%1'.\n" @@ -978,12 +978,12 @@ void FormWindow::handleMouseRelease( TQMouseEvent *e, TQWidget *w ) for ( TQMap<TQWidget*, TQPoint>::Iterator it = moving.begin(); it != moving.end(); ++it ) { TQWidget *i = it.key(); if ( !emitSelChanged && ::tqqt_cast<TQButton*>(i) ) { - if ( ::tqqt_cast<TQButtonGroup*>(i->tqparentWidget()) || ::tqqt_cast<TQButtonGroup*>(wa) ) + if ( ::tqqt_cast<TQButtonGroup*>(i->parentWidget()) || ::tqqt_cast<TQButtonGroup*>(wa) ) emitSelChanged = TRUE; if ( !::tqqt_cast<TQButtonGroup*>(wa) ) { MetaDataBase::setPropertyChanged( TQT_TQOBJECT(i), "buttonGroupId", FALSE ); - if ( ::tqqt_cast<TQButtonGroup*>(i->tqparentWidget()) ) - ( (TQButtonGroup*)i->tqparentWidget() )->remove( (TQButton*)i ); + if ( ::tqqt_cast<TQButtonGroup*>(i->parentWidget()) ) + ( (TQButtonGroup*)i->parentWidget() )->remove( (TQButton*)i ); } } TQPoint pos = wa->mapFromGlobal( i->mapToGlobal( TQPoint(0,0) ) ); @@ -1027,11 +1027,11 @@ void FormWindow::handleMouseRelease( TQMouseEvent *e, TQWidget *w ) case BUDDY_TOOL: restoreConnectionLine(); if ( startWidget ) - restoreRect( TQRect( mapToForm( ( (TQWidget*)startWidget )->tqparentWidget(), + restoreRect( TQRect( mapToForm( ( (TQWidget*)startWidget )->parentWidget(), ( (TQWidget*)startWidget )->pos() ), ((TQWidget*)startWidget )->size() ) ); if ( endWidget ) - restoreRect( TQRect( mapToForm( ( (TQWidget*)endWidget )->tqparentWidget(), + restoreRect( TQRect( mapToForm( ( (TQWidget*)endWidget )->parentWidget(), ( (TQWidget*)endWidget )->pos() ), ( (TQWidget*)endWidget )->size() ) ); endUnclippedPainter(); @@ -1064,7 +1064,7 @@ void FormWindow::handleMouseRelease( TQMouseEvent *e, TQWidget *w ) default: // any insert widget tool is active if ( insertParent ) { // we should insert the new widget now endRectDraw(); - if ( WidgetFactory::tqlayoutType( insertParent ) != WidgetFactory::NoLayout ) { + if ( WidgetFactory::layoutType( insertParent ) != WidgetFactory::NoLayout ) { if ( TQMessageBox::information( mainWindow(), i18n( "Inserting Widget" ), i18n( "You tried to insert a widget into the " "tqlayout Container Widget '%1'.\n" @@ -1395,7 +1395,7 @@ void FormWindow::moveSelectedWidgets( int dx, int dy ) for ( ; it.current(); ++it ) { WidgetSelection *s = it.current(); TQWidget *w = s->widget(); - if ( w->tqparentWidget() && WidgetFactory::tqlayoutType( w->tqparentWidget() ) != WidgetFactory::NoLayout ) + if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout ) continue; w->move( w->x() + dx, w->y() + dy ); s->updateGeometry(); @@ -1451,7 +1451,7 @@ void FormWindow::checkSelectionsForMove( TQWidget *w ) { checkedSelectionsForMove = TRUE; - TQObjectList *l = w->tqparentWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, 0, FALSE, FALSE ); + TQObjectList *l = w->parentWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, 0, FALSE, FALSE ); moving.clear(); if ( l ) { TQPtrDictIterator<WidgetSelection> it( usedSelections ); @@ -1461,10 +1461,10 @@ void FormWindow::checkSelectionsForMove( TQWidget *w ) continue; ++it; if ( l->tqfind( TQT_TQOBJECT(sel->widget()) ) == -1 ) { - if ( WidgetFactory::tqlayoutType( w ) == WidgetFactory::NoLayout ) + if ( WidgetFactory::layoutType( w ) == WidgetFactory::NoLayout ) sel->setWidget( 0 ); } else { - if ( WidgetFactory::tqlayoutType( sel->widget()->tqparentWidget() ) == WidgetFactory::NoLayout ) { + if ( WidgetFactory::layoutType( sel->widget()->parentWidget() ) == WidgetFactory::NoLayout ) { moving.insert( sel->widget(), sel->widget()->pos() ); sel->widget()->raise(); raiseChildSelections( sel->widget() ); @@ -1516,7 +1516,7 @@ void FormWindow::editAdjustSize() return; } for ( TQWidget* 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; TQRect oldr = w->tqgeometry(); w->adjustSize(); @@ -1700,11 +1700,11 @@ void FormWindow::currentToolChanged() case BUDDY_TOOL: restoreConnectionLine(); if ( startWidget ) - restoreRect( TQRect( mapToForm( ( (TQWidget*)startWidget )->tqparentWidget(), + restoreRect( TQRect( mapToForm( ( (TQWidget*)startWidget )->parentWidget(), ( (TQWidget*)startWidget )->pos() ), ( (TQWidget*)startWidget )->size() ) ); if ( endWidget ) - restoreRect( TQRect( mapToForm( ( (TQWidget*)endWidget )->tqparentWidget(), + restoreRect( TQRect( mapToForm( ( (TQWidget*)endWidget )->parentWidget(), ( (TQWidget*)endWidget )->pos() ), ( (TQWidget*)endWidget )->size() ) ); endUnclippedPainter(); @@ -1996,7 +1996,7 @@ void FormWindow::selectAll() emitSelectionChanged(); } -void FormWindow::tqlayoutHorizontal() +void FormWindow::layoutHorizontal() { TQWidgetList widgets( selectedWidgets() ); LayoutHorizontalCommand *cmd = new LayoutHorizontalCommand( i18n( "Lay OutQt::Horizontally" ), @@ -2006,7 +2006,7 @@ void FormWindow::tqlayoutHorizontal() cmd->execute(); } -void FormWindow::tqlayoutVertical() +void FormWindow::layoutVertical() { TQWidgetList widgets( selectedWidgets() ); LayoutVerticalCommand *cmd = new LayoutVerticalCommand( i18n( "Lay OutQt::Vertically" ), @@ -2016,7 +2016,7 @@ void FormWindow::tqlayoutVertical() cmd->execute(); } -void FormWindow::tqlayoutHorizontalSplit() +void FormWindow::layoutHorizontalSplit() { TQWidgetList widgets( selectedWidgets() ); LayoutHorizontalSplitCommand *cmd = new LayoutHorizontalSplitCommand( i18n( "Lay OutQt::Horizontally (in splitter)" ), @@ -2026,7 +2026,7 @@ void FormWindow::tqlayoutHorizontalSplit() cmd->execute(); } -void FormWindow::tqlayoutVerticalSplit() +void FormWindow::layoutVerticalSplit() { TQWidgetList widgets( selectedWidgets() ); LayoutVerticalSplitCommand *cmd = new LayoutVerticalSplitCommand( i18n( "Lay OutQt::Vertically (in splitter)" ), @@ -2036,7 +2036,7 @@ void FormWindow::tqlayoutVerticalSplit() cmd->execute(); } -void FormWindow::tqlayoutGrid() +void FormWindow::layoutGrid() { int xres = grid().x(); int yres = grid().y(); @@ -2049,7 +2049,7 @@ void FormWindow::tqlayoutGrid() cmd->execute(); } -void FormWindow::tqlayoutHorizontalContainer( TQWidget *w ) +void FormWindow::layoutHorizontalContainer( TQWidget *w ) { if ( w == this ) w = mainContainer(); @@ -2070,7 +2070,7 @@ void FormWindow::tqlayoutHorizontalContainer( TQWidget *w ) cmd->execute(); } -void FormWindow::tqlayoutVerticalContainer( TQWidget *w ) +void FormWindow::layoutVerticalContainer( TQWidget *w ) { if ( w == this ) w = mainContainer(); @@ -2091,7 +2091,7 @@ void FormWindow::tqlayoutVerticalContainer( TQWidget *w ) cmd->execute(); } -void FormWindow::tqlayoutGridContainer( TQWidget *w ) +void FormWindow::layoutGridContainer( TQWidget *w ) { if ( w == this ) w = mainContainer(); @@ -2125,7 +2125,7 @@ void FormWindow::breakLayout( TQWidget *w ) for (;;) { if ( !w || w == this ) break; - if ( WidgetFactory::tqlayoutType( w ) != WidgetFactory::NoLayout && + if ( WidgetFactory::layoutType( w ) != WidgetFactory::NoLayout && WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(w) ) ) ) ) { Command *cmd = breakLayoutCommand( w ); if ( cmd ) @@ -2133,7 +2133,7 @@ void FormWindow::breakLayout( TQWidget *w ) if ( !::tqqt_cast<TQLayoutWidget*>(w) && !::tqqt_cast<TQSplitter*>(w) ) break; } - w = w->tqparentWidget(); + w = w->parentWidget(); } if ( commands.isEmpty() ) @@ -2202,11 +2202,11 @@ bool FormWindow::hasInsertedChildren( TQWidget *w ) const bool FormWindow::allowMove( TQWidget *w ) { - w = w->tqparentWidget(); + w = w->parentWidget(); while ( w ) { - if ( ( isMainContainer( TQT_TQOBJECT(w) ) || insertedWidgets.tqfind( w ) ) && WidgetFactory::tqlayoutType( w ) == WidgetFactory::NoLayout ) + if ( ( isMainContainer( TQT_TQOBJECT(w) ) || insertedWidgets.tqfind( w ) ) && WidgetFactory::layoutType( w ) == WidgetFactory::NoLayout ) return TRUE; - w = w->tqparentWidget(); + w = w->parentWidget(); } return FALSE; } @@ -2493,7 +2493,7 @@ TQPoint FormWindow::mapToForm( const TQWidget* w, const TQPoint& pos ) const const TQWidget* i = w; while ( i && !i->isTopLevel() && !isMainContainer( TQT_TQOBJECT(const_cast<TQWidget*>(i)) ) ) { p = i->mapToParent( p ); - i = i->tqparentWidget(); + i = i->parentWidget(); } return mapFromGlobal( w->mapToGlobal( pos ) ); } @@ -2503,7 +2503,7 @@ static int widgetDepth( TQWidget *w ) int d = -1; while ( w && !w->isTopLevel() ) { d++; - w = w->tqparentWidget(); + w = w->parentWidget(); } return d; @@ -2514,7 +2514,7 @@ static bool isChildOf( TQWidget *c, TQWidget *p ) while ( c && !c->isTopLevel() ) { if ( c == p ) return TRUE; - c = c->tqparentWidget(); + c = c->parentWidget(); } return FALSE; } @@ -2547,14 +2547,14 @@ TQWidget *FormWindow::containerAt( const TQPoint &pos, TQWidget *notParentOf ) while ( w && !w->isTopLevel() ) { if ( !TQT_TQRECT_OBJECT(w->rect()).tqcontains( ( w->mapFromGlobal( pos ) ) ) ) break; - w = w->tqparentWidget(); + w = w->parentWidget(); } if ( !( w == 0 || w->isTopLevel() ) ) continue; // we did not get through the full while loop int wd = widgetDepth( it.current() ); if ( wd == depth && container ) { - if ( ( it.current()->tqparentWidget()->childrenListObject() ).tqfind( TQT_TQOBJECT(it.current()) ) > - ( container->tqparentWidget()->childrenListObject() ).tqfind( TQT_TQOBJECT(container) ) ) + if ( ( it.current()->parentWidget()->childrenListObject() ).tqfind( TQT_TQOBJECT(it.current()) ) > + ( container->parentWidget()->childrenListObject() ).tqfind( TQT_TQOBJECT(container) ) ) wd++; } if ( wd > depth && !isChildOf( it.current(), notParentOf ) ) { @@ -2694,12 +2694,12 @@ bool FormWindow::isCentralWidget( TQObject *w ) const return TQT_BASE_OBJECT(w) == TQT_BASE_OBJECT(( (TQMainWindow*)mainContainer() )->centralWidget()); } -int FormWindow::tqlayoutDefaultSpacing() const +int FormWindow::layoutDefaultSpacing() const { return defSpacing; } -int FormWindow::tqlayoutDefaultMargin() const +int FormWindow::layoutDefaultMargin() const { return defMargin; } |