summaryrefslogtreecommitdiffstats
path: root/kommander/editor/sizehandle.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-16 19:02:47 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-16 19:02:47 +0000
commite985f7e545f4739493965aad69bbecb136dc9346 (patch)
tree54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /kommander/editor/sizehandle.cpp
parentf7670c198945adc3b95ad69a959fe5f8ae55b493 (diff)
downloadtdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz
tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/editor/sizehandle.cpp')
-rw-r--r--kommander/editor/sizehandle.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/kommander/editor/sizehandle.cpp b/kommander/editor/sizehandle.cpp
index a5ebe0ec..af5efea9 100644
--- a/kommander/editor/sizehandle.cpp
+++ b/kommander/editor/sizehandle.cpp
@@ -1,7 +1,7 @@
/**********************************************************************
** 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
@@ -30,8 +30,8 @@
#include <klocale.h>
-SizeHandle::SizeHandle( FormWindow *parent, Direction d, WidgetSelection *s )
- : TQWidget( parent )
+SizeHandle::SizeHandle( FormWindow *tqparent, Direction d, WidgetSelection *s )
+ : TQWidget( tqparent )
{
active = true;
setBackgroundMode( active ? PaletteText : PaletteDark );
@@ -39,7 +39,7 @@ SizeHandle::SizeHandle( FormWindow *parent, Direction d, WidgetSelection *s )
widget = 0;
dir =d ;
setMouseTracking( false );
- formWindow = parent;
+ formWindow = tqparent;
sel = s;
updateCursor();
}
@@ -93,7 +93,7 @@ void SizeHandle::setWidget( TQWidget *w )
void SizeHandle::paintEvent( TQPaintEvent * )
{
- if ( ( (FormWindow*)parentWidget() )->currentWidget() != widget )
+ if ( ( (FormWindow*)tqparentWidget() )->currentWidget() != widget )
return;
TQPainter p( this );
p.setPen( blue );
@@ -102,7 +102,7 @@ void SizeHandle::paintEvent( TQPaintEvent * )
void SizeHandle::mousePressEvent( TQMouseEvent *e )
{
- if ( !widget || e->button() != LeftButton || !active )
+ if ( !widget || e->button() != Qt::LeftButton || !active )
return;
oldPressPos = e->pos();
geom = origGeom = TQRect( widget->pos(), widget->size() );
@@ -110,13 +110,13 @@ void SizeHandle::mousePressEvent( TQMouseEvent *e )
void SizeHandle::mouseMoveEvent( TQMouseEvent *e )
{
- if ( !widget || ( e->state() & LeftButton ) != LeftButton || !active )
+ if ( !widget || ( e->state() & Qt::LeftButton ) != Qt::LeftButton || !active )
return;
TQPoint rp = mapFromGlobal( e->globalPos() );
TQPoint d = oldPressPos - rp;
oldPressPos = rp;
- TQPoint checkPos = widget->parentWidget()->mapFromGlobal( e->globalPos() );
- TQRect pr = widget->parentWidget()->rect();
+ TQPoint checkPos = widget->tqparentWidget()->mapFromGlobal( e->globalPos() );
+ TQRect pr = widget->tqparentWidget()->rect();
// ##### move code around a bit to reduce duplicated code here
switch ( dir ) {
@@ -208,7 +208,7 @@ void SizeHandle::mouseMoveEvent( TQMouseEvent *e )
sel->updateGeometry();
oldPressPos += ( p - pos() );
- formWindow->sizePreview()->setText( TQString( "%1/%2" ).arg( widget->width() ).arg( widget->height() ) );
+ formWindow->sizePreview()->setText( TQString( "%1/%2" ).tqarg( widget->width() ).tqarg( widget->height() ) );
formWindow->sizePreview()->adjustSize();
TQRect lg( formWindow->mapFromGlobal( e->globalPos() ) + TQPoint( 16, 16 ),
formWindow->sizePreview()->size() );
@@ -216,55 +216,55 @@ void SizeHandle::mouseMoveEvent( TQMouseEvent *e )
formWindow->sizePreview()->setGeometry( lg );
formWindow->sizePreview()->show();
formWindow->sizePreview()->raise();
- if ( WidgetFactory::layoutType( widget ) != WidgetFactory::NoLayout )
+ if ( WidgetFactory::tqlayoutType( widget ) != WidgetFactory::NoLayout )
formWindow->updateChildSelections( widget );
}
void SizeHandle::mouseReleaseEvent( TQMouseEvent *e )
{
- if ( e->button() != LeftButton || !active )
+ if ( e->button() != Qt::LeftButton || !active )
return;
formWindow->sizePreview()->hide();
- if ( geom != widget->geometry() )
+ if ( geom != widget->tqgeometry() )
formWindow->commandHistory()->addCommand( new ResizeCommand( i18n("Resize" ),
formWindow,
widget, origGeom,
- widget->geometry() ) );
- formWindow->emitUpdateProperties( widget );
+ widget->tqgeometry() ) );
+ formWindow->emitUpdateProperties( TQT_TQOBJECT(widget) );
}
void SizeHandle::trySetGeometry( TQWidget *w, int x, int y, int width, int height )
{
- int minw = QMAX( w->minimumSizeHint().width(), w->minimumSize().width() );
- minw = QMAX( minw, 2 * formWindow->grid().x() );
- int minh = QMAX( w->minimumSizeHint().height(), w->minimumSize().height() );
- minh = QMAX( minh, 2 * formWindow->grid().y() );
- if ( QMAX( minw, width ) > w->maximumWidth() ||
- QMAX( minh, height ) > w->maximumHeight() )
+ int minw = TQMAX( w->tqminimumSizeHint().width(), w->tqminimumSize().width() );
+ minw = TQMAX( minw, 2 * formWindow->grid().x() );
+ int minh = TQMAX( w->tqminimumSizeHint().height(), w->tqminimumSize().height() );
+ minh = TQMAX( minh, 2 * formWindow->grid().y() );
+ if ( TQMAX( minw, width ) > w->maximumWidth() ||
+ TQMAX( minh, height ) > w->maximumHeight() )
return;
if ( width < minw && x != w->x() )
x -= minw - width;
if ( height < minh && y != w->y() )
y -= minh - height;
- w->setGeometry( x, y, QMAX( minw, width ), QMAX( minh, height ) );
+ w->setGeometry( x, y, TQMAX( minw, width ), TQMAX( minh, height ) );
}
void SizeHandle::tryResize( TQWidget *w, int width, int height )
{
- int minw = QMAX( w->minimumSizeHint().width(), w->minimumSize().width() );
- minw = QMAX( minw, 16 );
- int minh = QMAX( w->minimumSizeHint().height(), w->minimumSize().height() );
- minh = QMAX( minh, 16 );
- w->resize( QMAX( minw, width ), QMAX( minh, height ) );
+ int minw = TQMAX( w->tqminimumSizeHint().width(), w->tqminimumSize().width() );
+ minw = TQMAX( minw, 16 );
+ int minh = TQMAX( w->tqminimumSizeHint().height(), w->tqminimumSize().height() );
+ minh = TQMAX( minh, 16 );
+ w->resize( TQMAX( minw, width ), TQMAX( minh, height ) );
}
// ------------------------------------------------------------------------
-WidgetSelection::WidgetSelection( FormWindow *parent, TQPtrDict<WidgetSelection> *selDict )
+WidgetSelection::WidgetSelection( FormWindow *tqparent, TQPtrDict<WidgetSelection> *selDict )
: selectionDict( selDict )
{
- formWindow = parent;
+ formWindow = tqparent;
for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) {
handles.insert( i, new SizeHandle( formWindow, (SizeHandle::Direction)i, this ) );
}
@@ -282,7 +282,7 @@ void WidgetSelection::setWidget( TQWidget *w, bool updateDict )
}
wid = w;
- bool active = !wid->parentWidget() || WidgetFactory::layoutType( wid->parentWidget() ) == WidgetFactory::NoLayout;
+ bool active = !wid->tqparentWidget() || WidgetFactory::tqlayoutType( wid->tqparentWidget() ) == WidgetFactory::NoLayout;
for ( int i = SizeHandle::LeftTop; i <= SizeHandle::Left; ++i ) {
SizeHandle *h = handles[ i ];
if ( h ) {
@@ -306,7 +306,7 @@ void WidgetSelection::updateGeometry()
if ( !wid )
return;
- TQPoint p = wid->parentWidget()->mapToGlobal( wid->pos() );
+ TQPoint p = wid->tqparentWidget()->mapToGlobal( wid->pos() );
p = formWindow->mapFromGlobal( p );
TQRect r( p, wid->size() );