diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/gui/colorcombo.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/colorcombo.cpp')
-rw-r--r-- | src/gui/colorcombo.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/src/gui/colorcombo.cpp b/src/gui/colorcombo.cpp index aec39ae..786ef98 100644 --- a/src/gui/colorcombo.cpp +++ b/src/gui/colorcombo.cpp @@ -12,14 +12,14 @@ #include <kcolordialog.h> #include <klocale.h> -#include <qpainter.h> +#include <tqpainter.h> bool ColorCombo::createdPalettes = false; -QColor * ColorCombo::palette[ NumberOfSchemes ]; +TQColor * ColorCombo::palette[ NumberOfSchemes ]; int ColorCombo::paletteSize[ NumberOfSchemes ]; -ColorCombo::ColorCombo( ColorScheme colorScheme, QWidget *parent, const char *name ) - : QComboBox( parent, name ) +ColorCombo::ColorCombo( ColorScheme colorScheme, TQWidget *tqparent, const char *name ) + : TQComboBox( tqparent, name ) { m_colorScheme = colorScheme; @@ -30,8 +30,8 @@ ColorCombo::ColorCombo( ColorScheme colorScheme, QWidget *parent, const char *na addColors(); - connect( this, SIGNAL( activated(int) ), SLOT( slotActivated(int) ) ); - connect( this, SIGNAL( highlighted(int) ), SLOT( slotHighlighted(int) ) ); + connect( this, TQT_SIGNAL( activated(int) ), TQT_SLOT( slotActivated(int) ) ); + connect( this, TQT_SIGNAL( highlighted(int) ), TQT_SLOT( slotHighlighted(int) ) ); } @@ -46,32 +46,32 @@ void ColorCombo::createPalettes() return; createdPalettes = true; - paletteSize[ QtStandard ] = 17; - palette[ QtStandard ] = new QColor[ paletteSize[ QtStandard ] ]; + paletteSize[ TQtStandard ] = 17; + palette[ TQtStandard ] = new TQColor[ paletteSize[ TQtStandard ] ]; int i = 0; - palette[ QtStandard ][i++] = Qt::red; - palette[ QtStandard ][i++] = Qt::green; - palette[ QtStandard ][i++] = Qt::blue; - palette[ QtStandard ][i++] = Qt::cyan; - palette[ QtStandard ][i++] = Qt::magenta; - palette[ QtStandard ][i++] = Qt::yellow; - palette[ QtStandard ][i++] = Qt::darkRed; - palette[ QtStandard ][i++] = Qt::darkGreen; - palette[ QtStandard ][i++] = Qt::darkBlue; - palette[ QtStandard ][i++] = Qt::darkCyan; - palette[ QtStandard ][i++] = Qt::darkMagenta; - palette[ QtStandard ][i++] = Qt::darkYellow; - palette[ QtStandard ][i++] = Qt::white; - palette[ QtStandard ][i++] = Qt::lightGray; - palette[ QtStandard ][i++] = Qt::gray; - palette[ QtStandard ][i++] = Qt::darkGray; - palette[ QtStandard ][i++] = Qt::black; + palette[ TQtStandard ][i++] = TQt::red; + palette[ TQtStandard ][i++] = TQt::green; + palette[ TQtStandard ][i++] = TQt::blue; + palette[ TQtStandard ][i++] = TQt::cyan; + palette[ TQtStandard ][i++] = TQt::magenta; + palette[ TQtStandard ][i++] = TQt::yellow; + palette[ TQtStandard ][i++] = TQt::darkRed; + palette[ TQtStandard ][i++] = TQt::darkGreen; + palette[ TQtStandard ][i++] = TQt::darkBlue; + palette[ TQtStandard ][i++] = TQt::darkCyan; + palette[ TQtStandard ][i++] = TQt::darkMagenta; + palette[ TQtStandard ][i++] = TQt::darkYellow; + palette[ TQtStandard ][i++] = TQt::white; + palette[ TQtStandard ][i++] = TQt::lightGray; + palette[ TQtStandard ][i++] = TQt::gray; + palette[ TQtStandard ][i++] = TQt::darkGray; + palette[ TQtStandard ][i++] = TQt::black; paletteSize[ LED ] = 6; - palette[ LED ] = new QColor[ paletteSize[ LED ] ]; + palette[ LED ] = new TQColor[ paletteSize[ LED ] ]; i = 0; palette[ LED ][i++] = "#f62a2a"; @@ -83,16 +83,16 @@ void ColorCombo::createPalettes() } -void ColorCombo::setColor( const QColor &col ) +void ColorCombo::setColor( const TQColor &col ) { internalColor = col; addColors(); } -void ColorCombo::resizeEvent( QResizeEvent *re ) +void ColorCombo::resizeEvent( TQResizeEvent *re ) { - QComboBox::resizeEvent( re ); + TQComboBox::resizeEvent( re ); addColors(); } @@ -101,23 +101,23 @@ void ColorCombo::slotActivated( int index ) { if ( index == 0 ) { - if ( KColorDialog::getColor( customColor, this ) == QDialog::Accepted ) + if ( KColorDialog::getColor( customColor, this ) == TQDialog::Accepted ) { - QPainter painter; - QPen pen; - QRect rect( 0, 0, width(), QFontMetrics(painter.font()).height()+4); - QPixmap pixmap( rect.width(), rect.height() ); + TQPainter painter; + TQPen pen; + TQRect rect( 0, 0, width(), TQFontMetrics(painter.font()).height()+4); + TQPixmap pixmap( rect.width(), rect.height() ); - if ( qGray( customColor.rgb() ) < 128 ) + if ( tqGray( customColor.rgb() ) < 128 ) pen.setColor( white ); else pen.setColor( black ); painter.begin( &pixmap ); - QBrush brush( customColor ); + TQBrush brush( customColor ); painter.fillRect( rect, brush ); painter.setPen( pen ); - painter.drawText( 2, QFontMetrics(painter.font()).ascent()+2, i18n("Custom...") ); + painter.drawText( 2, TQFontMetrics(painter.font()).ascent()+2, i18n("Custom...") ); painter.end(); changeItem( pixmap, 0 ); @@ -144,10 +144,10 @@ void ColorCombo::slotHighlighted( int index ) void ColorCombo::addColors() { - QPainter painter; - QPen pen; - QRect rect( 0, 0, width(), QFontMetrics(painter.font()).height()+4 ); - QPixmap pixmap( rect.width(), rect.height() ); + TQPainter painter; + TQPen pen; + TQRect rect( 0, 0, width(), TQFontMetrics(painter.font()).height()+4 ); + TQPixmap pixmap( rect.width(), rect.height() ); int i; clear(); @@ -160,16 +160,16 @@ void ColorCombo::addColors() if ( i == paletteSize[ m_colorScheme ] ) customColor = internalColor; - if ( qGray( customColor.rgb() ) < 128 ) + if ( tqGray( customColor.rgb() ) < 128 ) pen.setColor( white ); else pen.setColor( black ); painter.begin( &pixmap ); - QBrush brush( customColor ); + TQBrush brush( customColor ); painter.fillRect( rect, brush ); painter.setPen( pen ); - painter.drawText( 2, QFontMetrics(painter.font()).ascent()+2, i18n("Custom...") ); + painter.drawText( 2, TQFontMetrics(painter.font()).ascent()+2, i18n("Custom...") ); painter.end(); insertItem( pixmap ); @@ -178,7 +178,7 @@ void ColorCombo::addColors() for ( i = 0; i < paletteSize[ m_colorScheme ]; i++ ) { painter.begin( &pixmap ); - QBrush brush( palette[ m_colorScheme ][i] ); + TQBrush brush( palette[ m_colorScheme ][i] ); painter.fillRect( rect, brush ); painter.end(); |