diff options
Diffstat (limited to 'kexi/widget/utils/kexigradientwidget.cpp')
| -rw-r--r-- | kexi/widget/utils/kexigradientwidget.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/kexi/widget/utils/kexigradientwidget.cpp b/kexi/widget/utils/kexigradientwidget.cpp index 0411318de..2a1a3ba31 100644 --- a/kexi/widget/utils/kexigradientwidget.cpp +++ b/kexi/widget/utils/kexigradientwidget.cpp @@ -17,30 +17,30 @@ * Boston, MA 02110-1301, USA. */ -#include <qapplication.h> -#include <qbitmap.h> -#include <qimage.h> -#include <qobjectlist.h> -#include <qpainter.h> -#include <qstyle.h> +#include <tqapplication.h> +#include <tqbitmap.h> +#include <tqimage.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqstyle.h> #include <kimageeffect.h> #include <kpixmap.h> #include "kexigradientwidget.h" -KexiGradientWidget::KexiGradientWidget( QWidget *parent, const char *name, WFlags f ) - : QWidget( parent, name, f ), p_displayMode( NoGradient ), +KexiGradientWidget::KexiGradientWidget( TQWidget *tqparent, const char *name, WFlags f ) + : TQWidget( tqparent, name, f ), p_displayMode( NoGradient ), p_gradientType( VerticalGradient ), - p_color1( Qt::white ), p_color2( Qt::blue ), p_currentChild( 0 ), + p_color1( TQt::white ), p_color2( TQt::blue ), p_currentChild( 0 ), p_opacity( 0.5 ), p_cacheDirty( true ) { p_customBackgroundWidgets.setAutoDelete( false ); p_knownWidgets.setAutoDelete( false ); - p_backgroundColor = QWidget::paletteBackgroundColor(); + p_backgroundColor = TQWidget::paletteBackgroundColor(); - connect ( &p_rebuildDelayTimer, SIGNAL( timeout() ), this, SLOT( setCacheDirty() ) ); + connect ( &p_rebuildDelayTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( setCacheDirty() ) ); installEventFilter( this ); } @@ -49,17 +49,17 @@ KexiGradientWidget::~KexiGradientWidget() { } -bool KexiGradientWidget::isValidChildWidget( QObject* child ) { - const QWidget* wgt = dynamic_cast<QWidget*>( child ); +bool KexiGradientWidget::isValidChildWidget( TQObject* child ) { + const TQWidget* wgt = dynamic_cast<TQWidget*>( child ); if ( wgt == 0L ) return false; - if ( wgt->inherits( "QScrollView" ) ) + if ( wgt->inherits( TQSCROLLVIEW_OBJECT_NAME_STRING ) ) return false; - if ( wgt->inherits( "QComboBox" ) ) + if ( wgt->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) return false; - if ( wgt->inherits( "QLineEdit" ) ) + if ( wgt->inherits( TQLINEEDIT_OBJECT_NAME_STRING ) ) return false; if ( wgt->inherits( "KexiDBForm" ) ) return false; @@ -67,14 +67,14 @@ bool KexiGradientWidget::isValidChildWidget( QObject* child ) { return true; } -void KexiGradientWidget::buildChildrenList( WidgetList& list, QWidget* p ) { - QObjectList* objects = p->queryList( "QWidget", 0, false, false ); +void KexiGradientWidget::buildChildrenList( WidgetList& list, TQWidget* p ) { + TQObjectList* objects = p->queryList( TQWIDGET_OBJECT_NAME_STRING, 0, false, false ); - for ( QObjectList::Iterator it = objects->begin(); it != objects->end(); ++it ) { + for ( TQObjectList::Iterator it = objects->begin(); it != objects->end(); ++it ) { if ( isValidChildWidget( ( *it ) ) == false ) continue; - list.append( dynamic_cast<QWidget*>( ( *it ) ) ); - buildChildrenList( list, dynamic_cast<QWidget*>( ( *it ) ) ); + list.append( dynamic_cast<TQWidget*>( ( *it ) ) ); + buildChildrenList( list, dynamic_cast<TQWidget*>( ( *it ) ) ); } delete objects; @@ -85,20 +85,20 @@ void KexiGradientWidget::rebuildCache( void ) { buildChildrenList( childWidgetList, this ); /** - Disable the effect and behave like a normal QWidget. + Disable the effect and behave like a normal TQWidget. */ if ( p_displayMode == NoGradient ) { // if ( p_backgroundPixmap.isNull() ) { //unsetPalette(); //} else { - QWidget::setPaletteBackgroundPixmap( p_backgroundPixmap ); + TQWidget::setPaletteBackgroundPixmap( p_backgroundPixmap ); //} - QWidget::setPaletteBackgroundColor( p_backgroundColor ); + TQWidget::setPaletteBackgroundColor( p_backgroundColor ); for ( WidgetList::Iterator it = childWidgetList.begin(); it != childWidgetList.end(); ++it ) { - if ( p_customBackgroundWidgets.contains( ( *it ) ) == false ) { + if ( p_customBackgroundWidgets.tqcontains( ( *it ) ) == false ) { ( *it )->unsetPalette(); } } @@ -110,8 +110,8 @@ void KexiGradientWidget::rebuildCache( void ) { } KPixmap tempPixmap; - QImage gradientImage; - QImage bgImage; + TQImage gradientImage; + TQImage bgImage; /** Draw the gradient @@ -124,7 +124,7 @@ void KexiGradientWidget::rebuildCache( void ) { */ if ( p_displayMode == FadedGradient ) { tempPixmap.resize( size() ); - QPainter p( &tempPixmap, this ); + TQPainter p( &tempPixmap, this ); if ( p_backgroundPixmap.isNull() ) { /* @@ -133,8 +133,8 @@ void KexiGradientWidget::rebuildCache( void ) { */ unsetPalette(); p.fillRect( 0, 0, width(), height(), palette().brush( - isEnabled() ? QPalette::Active : QPalette::Disabled, - QColorGroup::Background ) ); + isEnabled() ? TQPalette::Active : TQPalette::Disabled, + TQColorGroup::Background ) ); } else { p.drawTiledPixmap( 0, 0, width(), height(), p_backgroundPixmap ); } @@ -155,12 +155,12 @@ void KexiGradientWidget::rebuildCache( void ) { } /** - All children need to have our background set. + All tqchildren need to have our background set. */ KPixmap partPixmap; - QRect area; - QWidget* childWidget = 0; - const QPoint topLeft( 0, 0 ); + TQRect area; + TQWidget* childWidget = 0; + const TQPoint topLeft( 0, 0 ); for ( WidgetList::Iterator it = childWidgetList.begin(); it != childWidgetList.end(); ++it ) { @@ -170,7 +170,7 @@ void KexiGradientWidget::rebuildCache( void ) { /** Exclude widgets with a custom palette. */ - if ( p_customBackgroundWidgets.contains( childWidget ) ) { + if ( p_customBackgroundWidgets.tqcontains( childWidget ) ) { continue; } @@ -179,8 +179,8 @@ void KexiGradientWidget::rebuildCache( void ) { Get the part of the tempPixmap that is under the current child-widget. */ - if ( childWidget->parent() == this ) { - area = childWidget->geometry(); + if ( TQT_BASE_OBJECT(childWidget->tqparent()) == TQT_BASE_OBJECT(this) ) { + area = childWidget->tqgeometry(); } else { area.setTopLeft( childWidget->mapTo( this, childWidget->clipRegion().boundingRect().topLeft() ) ); @@ -192,17 +192,17 @@ void KexiGradientWidget::rebuildCache( void ) { childWidget->setPaletteBackgroundPixmap( partPixmap ); } - QWidget::setPaletteBackgroundPixmap( tempPixmap ); + TQWidget::setPaletteBackgroundPixmap( tempPixmap ); /** Unset the dirty-flag at the end of the method. - QWidget::setPaletteBackgroundPixmap() causes this + TQWidget::setPaletteBackgroundPixmap() causes this to get set to true again, so set it to false right after setting the pixmap. */ p_cacheDirty = false; } -void KexiGradientWidget::paintEvent( QPaintEvent* e ) { +void KexiGradientWidget::paintEvent( TQPaintEvent* e ) { /** Rebuild the background-pixmap if necessary. */ @@ -213,19 +213,19 @@ void KexiGradientWidget::paintEvent( QPaintEvent* e ) { /** Draw the widget as usual */ - QWidget::paintEvent( e ); + TQWidget::paintEvent( e ); } -bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { - QWidget* child = dynamic_cast<QWidget*>( object ); +bool KexiGradientWidget::eventFilter( TQObject* object, TQEvent* event ) { + TQWidget* child = dynamic_cast<TQWidget*>( object ); /** Manage list of child-widgets. */ - if ( object == this ) { - if ( event->type() == QEvent::ChildInserted ) { - child = dynamic_cast<QWidget*>( dynamic_cast<QChildEvent*>( event )->child() ); - if ( isValidChildWidget( child ) == false ) { + if ( TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(this) ) { + if ( event->type() == TQEvent::ChildInserted ) { + child = dynamic_cast<TQWidget*>( dynamic_cast<TQChildEvent*>( event )->child() ); + if ( isValidChildWidget( TQT_TQOBJECT(child) ) == false ) { return false; } /** @@ -236,11 +236,11 @@ bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { ... and install 'this' as the child's event-filter. */ child->installEventFilter( this ); - } else if ( event->type() == QEvent::ChildRemoved ) { + } else if ( event->type() == TQEvent::ChildRemoved ) { /** Remove the child-widget from the list of known widgets. */ - p_knownWidgets.remove( dynamic_cast<QWidget*>( dynamic_cast<QChildEvent*>( event )->child() ) ); + p_knownWidgets.remove( dynamic_cast<TQWidget*>( dynamic_cast<TQChildEvent*>( event )->child() ) ); } return false; } @@ -248,14 +248,14 @@ bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { /** Manage custombackground-list. */ - if ( event->type() == QEvent::PaletteChange ) { + if ( event->type() == TQEvent::PaletteChange ) { /** p_currentChild will be == 0L, when the user sets it's palette manually. In this case, it has to be added to the customBackground-list. */ if ( p_currentChild == 0L && child != 0L ) { - if ( p_customBackgroundWidgets.contains( child ) == false ) { + if ( p_customBackgroundWidgets.tqcontains( child ) == false ) { p_customBackgroundWidgets.append( child ); return false; } @@ -269,7 +269,7 @@ bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { Add the new child to the list of widgets, we don't set the background ourselves if it isn't in the list. */ - if ( p_customBackgroundWidgets.contains( child ) == false ) { + if ( p_customBackgroundWidgets.tqcontains( child ) == false ) { if ( child->paletteBackgroundPixmap() != 0L ) { p_customBackgroundWidgets.append( child ); } @@ -290,37 +290,37 @@ bool KexiGradientWidget::eventFilter( QObject* object, QEvent* event ) { p_currentChild = 0; } - if ( event->type() == QEvent::Move ) { - if ( p_customBackgroundWidgets.contains( child ) == false ) { + if ( event->type() == TQEvent::Move ) { + if ( p_customBackgroundWidgets.tqcontains( child ) == false ) { updateChildBackground( child ); } } return false; } -void KexiGradientWidget::updateChildBackground( QWidget* childWidget ) +void KexiGradientWidget::updateChildBackground( TQWidget* childWidget ) { KPixmap partPixmap; KPixmap bgPixmap; - QRect area; - const QPoint topLeft( 0, 0 ); + TQRect area; + const TQPoint topLeft( 0, 0 ); - bgPixmap = paletteBackgroundPixmap() ? (*paletteBackgroundPixmap()) : QPixmap(); + bgPixmap = paletteBackgroundPixmap() ? (*paletteBackgroundPixmap()) : TQPixmap(); if ( bgPixmap.isNull() ) return; /** - Exclude widgtes that don't have a parent. - This happens when children are removed + Exclude widgtes that don't have a tqparent. + This happens when tqchildren are removed which are in the knownWidgets-list. */ - if ( childWidget->parent() == 0L ) + if ( childWidget->tqparent() == 0L ) return; /** Exclude widgets with a custom palette. */ - if ( p_customBackgroundWidgets.contains( childWidget ) ) { + if ( p_customBackgroundWidgets.tqcontains( childWidget ) ) { return; } @@ -329,8 +329,8 @@ void KexiGradientWidget::updateChildBackground( QWidget* childWidget ) Get the part of the tempPixmap that is under the current child-widget. */ - if ( childWidget->parent() == this ) { - area = childWidget->geometry(); + if ( TQT_BASE_OBJECT(childWidget->tqparent()) == TQT_BASE_OBJECT(this) ) { + area = childWidget->tqgeometry(); } else { area.setTopLeft( childWidget->mapTo( this, childWidget->clipRegion().boundingRect().topLeft() ) ); @@ -342,15 +342,15 @@ void KexiGradientWidget::updateChildBackground( QWidget* childWidget ) childWidget->setPaletteBackgroundPixmap( partPixmap ); } -void KexiGradientWidget::setPaletteBackgroundColor( const QColor& color ) +void KexiGradientWidget::setPaletteBackgroundColor( const TQColor& color ) { p_backgroundColor = color; if ( p_displayMode == NoGradient ) { - QWidget::setPaletteBackgroundColor( p_backgroundColor ); + TQWidget::setPaletteBackgroundColor( p_backgroundColor ); } } -const QColor& KexiGradientWidget::paletteBackgroundColor() const +const TQColor& KexiGradientWidget::paletteBackgroundColor() const { return p_backgroundColor; } |
