diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-19 19:03:33 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-19 19:03:33 +0000 |
commit | e69e8b1d09fb579316595b4e6a850e717358a8b1 (patch) | |
tree | a24fc20865f65772f530d16177520190594ffdd2 /kview/kviewcanvas | |
parent | eecec9afb81fdebb0f22e9da22635874c403f854 (diff) | |
download | tdegraphics-e69e8b1d09fb579316595b4e6a850e717358a8b1.tar.gz tdegraphics-e69e8b1d09fb579316595b4e6a850e717358a8b1.zip |
TQt4 port kdegraphics
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1237557 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kview/kviewcanvas')
-rw-r--r-- | kview/kviewcanvas/config/confmodules.cpp | 8 | ||||
-rw-r--r-- | kview/kviewcanvas/config/confmodules.h | 3 | ||||
-rw-r--r-- | kview/kviewcanvas/config/defaults.h | 2 | ||||
-rw-r--r-- | kview/kviewcanvas/config/generalconfigwidget.ui | 34 | ||||
-rw-r--r-- | kview/kviewcanvas/kimagecanvas.cpp | 20 | ||||
-rw-r--r-- | kview/kviewcanvas/kimagecanvas.h | 3 | ||||
-rw-r--r-- | kview/kviewcanvas/kimageholder.cpp | 32 | ||||
-rw-r--r-- | kview/kviewcanvas/kimageholder.h | 7 | ||||
-rw-r--r-- | kview/kviewcanvas/test/test.cpp | 2 | ||||
-rw-r--r-- | kview/kviewcanvas/test/test.h | 1 |
10 files changed, 58 insertions, 54 deletions
diff --git a/kview/kviewcanvas/config/confmodules.cpp b/kview/kviewcanvas/config/confmodules.cpp index 4ecf07b9..a90c1024 100644 --- a/kview/kviewcanvas/config/confmodules.cpp +++ b/kview/kviewcanvas/config/confmodules.cpp @@ -34,12 +34,12 @@ typedef KGenericFactory<KViewCanvasConfig, TQWidget> KViewCanvasConfigFactory; K_EXPORT_COMPONENT_FACTORY( kcm_kviewcanvasconfig, KViewCanvasConfigFactory( "kcm_kviewcanvasconfig" ) ) -KViewCanvasConfig::KViewCanvasConfig( TQWidget * parent, const char *, const TQStringList & args ) - : KCModule( KViewCanvasConfigFactory::instance(), parent, args ) +KViewCanvasConfig::KViewCanvasConfig( TQWidget * tqparent, const char *, const TQStringList & args ) + : KCModule( KViewCanvasConfigFactory::instance(), tqparent, args ) , m_config( new KConfig( "kviewcanvasrc" ) ) { - TQBoxLayout * layout = new TQVBoxLayout( this ); - layout->setAutoAdd( true ); + TQBoxLayout * tqlayout = new TQVBoxLayout( this ); + tqlayout->setAutoAdd( true ); m_pWidget = new GeneralConfigWidget( this ); m_pWidget->m_pMinWidth ->setRange( 1, 200 ); diff --git a/kview/kviewcanvas/config/confmodules.h b/kview/kviewcanvas/config/confmodules.h index e513a9cd..95fa00c6 100644 --- a/kview/kviewcanvas/config/confmodules.h +++ b/kview/kviewcanvas/config/confmodules.h @@ -29,8 +29,9 @@ class KConfig; class KViewCanvasConfig : public KCModule { Q_OBJECT + TQ_OBJECT public: - KViewCanvasConfig( TQWidget * parent, const char * name = 0, const TQStringList & args = TQStringList() ); + KViewCanvasConfig( TQWidget * tqparent, const char * name = 0, const TQStringList & args = TQStringList() ); ~KViewCanvasConfig(); void load(); diff --git a/kview/kviewcanvas/config/defaults.h b/kview/kviewcanvas/config/defaults.h index 02abbb19..166b3b02 100644 --- a/kview/kviewcanvas/config/defaults.h +++ b/kview/kviewcanvas/config/defaults.h @@ -27,7 +27,7 @@ namespace Defaults { static const bool smoothScaling = false; static const bool keepAspectRatio = true; static const bool centerImage = true; - static const TQColor bgColor( Qt::black ); + static const TQColor bgColor( TQt::black ); static const TQSize minSize( 1, 1 ); static const TQSize maxSize( 10000, 10000 ); static const unsigned int numOfBlendEffects = 4; diff --git a/kview/kviewcanvas/config/generalconfigwidget.ui b/kview/kviewcanvas/config/generalconfigwidget.ui index b4646381..da279892 100644 --- a/kview/kviewcanvas/config/generalconfigwidget.ui +++ b/kview/kviewcanvas/config/generalconfigwidget.ui @@ -1,7 +1,7 @@ <!DOCTYPE UI><UI version="3.1" stdsetdef="1"> <class>GeneralConfigWidget</class> <author>Matthias Kretz <kretz@kde.org></author> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>GeneralConfigWidget</cstring> </property> @@ -20,7 +20,7 @@ <property name="margin"> <number>0</number> </property> - <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <widget class="TQLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> <property name="name"> <cstring>Layout4</cstring> </property> @@ -110,7 +110,7 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a <property name="sizeType"> <enum>MinimumExpanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>0</width> <height>0</height> @@ -127,7 +127,7 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a <property name="sizeType"> <enum>MinimumExpanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>0</width> <height>0</height> @@ -136,15 +136,15 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a </spacer> </grid> </widget> - <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> + <widget class="TQLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> <property name="name"> - <cstring>layout3</cstring> + <cstring>tqlayout3</cstring> </property> <vbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>TextLabel3</cstring> </property> @@ -179,15 +179,15 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a </widget> </vbox> </widget> - <widget class="QLayoutWidget" row="0" column="0"> + <widget class="TQLayoutWidget" row="0" column="0"> <property name="name"> - <cstring>layout4</cstring> + <cstring>tqlayout4</cstring> </property> <vbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QCheckBox"> + <widget class="TQCheckBox"> <property name="name"> <cstring>m_pSmoothScaling</cstring> </property> @@ -195,7 +195,7 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a <string>Use smooth scaling (high quality but slower)</string> </property> </widget> - <widget class="QCheckBox"> + <widget class="TQCheckBox"> <property name="name"> <cstring>m_pKeepRatio</cstring> </property> @@ -206,7 +206,7 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a <string>If this is checked KView will always try to keep the aspect ratio. That means if the width is scaled with a factor x, the height is scaled with the same factor.</string> </property> </widget> - <widget class="QCheckBox"> + <widget class="TQCheckBox"> <property name="name"> <cstring>m_pCenterImage</cstring> </property> @@ -216,7 +216,7 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a </widget> </vbox> </widget> - <widget class="QGroupBox" row="0" column="1"> + <widget class="TQGroupBox" row="0" column="1"> <property name="name"> <cstring>groupBox3</cstring> </property> @@ -239,7 +239,7 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> + <property name="tqminimumSize"> <size> <width>32</width> <height>32</height> @@ -259,7 +259,7 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>151</width> <height>21</height> @@ -283,8 +283,8 @@ A value of 100 would cause a 1000x1000 image to be compressed horizontally by a <includes> <include location="global" impldecl="in implementation">kdialog.h</include> </includes> -<layoutdefaults spacing="6" margin="11"/> -<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<tqlayoutdefaults spacing="6" margin="11"/> +<tqlayoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> <includehints> <includehint>knuminput.h</includehint> <includehint>knuminput.h</includehint> diff --git a/kview/kviewcanvas/kimagecanvas.cpp b/kview/kviewcanvas/kimagecanvas.cpp index 97001670..d3a8608b 100644 --- a/kview/kviewcanvas/kimagecanvas.cpp +++ b/kview/kviewcanvas/kimagecanvas.cpp @@ -43,8 +43,8 @@ typedef KGenericFactory<KImageCanvas> KImageCanvasFactory; K_EXPORT_COMPONENT_FACTORY( libkviewcanvas, KImageCanvasFactory( "kviewcanvas" ) ) -KImageCanvas::KImageCanvas( TQWidget * parent, const char * name, const TQStringList & ) - : TQScrollView( parent, name, WResizeNoErase | WStaticContents ) +KImageCanvas::KImageCanvas( TQWidget * tqparent, const char * name, const TQStringList & ) + : TQScrollView( tqparent, name, WResizeNoErase | WStaticContents ) , m_client( 0 ) , m_oldClient( 0 ) , m_image( 0 ) @@ -75,7 +75,7 @@ KImageCanvas::KImageCanvas( TQWidget * parent, const char * name, const TQString connect( m_pTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( hideCursor() ) ); KSettings::Dispatcher::self()->registerInstance( - KImageCanvasFactory::instance(), this, + KImageCanvasFactory::instance(), TQT_TQOBJECT(this), TQT_SLOT( loadSettings() ) ); viewport()->setFocusProxy( this ); @@ -321,13 +321,13 @@ TQString KImageCanvas::blendEffectDescription( unsigned int idx ) const return i18n( Defaults::blendEffectDescription[ 4 ] ); } kdError( 4620 ) << "Effect description for effect with index " << idx << " doesn't exist\n"; - return TQString::null; + return TQString(); } bool KImageCanvas::eventFilter( TQObject * obj, TQEvent * ev ) { - if( ( obj == m_client || obj == m_oldClient ) && ev->type() == TQEvent::MouseMove ) - mouseMoveEvent( static_cast<TQMouseEvent*>( ev ) ); + if( ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_client) || TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_oldClient) ) && ev->type() == TQEvent::MouseMove ) + mouseMoveEvent( TQT_TQMOUSEEVENT( ev ) ); return TQScrollView::eventFilter( obj, ev ); } @@ -543,7 +543,7 @@ void KImageCanvas::slotUpdateImage() if( m_bSizeChanged || m_bNewImage ) { - TQSize sh = m_client->sizeHint(); + TQSize sh = m_client->tqsizeHint(); if( ! sh.isValid() ) sh = TQSize( 0, 0 ); m_client->resize( sh ); @@ -587,7 +587,7 @@ void KImageCanvas::slotUpdateImage() void KImageCanvas::mouseMoveEvent( TQMouseEvent * ) { - if( m_cursor.shape() == Qt::BlankCursor ) + if( m_cursor.tqshape() == TQt::BlankCursor ) { m_cursor.setShape( Qt::CrossCursor ); viewport()->setCursor( m_cursor ); @@ -607,7 +607,7 @@ void KImageCanvas::resizeEvent( TQResizeEvent * ev ) void KImageCanvas::contentsMousePressEvent( TQMouseEvent * ev ) { - if ( ev->button() == RightButton ) + if ( ev->button() == Qt::RightButton ) emit contextPress( ev->globalPos() ); TQScrollView::contentsMousePressEvent( ev ); } @@ -935,7 +935,7 @@ KImageHolder * KImageCanvas::createNewClient() client->setMouseTracking( true ); client->installEventFilter( this ); setFocusProxy( client ); - client->setFocusPolicy( TQWidget::StrongFocus ); + client->setFocusPolicy( TQ_StrongFocus ); client->setFocus(); addChild( client, 0, 0 ); diff --git a/kview/kviewcanvas/kimagecanvas.h b/kview/kviewcanvas/kimagecanvas.h index 04934c74..c7af475e 100644 --- a/kview/kviewcanvas/kimagecanvas.h +++ b/kview/kviewcanvas/kimagecanvas.h @@ -42,11 +42,12 @@ class KPixmap; class KDE_EXPORT KImageCanvas : public TQScrollView, public KImageViewer::Canvas { Q_OBJECT + TQ_OBJECT public: /** * KImageCanvas Constructor */ - KImageCanvas( TQWidget * parent, const char * name, const TQStringList & args ); + KImageCanvas( TQWidget * tqparent, const char * name, const TQStringList & args ); /** * KImageCanvas Destructor diff --git a/kview/kviewcanvas/kimageholder.cpp b/kview/kviewcanvas/kimageholder.cpp index 6ca63698..13ee9e43 100644 --- a/kview/kviewcanvas/kimageholder.cpp +++ b/kview/kviewcanvas/kimageholder.cpp @@ -33,8 +33,8 @@ #include "kimageholder.h" -KImageHolder::KImageHolder( TQWidget * parent, const char * name ) - : TQWidget( parent, name, Qt::WResizeNoErase | Qt::WRepaintNoErase ) +KImageHolder::KImageHolder( TQWidget * tqparent, const char * name ) + : TQWidget( tqparent, name, TQt::WResizeNoErase | TQt::WRepaintNoErase ) , m_selected( false ) , m_bSelecting( false ) , m_scrollTimerId( 0 ) @@ -64,7 +64,7 @@ void KImageHolder::mousePressEvent( TQMouseEvent *ev ) { //kdDebug( 4620 ) << k_funcinfo << " ev->state() = " << ev->state() << endl; // if the right mouse button is pressed emit the contextPress signal - if ( ev->button() == RightButton ) + if ( ev->button() == Qt::RightButton ) { emit contextPress( mapToGlobal( ev->pos() ) ); return; @@ -73,7 +73,7 @@ void KImageHolder::mousePressEvent( TQMouseEvent *ev ) if( m_pPixmap == 0 ) return; - if( ev->button() == LeftButton || ev->button() == MidButton ) + if( ev->button() == Qt::LeftButton || ev->button() == Qt::MidButton ) { m_scrollpos = ev->globalPos(); m_selectionStartPoint = ev->pos(); @@ -83,20 +83,20 @@ void KImageHolder::mousePressEvent( TQMouseEvent *ev ) void KImageHolder::mouseMoveEvent( TQMouseEvent *ev ) { //FIXME: when scrolling the cursorpos shouldn't change - if( this->rect().contains( ev->pos(), false ) ) + if( TQT_TQRECT_OBJECT(this->rect()).tqcontains( ev->pos(), false ) ) emit cursorPos( ev->pos() ); //kdDebug( 4620 ) << k_funcinfo << " ev->state() = " << ev->state() << endl; - if( ev->state() & LeftButton || ev->state() & MidButton ) + if( ev->state() & Qt::LeftButton || ev->state() & Qt::MidButton ) { // scroll when a modifier and left button or the middle button is pressed - if( ev->state() & AltButton || ev->state() & ControlButton || ev->state() & ShiftButton || ev->state() & MidButton ) + if( ev->state() & AltButton || ev->state() & ControlButton || ev->state() & ShiftButton || ev->state() & Qt::MidButton ) { TQPoint difference = m_scrollpos - ev->globalPos(); emit wannaScroll( difference.x(), difference.y() ); } else // create a selection { - TQWidget * parentwidget = ( TQWidget* )parent(); + TQWidget * tqparentwidget = ( TQWidget* )tqparent(); if( ! m_bSelecting ) { m_bSelecting = true; @@ -127,17 +127,17 @@ void KImageHolder::mouseMoveEvent( TQMouseEvent *ev ) // -2 => scroll to the left 2 px per 50ms // 2 => scroll to the right 2 px per 50ms // ... - m_xOffset = mapTo( parentwidget, ev->pos() ).x(); - m_yOffset = mapTo( parentwidget, ev->pos() ).y(); + m_xOffset = mapTo( tqparentwidget, ev->pos() ).x(); + m_yOffset = mapTo( tqparentwidget, ev->pos() ).y(); if( m_xOffset > 0 ) { - m_xOffset -= parentwidget->width(); + m_xOffset -= tqparentwidget->width(); if( m_xOffset < 0 ) m_xOffset = 0; } if( m_yOffset > 0 ) { - m_yOffset -= parentwidget->height(); + m_yOffset -= tqparentwidget->height(); if( m_yOffset < 0 ) m_yOffset = 0; } @@ -181,7 +181,7 @@ void KImageHolder::mouseReleaseEvent( TQMouseEvent * ev ) m_scrollTimerId = 0; } } - if( ev->state() & LeftButton || ev->state() & MidButton ) + if( ev->state() & Qt::LeftButton || ev->state() & Qt::MidButton ) if( m_bSelecting ) m_bSelecting = false; else @@ -207,7 +207,7 @@ void KImageHolder::eraseSelect() inner.rBottom() -= 1; r -= inner; - TQMemArray<TQRect> rects = r.rects(); + TQMemArray<TQRect> rects = r.tqrects(); if( m_pDoubleBuffer ) for( unsigned int i = 0; i < rects.size(); ++i ) @@ -269,7 +269,7 @@ TQRect KImageHolder::selection() const return TQRect(); } -TQSize KImageHolder::sizeHint() const +TQSize KImageHolder::tqsizeHint() const { if( m_pPixmap ) return m_pPixmap->size(); @@ -282,7 +282,7 @@ void KImageHolder::paintEvent( TQPaintEvent *ev ) painter.setClipRegion( ev->region().intersect( m_drawRect ) ); if( m_pPixmap ) { - if( m_pPixmap->mask() ) + if( m_pPixmap->tqmask() ) { if( ! m_pDoubleBuffer ) { diff --git a/kview/kviewcanvas/kimageholder.h b/kview/kviewcanvas/kimageholder.h index 73148cbf..d8d220c0 100644 --- a/kview/kviewcanvas/kimageholder.h +++ b/kview/kviewcanvas/kimageholder.h @@ -32,11 +32,12 @@ class TQPoint; * @short Image widget * @version $Id$ */ -class KImageHolder : public QWidget +class KImageHolder : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KImageHolder( TQWidget *parent = 0, const char * name = 0 ); + KImageHolder( TQWidget *tqparent = 0, const char * name = 0 ); virtual ~KImageHolder(); @@ -56,7 +57,7 @@ class KImageHolder : public QWidget */ TQRect selection() const; - TQSize sizeHint() const; + TQSize tqsizeHint() const; void setDrawRect( const TQRect & rect ) { m_drawRect = rect; } const TQRect & drawRect() const { return m_drawRect; } diff --git a/kview/kviewcanvas/test/test.cpp b/kview/kviewcanvas/test/test.cpp index e913ab59..3d24cbce 100644 --- a/kview/kviewcanvas/test/test.cpp +++ b/kview/kviewcanvas/test/test.cpp @@ -17,7 +17,7 @@ KImageViewerTest::KImageViewerTest() : KParts::MainWindow( 0L, "KImageViewerTest" ) { TQWidget * widget = KParts::ComponentFactory::createInstanceFromQuery<TQWidget>( - "KImageViewer/Canvas", TQString::null, this ); + "KImageViewer/Canvas", TQString(), this ); if( widget ) { m_part = dynamic_cast<KImageViewer::Canvas *>( widget ); diff --git a/kview/kviewcanvas/test/test.h b/kview/kviewcanvas/test/test.h index b6a85188..f04866ef 100644 --- a/kview/kviewcanvas/test/test.h +++ b/kview/kviewcanvas/test/test.h @@ -13,6 +13,7 @@ namespace KImageViewer { class Canvas; }; class KImageViewerTest : public KParts::MainWindow { Q_OBJECT + TQ_OBJECT public: KImageViewerTest(); virtual ~KImageViewerTest(); |