diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/qmag-example.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/qmag-example.html')
-rw-r--r-- | doc/html/qmag-example.html | 296 |
1 files changed, 148 insertions, 148 deletions
diff --git a/doc/html/qmag-example.html b/doc/html/qmag-example.html index 2a6e5b034..c13c4c62b 100644 --- a/doc/html/qmag-example.html +++ b/doc/html/qmag-example.html @@ -52,24 +52,24 @@ magnified area as a .bmp file. ** *****************************************************************************/ -#include <<a href="qcombobox-h.html">qcombobox.h</a>> -#include <<a href="qpushbutton-h.html">qpushbutton.h</a>> -#include <<a href="qpixmap-h.html">qpixmap.h</a>> -#include <<a href="qimage-h.html">qimage.h</a>> -#include <<a href="qlabel-h.html">qlabel.h</a>> -#include <<a href="qfiledialog-h.html">qfiledialog.h</a>> -#include <<a href="qregexp-h.html">qregexp.h</a>> +#include <<a href="qcombobox-h.html">ntqcombobox.h</a>> +#include <<a href="qpushbutton-h.html">ntqpushbutton.h</a>> +#include <<a href="qpixmap-h.html">ntqpixmap.h</a>> +#include <<a href="qimage-h.html">ntqimage.h</a>> +#include <<a href="qlabel-h.html">ntqlabel.h</a>> +#include <<a href="qfiledialog-h.html">ntqfiledialog.h</a>> +#include <<a href="qregexp-h.html">ntqregexp.h</a>> -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> -#include <<a href="qwmatrix-h.html">qwmatrix.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> +#include <<a href="qwmatrix-h.html">ntqwmatrix.h</a>> -class MagWidget : public <a href="qwidget.html">TQWidget</a> +class MagWidget : public <a href="ntqwidget.html">TQWidget</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - MagWidget( <a href="qwidget.html">TQWidget</a> *parent=0, const char *name=0 ); + MagWidget( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char *name=0 ); public slots: void setZoom( int ); @@ -90,21 +90,21 @@ private: void grabAround(TQPoint pos); void grab(); - <a href="qcombobox.html">TQComboBox</a> *zoom; - <a href="qcombobox.html">TQComboBox</a> *refresh; - <a href="qpushbutton.html">TQPushButton</a> *saveButton; - <a href="qpushbutton.html">TQPushButton</a> *multiSaveButton; - <a href="qpushbutton.html">TQPushButton</a> *quitButton; - <a href="qpixmap.html">TQPixmap</a> pm; // pixmap, magnified - <a href="qpixmap.html">TQPixmap</a> p; // pixmap - <a href="qimage.html">TQImage</a> image; // image of pixmap (for RGB) - <a href="qlabel.html">TQLabel</a> *rgb; + <a href="ntqcombobox.html">TQComboBox</a> *zoom; + <a href="ntqcombobox.html">TQComboBox</a> *refresh; + <a href="ntqpushbutton.html">TQPushButton</a> *saveButton; + <a href="ntqpushbutton.html">TQPushButton</a> *multiSaveButton; + <a href="ntqpushbutton.html">TQPushButton</a> *quitButton; + <a href="ntqpixmap.html">TQPixmap</a> pm; // pixmap, magnified + <a href="ntqpixmap.html">TQPixmap</a> p; // pixmap + <a href="ntqimage.html">TQImage</a> image; // image of pixmap (for RGB) + <a href="ntqlabel.html">TQLabel</a> *rgb; int yoffset; // pixels in addition to the actual picture int z; // magnification factor int r; // autorefresh rate (index into refreshrates) bool grabbing; // TRUE if qmag is currently grabbing int grabx, graby; - <a href="qstring.html">TQString</a> multifn; // filename for multisave + <a href="ntqstring.html">TQString</a> multifn; // filename for multisave }; @@ -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="qwidget.html">TQWidget</a> *parent, const char *name ) - : <a href="qwidget.html">TQWidget</a>( parent, name) +<a name="f484"></a>MagWidget::MagWidget( <a href="ntqwidget.html">TQWidget</a> *parent, const char *name ) + : <a href="ntqwidget.html">TQWidget</a>( parent, name) { z = 1; // default zoom (100%) r = 0; // default refresh (none) @@ -132,51 +132,51 @@ static const int timer[] = { #ifdef COMPLEX_GUI int w=0, x=0, n; - zoom = new <a href="qcombobox.html">TQComboBox</a>( FALSE, this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(zoom); -<a name="x1773"></a> zoom-><a href="qcombobox.html#insertStrList">insertStrList</a>( zoomfactors, 9 ); -<a name="x1772"></a> <a href="qobject.html#connect">connect</a>( zoom, SIGNAL(<a href="qcombobox.html#activated">activated</a>(int)), SLOT(setZoom(int)) ); + zoom = new <a href="ntqcombobox.html">TQComboBox</a>( FALSE, this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(zoom); +<a name="x1773"></a> zoom-><a href="ntqcombobox.html#insertStrList">insertStrList</a>( zoomfactors, 9 ); +<a name="x1772"></a> <a href="ntqobject.html#connect">connect</a>( zoom, SIGNAL(<a href="ntqcombobox.html#activated">activated</a>(int)), SLOT(setZoom(int)) ); - refresh = new <a href="qcombobox.html">TQComboBox</a>( FALSE, this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(refresh); - refresh-><a href="qcombobox.html#insertStrList">insertStrList</a>( refreshrates, 9 ); - <a href="qobject.html#connect">connect</a>( refresh, SIGNAL(<a href="qcombobox.html#activated">activated</a>(int)), SLOT(setRefresh(int)) ); + refresh = new <a href="ntqcombobox.html">TQComboBox</a>( FALSE, this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(refresh); + refresh-><a href="ntqcombobox.html#insertStrList">insertStrList</a>( refreshrates, 9 ); + <a href="ntqobject.html#connect">connect</a>( refresh, SIGNAL(<a href="ntqcombobox.html#activated">activated</a>(int)), SLOT(setRefresh(int)) ); for( n=0; n<9; n++) { -<a name="x1797"></a> int w2 = zoom-><a href="qwidget.html#fontMetrics">fontMetrics</a>().width( zoomfactors[n] ); +<a name="x1797"></a> int w2 = zoom-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().width( zoomfactors[n] ); w = TQMAX(w2, w); } -<a name="x1807"></a> zoom-><a href="qwidget.html#setGeometry">setGeometry</a>( 2, 2, w+30, 20 ); +<a name="x1807"></a> zoom-><a href="ntqwidget.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="qwidget.html#fontMetrics">fontMetrics</a>().width( refreshrates[n] ); + int w2 = refresh-><a href="ntqwidget.html#fontMetrics">fontMetrics</a>().width( refreshrates[n] ); w = TQMAX(w2, w); } - refresh-><a href="qwidget.html#setGeometry">setGeometry</a>( x, 2, w+30, 20 ); - - saveButton = new <a href="qpushbutton.html">TQPushButton</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(saveButton); - <a href="qobject.html#connect">connect</a>( saveButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), this, SLOT(save()) ); -<a name="x1771"></a> saveButton-><a href="qbutton.html#setText">setText</a>( "Save" ); -<a name="x1788"></a> saveButton-><a href="qwidget.html#setGeometry">setGeometry</a>( x+w+30+2, 2, - 10+saveButton-><a href="qwidget.html#fontMetrics">fontMetrics</a>().width("Save"), 20 ); - - multiSaveButton = new <a href="qpushbutton.html">TQPushButton</a>( this ); -<a name="x1790"></a> multiSaveButton-><a href="qpushbutton.html#setToggleButton">setToggleButton</a>(TRUE); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(multiSaveButton); - <a href="qobject.html#connect">connect</a>( multiSaveButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), this, SLOT(multiSave()) ); - multiSaveButton-><a href="qbutton.html#setText">setText</a>( "MultiSave" ); -<a name="x1798"></a> multiSaveButton-><a href="qwidget.html#setGeometry">setGeometry</a>( saveButton-><a href="qwidget.html#geometry">geometry</a>().right() + 2, 2, - 10+multiSaveButton-><a href="qwidget.html#fontMetrics">fontMetrics</a>().width("MultiSave"), 20 ); - - quitButton = new <a href="qpushbutton.html">TQPushButton</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(quitButton); - <a href="qobject.html#connect">connect</a>( quitButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), qApp, SLOT(<a href="qapplication.html#quit">quit</a>()) ); - quitButton-><a href="qbutton.html#setText">setText</a>( "Quit" ); - quitButton-><a href="qwidget.html#setGeometry">setGeometry</a>( multiSaveButton-><a href="qwidget.html#geometry">geometry</a>().right() + 2, 2, - 10+quitButton-><a href="qwidget.html#fontMetrics">fontMetrics</a>().width("Quit"), 20 ); + refresh-><a href="ntqwidget.html#setGeometry">setGeometry</a>( x, 2, w+30, 20 ); + + saveButton = new <a href="ntqpushbutton.html">TQPushButton</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(saveButton); + <a href="ntqobject.html#connect">connect</a>( saveButton, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), this, 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 ); + + 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#Q_CHECK_PTR">Q_CHECK_PTR</a>(multiSaveButton); + <a href="ntqobject.html#connect">connect</a>( multiSaveButton, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), this, 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 ); + + quitButton = new <a href="ntqpushbutton.html">TQPushButton</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>(quitButton); + <a href="ntqobject.html#connect">connect</a>( quitButton, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), qApp, 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 ); #else zoom = 0; multiSaveButton = 0; @@ -185,29 +185,29 @@ static const int timer[] = { setRefresh(1); setZoom(5); - rgb = new <a href="qlabel.html">TQLabel</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( rgb ); -<a name="x1779"></a> rgb-><a href="qlabel.html#setText">setText</a>( "" ); - rgb-><a href="qlabel.html#setAlignment">setAlignment</a>( AlignVCenter ); - rgb-><a href="qwidget.html#resize">resize</a>( <a href="qwidget.html#width">width</a>(), rgb-><a href="qwidget.html#fontMetrics">fontMetrics</a>().height() + 4 ); + rgb = new <a href="ntqlabel.html">TQLabel</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_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 ); #ifdef COMPLEX_GUI -<a name="x1799"></a> yoffset = zoom-><a href="qwidget.html#height">height</a>() // top buttons +<a name="x1799"></a> yoffset = zoom-><a href="ntqwidget.html#height">height</a>() // top buttons + 4 // space around top buttons - + rgb-><a href="qwidget.html#height">height</a>(); // color-value text height -<a name="x1804"></a> <a href="qwidget.html#setMinimumSize">setMinimumSize</a>( quitButton-><a href="qwidget.html#pos">pos</a>().x(), yoffset+20 ); - <a href="qwidget.html#resize">resize</a>( quitButton-><a href="qwidget.html#geometry">geometry</a>().topRight().x() + 2, yoffset+60 ); + + 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 ); #else yoffset = 0; - <a href="qwidget.html#resize">resize</a>(350,350); + <a href="ntqwidget.html#resize">resize</a>(350,350); #endif grabx = graby = -1; grabbing = FALSE; - <a href="qwidget.html#setMouseTracking">setMouseTracking</a>( TRUE ); // and do let me know what pixel I'm at, eh? + <a href="ntqwidget.html#setMouseTracking">setMouseTracking</a>( TRUE ); // and do let me know what pixel I'm at, eh? -<a name="x1765"></a> grabAround( TQPoint(grabx=qApp-><a href="qapplication.html#desktop">desktop</a>()->width()/2, graby=qApp-><a href="qapplication.html#desktop">desktop</a>()->height()/2) ); +<a name="x1765"></a> grabAround( TQPoint(grabx=qApp-><a href="ntqapplication.html#desktop">desktop</a>()->width()/2, graby=qApp-><a href="ntqapplication.html#desktop">desktop</a>()->height()/2) ); } @@ -224,35 +224,35 @@ void <a name="f485"></a>MagWidget::setZoom( int index ) void <a name="f486"></a>MagWidget::setRefresh( int index ) { r = index; - <a href="qobject.html#killTimers">killTimers</a>(); + <a href="ntqobject.html#killTimers">killTimers</a>(); if (index && !grabbing) - <a href="qobject.html#startTimer">startTimer</a>( timer[r] ); + <a href="ntqobject.html#startTimer">startTimer</a>( timer[r] ); } void <a name="f487"></a>MagWidget::save() { -<a name="x1785"></a> if ( !p.<a href="qpixmap.html#isNull">isNull</a>() ) { - <a href="qobject.html#killTimers">killTimers</a>(); -<a name="x1775"></a> <a href="qstring.html">TQString</a> fn = TQFileDialog::<a href="qfiledialog.html#getSaveFileName">getSaveFileName</a>(); -<a name="x1792"></a> if ( !fn.<a href="qstring.html#isEmpty">isEmpty</a>() ) -<a name="x1786"></a> p.<a href="qpixmap.html#save">save</a>( fn, "BMP" ); +<a name="x1785"></a> if ( !p.<a href="ntqpixmap.html#isNull">isNull</a>() ) { + <a href="ntqobject.html#killTimers">killTimers</a>(); +<a name="x1775"></a> <a href="ntqstring.html">TQString</a> fn = TQFileDialog::<a href="ntqfiledialog.html#getSaveFileName">getSaveFileName</a>(); +<a name="x1792"></a> if ( !fn.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) +<a name="x1786"></a> p.<a href="ntqpixmap.html#save">save</a>( fn, "BMP" ); if ( r ) - <a href="qobject.html#startTimer">startTimer</a>( timer[r] ); + <a href="ntqobject.html#startTimer">startTimer</a>( timer[r] ); } } void <a name="f488"></a>MagWidget::multiSave() { - if ( !p.<a href="qpixmap.html#isNull">isNull</a>() ) { + if ( !p.<a href="ntqpixmap.html#isNull">isNull</a>() ) { multifn = ""; // stops saving - multifn = TQFileDialog::<a href="qfiledialog.html#getSaveFileName">getSaveFileName</a>(); - if ( multifn.<a href="qstring.html#isEmpty">isEmpty</a>() ) -<a name="x1789"></a> multiSaveButton-><a href="qpushbutton.html#setOn">setOn</a>(FALSE); + multifn = TQFileDialog::<a href="ntqfiledialog.html#getSaveFileName">getSaveFileName</a>(); + if ( multifn.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) +<a name="x1789"></a> multiSaveButton-><a href="ntqpushbutton.html#setOn">setOn</a>(FALSE); if ( !r ) - p.<a href="qpixmap.html#save">save</a>( multifn, "BMP" ); + p.<a href="ntqpixmap.html#save">save</a>( multifn, "BMP" ); } else { - multiSaveButton-><a href="qpushbutton.html#setOn">setOn</a>(FALSE); + multiSaveButton-><a href="ntqpushbutton.html#setOn">setOn</a>(FALSE); } } @@ -267,156 +267,156 @@ void <a name="f489"></a>MagWidget::grab() int x,y, w,h; - w = (<a href="qwidget.html#width">width</a>()+z-1)/z; - h = (<a href="qwidget.html#height">height</a>()+z-1-yoffset)/z; + w = (<a href="ntqwidget.html#width">width</a>()+z-1)/z; + h = (<a href="ntqwidget.html#height">height</a>()+z-1-yoffset)/z; if ( w<1 || h<1 ) return; // don't ask too much from the window system :) x = grabx-w/2; // find a suitable position to grab from y = graby-h/2; - if ( x + w > TQApplication::<a href="qapplication.html#desktop">desktop</a>()->width() ) - x = TQApplication::<a href="qapplication.html#desktop">desktop</a>()->width()-w; + if ( x + w > TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->width() ) + x = TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->width()-w; else if ( x < 0 ) x = 0; - if ( y + h > TQApplication::<a href="qapplication.html#desktop">desktop</a>()->height() ) - y = TQApplication::<a href="qapplication.html#desktop">desktop</a>()->height()-h; + if ( y + h > TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->height() ) + y = TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->height()-h; else if ( y < 0 ) y = 0; -<a name="x1784"></a> p = TQPixmap::<a href="qpixmap.html#grabWindow">grabWindow</a>( TQApplication::<a href="qapplication.html#desktop">desktop</a>()->winId(), x, y, w, h ); -<a name="x1783"></a> image = p.<a href="qpixmap.html#convertToImage">convertToImage</a>(); - <a href="qwmatrix.html">TQWMatrix</a> m; // after getting it, scale it -<a name="x1809"></a> m.<a href="qwmatrix.html#scale">scale</a>( (double)z, (double)z ); -<a name="x1787"></a> pm = p.<a href="qpixmap.html#xForm">xForm</a>( m ); +<a name="x1784"></a> p = TQPixmap::<a href="ntqpixmap.html#grabWindow">grabWindow</a>( TQApplication::<a href="ntqapplication.html#desktop">desktop</a>()->winId(), x, y, w, h ); +<a name="x1783"></a> image = p.<a href="ntqpixmap.html#convertToImage">convertToImage</a>(); + <a href="ntqwmatrix.html">TQWMatrix</a> m; // after getting it, scale it +<a name="x1809"></a> m.<a href="ntqwmatrix.html#scale">scale</a>( (double)z, (double)z ); +<a name="x1787"></a> pm = p.<a href="ntqpixmap.html#xForm">xForm</a>( m ); -<a name="x1770"></a> if ( !multiSaveButton || !multiSaveButton-><a href="qbutton.html#isOn">isOn</a>() ) - <a href="qwidget.html#repaint">repaint</a>( FALSE ); // and finally repaint, flicker-free +<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 name="x1803"></a>void MagWidget::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) +<a name="x1803"></a>void MagWidget::<a href="ntqwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) { - if ( !pm.<a href="qpixmap.html#isNull">isNull</a>() ) { - <a href="qpainter.html">TQPainter</a> paint( this ); -<a name="x1782"></a> paint.<a href="qpainter.html#drawPixmap">drawPixmap</a>( 0, zoom ? zoom-><a href="qwidget.html#height">height</a>()+4 : 0, pm, + 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, 0,0, width(), height()-yoffset ); } } -<a name="x1801"></a>void MagWidget::<a href="qwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +<a name="x1801"></a>void MagWidget::<a href="ntqwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { if ( !grabbing ) { // prepare to grab... grabbing = TRUE; - <a href="qobject.html#killTimers">killTimers</a>(); - <a href="qwidget.html#grabMouse">grabMouse</a>( crossCursor ); + <a href="ntqobject.html#killTimers">killTimers</a>(); + <a href="ntqwidget.html#grabMouse">grabMouse</a>( crossCursor ); grabx = -1; graby = -1; } else { // REALLY prepare to grab -<a name="x1780"></a> grabx = <a href="qwidget.html#mapToGlobal">mapToGlobal</a>(e-><a href="qmouseevent.html#pos">pos</a>()).x(); - graby = <a href="qwidget.html#mapToGlobal">mapToGlobal</a>(e-><a href="qmouseevent.html#pos">pos</a>()).y(); +<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="x1802"></a>void MagWidget::<a href="qwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> * e ) +<a name="x1802"></a>void MagWidget::<a href="ntqwidget.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="qwidget.html#releaseMouse">releaseMouse</a>(); + <a href="ntqwidget.html#releaseMouse">releaseMouse</a>(); } } void <a name="f490"></a>MagWidget::grabAround(TQPoint pos) { int rx, ry; - rx = <a href="qwidget.html#mapToGlobal">mapToGlobal</a>(pos).x(); - ry = <a href="qwidget.html#mapToGlobal">mapToGlobal</a>(pos).y(); + rx = <a href="ntqwidget.html#mapToGlobal">mapToGlobal</a>(pos).x(); + ry = <a href="ntqwidget.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="qwidget.html#height">height</a>()-yoffset) && - w*pz < TQApplication::<a href="qapplication.html#desktop">desktop</a>()->width() && - h*pz < TQApplication::<a href="qapplication.html#desktop">desktop</a>()->height() ) + while ( w*pz*h*pz < width()*(<a href="ntqwidget.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="qwidget.html#height">height</a>()-yoffset)) > - (<a href="qwidget.html#width">width</a>()*(<a href="qwidget.html#height">height</a>()-yoffset) - w*(pz-1)*h*(pz-1)) ) + 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)) ) pz--; if ( pz < 1 ) pz = 1; if ( pz > 8 ) pz = 8; if ( zoom ) -<a name="x1774"></a> zoom-><a href="qcombobox.html#setCurrentItem">setCurrentItem</a>( pz-1 ); +<a name="x1774"></a> zoom-><a href="ntqcombobox.html#setCurrentItem">setCurrentItem</a>( pz-1 ); z = pz; grabx = TQMIN(rx, grabx) + w/2; graby = TQMIN(ry, graby) + h/2; - <a href="qwidget.html#resize">resize</a>( w*z, h*z+yoffset ); + <a href="ntqwidget.html#resize">resize</a>( w*z, h*z+yoffset ); } grab(); if ( r ) - <a href="qobject.html#startTimer">startTimer</a>( timer[r] ); + <a href="ntqobject.html#startTimer">startTimer</a>( timer[r] ); } -<a name="x1800"></a>void MagWidget::<a href="qwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +<a name="x1800"></a>void MagWidget::<a href="ntqwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { - if ( grabbing || pm.<a href="qpixmap.html#isNull">isNull</a>() || - e-><a href="qmouseevent.html#pos">pos</a>().y() > height() - (zoom ? zoom-><a href="qwidget.html#fontMetrics">fontMetrics</a>().height() - 4 : 0) || - e-><a href="qmouseevent.html#pos">pos</a>().y() < (zoom ? zoom-><a href="qwidget.html#height">height</a>()+4 : 4) ) { - rgb-><a href="qlabel.html#setText">setText</a>( "" ); + 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) ) { + 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="qwidget.html#height">height</a>() : 0 ) - 4) / z; - <a href="qstring.html">TQString</a> pixelinfo; -<a name="x1777"></a> if ( image.<a href="qimage.html#valid">valid</a>(x,y) ) + y = (e-><a href="qmouseevent.html#pos">pos</a>().y() - ( zoom ? zoom-><a href="ntqwidget.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) ) { -<a name="x1776"></a> TQRgb px = image.<a href="qimage.html#pixel">pixel</a>(x,y); -<a name="x1795"></a> pixelinfo.<a href="qstring.html#sprintf">sprintf</a>(" %3d,%3d,%3d #%02x%02x%02x", - <a href="qcolor.html#qRed">qRed</a>(px), qGreen(px), qBlue(px), - <a href="qcolor.html#qRed">qRed</a>(px), qGreen(px), qBlue(px)); +<a name="x1776"></a> TQRgb px = image.<a href="ntqimage.html#pixel">pixel</a>(x,y); +<a name="x1795"></a> pixelinfo.<a href="ntqstring.html#sprintf">sprintf</a>(" %3d,%3d,%3d #%02x%02x%02x", + <a href="ntqcolor.html#qRed">qRed</a>(px), qGreen(px), qBlue(px), + <a href="ntqcolor.html#qRed">qRed</a>(px), qGreen(px), qBlue(px)); } - <a href="qstring.html">TQString</a> label; - label.<a href="qstring.html#sprintf">sprintf</a>( "x=%d, y=%d %s", + <a href="ntqstring.html">TQString</a> label; + label.<a href="ntqstring.html#sprintf">sprintf</a>( "x=%d, y=%d %s", x+grabx, y+graby, (const char*)pixelinfo ); - rgb-><a href="qlabel.html#setText">setText</a>( label ); + rgb-><a href="ntqlabel.html#setText">setText</a>( label ); } } -<a name="x1796"></a>void MagWidget::<a href="qwidget.html#focusOutEvent">focusOutEvent</a>( <a href="qfocusevent.html">TQFocusEvent</a> * ) +<a name="x1796"></a>void MagWidget::<a href="ntqwidget.html#focusOutEvent">focusOutEvent</a>( <a href="qfocusevent.html">TQFocusEvent</a> * ) { - rgb-><a href="qlabel.html#setText">setText</a>( "" ); + rgb-><a href="ntqlabel.html#setText">setText</a>( "" ); } -<a name="x1781"></a>void MagWidget::<a href="qobject.html#timerEvent">timerEvent</a>( <a href="qtimerevent.html">TQTimerEvent</a> * ) +<a name="x1781"></a>void MagWidget::<a href="ntqobject.html#timerEvent">timerEvent</a>( <a href="qtimerevent.html">TQTimerEvent</a> * ) { grab(); /* - if ( multiSaveButton-><a href="qbutton.html#isOn">isOn</a>() && !multifn.<a href="qstring.html#isEmpty">isEmpty</a>() ) { - <a href="qregexp.html">TQRegExp</a> num("[0-9][0-9]*"); + if ( multiSaveButton-><a href="ntqbutton.html#isOn">isOn</a>() && !multifn.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) { + <a href="ntqregexp.html">TQRegExp</a> num("[0-9][0-9]*"); int start; int len; -<a name="x1791"></a> if ((start=num.<a href="qregexp.html#match">match</a>(multifn,0,&len))>=0) -<a name="x1794"></a> multifn.<a href="qstring.html#replace">replace</a>(num, -<a name="x1793"></a> TQString().setNum(multifn.<a href="qstring.html#mid">mid</a>(start,len).toInt()+1) +<a name="x1791"></a> if ((start=num.<a href="ntqregexp.html#match">match</a>(multifn,0,&len))>=0) +<a name="x1794"></a> multifn.<a href="ntqstring.html#replace">replace</a>(num, +<a name="x1793"></a> TQString().setNum(multifn.<a href="ntqstring.html#mid">mid</a>(start,len).toInt()+1) ); - p.<a href="qpixmap.html#save">save</a>( multifn, "BMP" ); + p.<a href="ntqpixmap.html#save">save</a>( multifn, "BMP" ); } */ } -<a name="x1806"></a>void MagWidget::<a href="qwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> * ) +<a name="x1806"></a>void MagWidget::<a href="ntqwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> * ) { - rgb-><a href="qwidget.html#setGeometry">setGeometry</a>( 0, height() - rgb-><a href="qwidget.html#height">height</a>(), width(), rgb-><a href="qwidget.html#height">height</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>() ); grab(); } @@ -426,11 +426,11 @@ void <a name="f490"></a>MagWidget::grabAround(TQPoint pos) int main( int argc, char **argv ) { - <a href="qapplication.html">TQApplication</a> a( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> a( argc, argv ); MagWidget m; - a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &m ); - m.<a href="qwidget.html#show">show</a>(); - return a.<a href="qapplication.html#exec">exec</a>(); + a.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &m ); + m.<a href="ntqwidget.html#show">show</a>(); + return a.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |