diff options
Diffstat (limited to 'doc/html/qmag-example.html')
-rw-r--r-- | doc/html/qmag-example.html | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/doc/html/qmag-example.html b/doc/html/qmag-example.html index 475290a05..f65ca6bf9 100644 --- a/doc/html/qmag-example.html +++ b/doc/html/qmag-example.html @@ -65,11 +65,11 @@ magnified area as a .bmp file. #include <<a href="qwmatrix-h.html">ntqwmatrix.h</a>> -class MagWidget : public <a href="ntqwidget.html">TQWidget</a> +class MagWidget : public <a href="tqwidget.html">TQWidget</a> { <a href="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> public: - MagWidget( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char *name=0 ); + MagWidget( <a href="tqwidget.html">TQWidget</a> *parent=0, const char *name=0 ); public slots: void setZoom( int ); @@ -123,8 +123,8 @@ static const int timer[] = { 0, 20, 250, 333, 500, 1000, 2000, 3000, 5000, 10000 }; -<a name="f484"></a>MagWidget::MagWidget( <a href="ntqwidget.html">TQWidget</a> *parent, const char *name ) - : <a href="ntqwidget.html">TQWidget</a>( parent, name) +<a name="f484"></a>MagWidget::MagWidget( <a href="tqwidget.html">TQWidget</a> *parent, const char *name ) + : <a href="tqwidget.html">TQWidget</a>( parent, name) { z = 1; // default zoom (100%) r = 0; // default refresh (none) @@ -143,40 +143,40 @@ static const int timer[] = { <a href="tqobject.html#connect">connect</a>( refresh, TQ_SIGNAL(<a href="ntqcombobox.html#activated">activated</a>(int)), TQ_SLOT(setRefresh(int)) ); for( n=0; n<9; n++) { -<a name="x1797"></a> int w2 = zoom-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().width( zoomfactors[n] ); +<a name="x1797"></a> int w2 = zoom-><a href="tqwidget.html#fontMetrics">fontMetrics</a>().width( zoomfactors[n] ); w = TQMAX(w2, w); } -<a name="x1807"></a> zoom-><a href="ntqwidget.html#setGeometry">setGeometry</a>( 2, 2, w+30, 20 ); +<a name="x1807"></a> zoom-><a href="tqwidget.html#setGeometry">setGeometry</a>( 2, 2, w+30, 20 ); x = w+34; w = 0; for( n=0; n<9; n++) { - int w2 = refresh-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().width( refreshrates[n] ); + int w2 = refresh-><a href="tqwidget.html#fontMetrics">fontMetrics</a>().width( refreshrates[n] ); w = TQMAX(w2, w); } - refresh-><a href="ntqwidget.html#setGeometry">setGeometry</a>( x, 2, w+30, 20 ); + refresh-><a href="tqwidget.html#setGeometry">setGeometry</a>( x, 2, w+30, 20 ); saveButton = new <a href="ntqpushbutton.html">TQPushButton</a>( this ); <a href="ntqapplication.html#TQ_CHECK_PTR">TQ_CHECK_PTR</a>(saveButton); <a href="tqobject.html#connect">connect</a>( saveButton, TQ_SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), this, TQ_SLOT(save()) ); <a name="x1771"></a> saveButton-><a href="ntqbutton.html#setText">setText</a>( "Save" ); -<a name="x1788"></a> saveButton-><a href="ntqwidget.html#setGeometry">setGeometry</a>( x+w+30+2, 2, - 10+saveButton-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().width("Save"), 20 ); +<a name="x1788"></a> saveButton-><a href="tqwidget.html#setGeometry">setGeometry</a>( x+w+30+2, 2, + 10+saveButton-><a href="tqwidget.html#fontMetrics">fontMetrics</a>().width("Save"), 20 ); multiSaveButton = new <a href="ntqpushbutton.html">TQPushButton</a>( this ); <a name="x1790"></a> multiSaveButton-><a href="ntqpushbutton.html#setToggleButton">setToggleButton</a>(TRUE); <a href="ntqapplication.html#TQ_CHECK_PTR">TQ_CHECK_PTR</a>(multiSaveButton); <a href="tqobject.html#connect">connect</a>( multiSaveButton, TQ_SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), this, TQ_SLOT(multiSave()) ); multiSaveButton-><a href="ntqbutton.html#setText">setText</a>( "MultiSave" ); -<a name="x1798"></a> multiSaveButton-><a href="ntqwidget.html#setGeometry">setGeometry</a>( saveButton-><a href="ntqwidget.html#geometry">geometry</a>().right() + 2, 2, - 10+multiSaveButton-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().width("MultiSave"), 20 ); +<a name="x1798"></a> multiSaveButton-><a href="tqwidget.html#setGeometry">setGeometry</a>( saveButton-><a href="tqwidget.html#geometry">geometry</a>().right() + 2, 2, + 10+multiSaveButton-><a href="tqwidget.html#fontMetrics">fontMetrics</a>().width("MultiSave"), 20 ); quitButton = new <a href="ntqpushbutton.html">TQPushButton</a>( this ); <a href="ntqapplication.html#TQ_CHECK_PTR">TQ_CHECK_PTR</a>(quitButton); <a href="tqobject.html#connect">connect</a>( quitButton, TQ_SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), tqApp, TQ_SLOT(<a href="ntqapplication.html#quit">quit</a>()) ); quitButton-><a href="ntqbutton.html#setText">setText</a>( "Quit" ); - quitButton-><a href="ntqwidget.html#setGeometry">setGeometry</a>( multiSaveButton-><a href="ntqwidget.html#geometry">geometry</a>().right() + 2, 2, - 10+quitButton-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().width("Quit"), 20 ); + quitButton-><a href="tqwidget.html#setGeometry">setGeometry</a>( multiSaveButton-><a href="tqwidget.html#geometry">geometry</a>().right() + 2, 2, + 10+quitButton-><a href="tqwidget.html#fontMetrics">fontMetrics</a>().width("Quit"), 20 ); #else zoom = 0; multiSaveButton = 0; @@ -189,23 +189,23 @@ static const int timer[] = { <a href="ntqapplication.html#TQ_CHECK_PTR">TQ_CHECK_PTR</a>( rgb ); <a name="x1779"></a> rgb-><a href="ntqlabel.html#setText">setText</a>( "" ); rgb-><a href="ntqlabel.html#setAlignment">setAlignment</a>( AlignVCenter ); - rgb-><a href="ntqwidget.html#resize">resize</a>( <a href="ntqwidget.html#width">width</a>(), rgb-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().height() + 4 ); + rgb-><a href="tqwidget.html#resize">resize</a>( <a href="tqwidget.html#width">width</a>(), rgb-><a href="tqwidget.html#fontMetrics">fontMetrics</a>().height() + 4 ); #ifdef COMPLEX_GUI -<a name="x1799"></a> yoffset = zoom-><a href="ntqwidget.html#height">height</a>() // top buttons +<a name="x1799"></a> yoffset = zoom-><a href="tqwidget.html#height">height</a>() // top buttons + 4 // space around top buttons - + rgb-><a href="ntqwidget.html#height">height</a>(); // color-value text height -<a name="x1804"></a> <a href="ntqwidget.html#setMinimumSize">setMinimumSize</a>( quitButton-><a href="ntqwidget.html#pos">pos</a>().x(), yoffset+20 ); - <a href="ntqwidget.html#resize">resize</a>( quitButton-><a href="ntqwidget.html#geometry">geometry</a>().topRight().x() + 2, yoffset+60 ); + + rgb-><a href="tqwidget.html#height">height</a>(); // color-value text height +<a name="x1804"></a> <a href="tqwidget.html#setMinimumSize">setMinimumSize</a>( quitButton-><a href="tqwidget.html#pos">pos</a>().x(), yoffset+20 ); + <a href="tqwidget.html#resize">resize</a>( quitButton-><a href="tqwidget.html#geometry">geometry</a>().topRight().x() + 2, yoffset+60 ); #else yoffset = 0; - <a href="ntqwidget.html#resize">resize</a>(350,350); + <a href="tqwidget.html#resize">resize</a>(350,350); #endif grabx = graby = -1; grabbing = FALSE; - <a href="ntqwidget.html#setMouseTracking">setMouseTracking</a>( TRUE ); // and do let me know what pixel I'm at, eh? + <a href="tqwidget.html#setMouseTracking">setMouseTracking</a>( TRUE ); // and do let me know what pixel I'm at, eh? <a name="x1765"></a> grabAround( TQPoint(grabx=tqApp-><a href="ntqapplication.html#desktop">desktop</a>()->width()/2, graby=tqApp-><a href="ntqapplication.html#desktop">desktop</a>()->height()/2) ); } @@ -267,8 +267,8 @@ void <a name="f489"></a>MagWidget::grab() int x,y, w,h; - w = (<a href="ntqwidget.html#width">width</a>()+z-1)/z; - h = (<a href="ntqwidget.html#height">height</a>()+z-1-yoffset)/z; + w = (<a href="tqwidget.html#width">width</a>()+z-1)/z; + h = (<a href="tqwidget.html#height">height</a>()+z-1-yoffset)/z; if ( w<1 || h<1 ) return; // don't ask too much from the window system :) @@ -290,61 +290,61 @@ void <a name="f489"></a>MagWidget::grab() <a name="x1787"></a> pm = p.<a href="ntqpixmap.html#xForm">xForm</a>( m ); <a name="x1770"></a> if ( !multiSaveButton || !multiSaveButton-><a href="ntqbutton.html#isOn">isOn</a>() ) - <a href="ntqwidget.html#repaint">repaint</a>( FALSE ); // and finally repaint, flicker-free + <a href="tqwidget.html#repaint">repaint</a>( FALSE ); // and finally repaint, flicker-free } -<a name="x1803"></a>void MagWidget::<a href="ntqwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) +<a name="x1803"></a>void MagWidget::<a href="tqwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) { if ( !pm.<a href="ntqpixmap.html#isNull">isNull</a>() ) { <a href="ntqpainter.html">TQPainter</a> paint( this ); -<a name="x1782"></a> paint.<a href="ntqpainter.html#drawPixmap">drawPixmap</a>( 0, zoom ? zoom-><a href="ntqwidget.html#height">height</a>()+4 : 0, pm, +<a name="x1782"></a> paint.<a href="ntqpainter.html#drawPixmap">drawPixmap</a>( 0, zoom ? zoom-><a href="tqwidget.html#height">height</a>()+4 : 0, pm, 0,0, width(), height()-yoffset ); } } -<a name="x1801"></a>void MagWidget::<a href="ntqwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +<a name="x1801"></a>void MagWidget::<a href="tqwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { if ( !grabbing ) { // prepare to grab... grabbing = TRUE; <a href="tqobject.html#killTimers">killTimers</a>(); - <a href="ntqwidget.html#grabMouse">grabMouse</a>( crossCursor ); + <a href="tqwidget.html#grabMouse">grabMouse</a>( crossCursor ); grabx = -1; graby = -1; } else { // REALLY prepare to grab -<a name="x1780"></a> grabx = <a href="ntqwidget.html#mapToGlobal">mapToGlobal</a>(e-><a href="qmouseevent.html#pos">pos</a>()).x(); - graby = <a href="ntqwidget.html#mapToGlobal">mapToGlobal</a>(e-><a href="qmouseevent.html#pos">pos</a>()).y(); +<a name="x1780"></a> grabx = <a href="tqwidget.html#mapToGlobal">mapToGlobal</a>(e-><a href="qmouseevent.html#pos">pos</a>()).x(); + graby = <a href="tqwidget.html#mapToGlobal">mapToGlobal</a>(e-><a href="qmouseevent.html#pos">pos</a>()).y(); } } -<a name="x1802"></a>void MagWidget::<a href="ntqwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> * e ) +<a name="x1802"></a>void MagWidget::<a href="tqwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> * e ) { if ( grabbing && grabx >= 0 && graby >= 0 ) { grabbing = FALSE; grabAround(e-><a href="qmouseevent.html#pos">pos</a>()); - <a href="ntqwidget.html#releaseMouse">releaseMouse</a>(); + <a href="tqwidget.html#releaseMouse">releaseMouse</a>(); } } void <a name="f490"></a>MagWidget::grabAround(TQPoint pos) { int rx, ry; - rx = <a href="ntqwidget.html#mapToGlobal">mapToGlobal</a>(pos).x(); - ry = <a href="ntqwidget.html#mapToGlobal">mapToGlobal</a>(pos).y(); + rx = <a href="tqwidget.html#mapToGlobal">mapToGlobal</a>(pos).x(); + ry = <a href="tqwidget.html#mapToGlobal">mapToGlobal</a>(pos).y(); int w = TQABS(rx-grabx); int h = TQABS(ry-graby); if ( w > 10 && h > 10 ) { int pz; pz = 1; - while ( w*pz*h*pz < width()*(<a href="ntqwidget.html#height">height</a>()-yoffset) && + while ( w*pz*h*pz < width()*(<a href="tqwidget.html#height">height</a>()-yoffset) && w*pz < TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->width() && h*pz < TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->height() ) pz++; - if ( (w*pz*h*pz - width()*(<a href="ntqwidget.html#height">height</a>()-yoffset)) > - (<a href="ntqwidget.html#width">width</a>()*(<a href="ntqwidget.html#height">height</a>()-yoffset) - w*(pz-1)*h*(pz-1)) ) + if ( (w*pz*h*pz - width()*(<a href="tqwidget.html#height">height</a>()-yoffset)) > + (<a href="tqwidget.html#width">width</a>()*(<a href="tqwidget.html#height">height</a>()-yoffset) - w*(pz-1)*h*(pz-1)) ) pz--; if ( pz < 1 ) pz = 1; @@ -356,7 +356,7 @@ void <a name="f490"></a>MagWidget::grabAround(TQPoint pos) z = pz; grabx = TQMIN(rx, grabx) + w/2; graby = TQMIN(ry, graby) + h/2; - <a href="ntqwidget.html#resize">resize</a>( w*z, h*z+yoffset ); + <a href="tqwidget.html#resize">resize</a>( w*z, h*z+yoffset ); } grab(); if ( r ) @@ -364,16 +364,16 @@ void <a name="f490"></a>MagWidget::grabAround(TQPoint pos) } -<a name="x1800"></a>void MagWidget::<a href="ntqwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +<a name="x1800"></a>void MagWidget::<a href="tqwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { if ( grabbing || pm.<a href="ntqpixmap.html#isNull">isNull</a>() || - e-><a href="qmouseevent.html#pos">pos</a>().y() > height() - (zoom ? zoom-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().height() - 4 : 0) || - e-><a href="qmouseevent.html#pos">pos</a>().y() < (zoom ? zoom-><a href="ntqwidget.html#height">height</a>()+4 : 4) ) { + e-><a href="qmouseevent.html#pos">pos</a>().y() > height() - (zoom ? zoom-><a href="tqwidget.html#fontMetrics">fontMetrics</a>().height() - 4 : 0) || + e-><a href="qmouseevent.html#pos">pos</a>().y() < (zoom ? zoom-><a href="tqwidget.html#height">height</a>()+4 : 4) ) { rgb-><a href="ntqlabel.html#setText">setText</a>( "" ); } else { int x,y; x = e-><a href="qmouseevent.html#pos">pos</a>().x() / z; - y = (e-><a href="qmouseevent.html#pos">pos</a>().y() - ( zoom ? zoom-><a href="ntqwidget.html#height">height</a>() : 0 ) - 4) / z; + y = (e-><a href="qmouseevent.html#pos">pos</a>().y() - ( zoom ? zoom-><a href="tqwidget.html#height">height</a>() : 0 ) - 4) / z; <a href="ntqstring.html">TQString</a> pixelinfo; <a name="x1777"></a> if ( image.<a href="ntqimage.html#valid">valid</a>(x,y) ) { @@ -390,7 +390,7 @@ void <a name="f490"></a>MagWidget::grabAround(TQPoint pos) } -<a name="x1796"></a>void MagWidget::<a href="ntqwidget.html#focusOutEvent">focusOutEvent</a>( <a href="qfocusevent.html">TQFocusEvent</a> * ) +<a name="x1796"></a>void MagWidget::<a href="tqwidget.html#focusOutEvent">focusOutEvent</a>( <a href="qfocusevent.html">TQFocusEvent</a> * ) { rgb-><a href="ntqlabel.html#setText">setText</a>( "" ); } @@ -414,9 +414,9 @@ void <a name="f490"></a>MagWidget::grabAround(TQPoint pos) } -<a name="x1806"></a>void MagWidget::<a href="ntqwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> * ) +<a name="x1806"></a>void MagWidget::<a href="tqwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> * ) { - rgb-><a href="ntqwidget.html#setGeometry">setGeometry</a>( 0, height() - rgb-><a href="ntqwidget.html#height">height</a>(), width(), rgb-><a href="ntqwidget.html#height">height</a>() ); + rgb-><a href="tqwidget.html#setGeometry">setGeometry</a>( 0, height() - rgb-><a href="tqwidget.html#height">height</a>(), width(), rgb-><a href="tqwidget.html#height">height</a>() ); grab(); } @@ -429,7 +429,7 @@ int main( int argc, char **argv ) <a href="ntqapplication.html">TQApplication</a> a( argc, argv ); MagWidget m; a.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &m ); - m.<a href="ntqwidget.html#show">show</a>(); + m.<a href="tqwidget.html#show">show</a>(); return a.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |