diff options
Diffstat (limited to 'doc/html/qfd-example.html')
-rw-r--r-- | doc/html/qfd-example.html | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/doc/html/qfd-example.html b/doc/html/qfd-example.html index 87fc9ad7b..25a4a49b7 100644 --- a/doc/html/qfd-example.html +++ b/doc/html/qfd-example.html @@ -49,20 +49,20 @@ This example program displays all characters of a font. #ifndef FontDisplayer_H #define FontDisplayer_H -#include <<a href="qframe-h.html">qframe.h</a>> -#include <<a href="qmainwindow-h.html">qmainwindow.h</a>> +#include <<a href="qframe-h.html">ntqframe.h</a>> +#include <<a href="qmainwindow-h.html">ntqmainwindow.h</a>> class TQSlider; -class FontRowTable : public <a href="qframe.html">TQFrame</a> { +class FontRowTable : public <a href="ntqframe.html">TQFrame</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - FontRowTable( <a href="qwidget.html">TQWidget</a>* parent=0, const char* name=0 ); + FontRowTable( <a href="ntqwidget.html">TQWidget</a>* parent=0, const char* name=0 ); - <a href="qsize.html">TQSize</a> sizeHint() const; + <a href="ntqsize.html">TQSize</a> sizeHint() const; signals: - void fontInformation(const <a href="qstring.html">TQString</a>&); + void fontInformation(const <a href="ntqstring.html">TQString</a>&); public slots: void setRow(int); @@ -70,17 +70,17 @@ public slots: protected: - <a href="qsize.html">TQSize</a> cellSize() const; + <a href="ntqsize.html">TQSize</a> cellSize() const; void paintEvent( <a href="qpaintevent.html">TQPaintEvent</a>* ); private: - <a href="qfont.html">TQFont</a> tablefont; + <a href="ntqfont.html">TQFont</a> tablefont; int row; }; -class FontDisplayer : public <a href="qmainwindow.html">TQMainWindow</a> { +class FontDisplayer : public <a href="ntqmainwindow.html">TQMainWindow</a> { Q_OBJECT public: - FontDisplayer( <a href="qwidget.html">TQWidget</a>* parent=0, const char* name=0 ); + FontDisplayer( <a href="ntqwidget.html">TQWidget</a>* parent=0, const char* name=0 ); }; #endif @@ -99,97 +99,97 @@ public: *****************************************************************************/ #include "fontdisplayer.h" -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qslider-h.html">qslider.h</a>> -#include <<a href="qspinbox-h.html">qspinbox.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> -#include <<a href="qtoolbar-h.html">qtoolbar.h</a>> -#include <<a href="qstatusbar-h.html">qstatusbar.h</a>> -#include <<a href="qlabel-h.html">qlabel.h</a>> -#include <<a href="qpushbutton-h.html">qpushbutton.h</a>> -#include <<a href="qfontdialog-h.html">qfontdialog.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qslider-h.html">ntqslider.h</a>> +#include <<a href="qspinbox-h.html">ntqspinbox.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> +#include <<a href="qtoolbar-h.html">ntqtoolbar.h</a>> +#include <<a href="qstatusbar-h.html">ntqstatusbar.h</a>> +#include <<a href="qlabel-h.html">ntqlabel.h</a>> +#include <<a href="qpushbutton-h.html">ntqpushbutton.h</a>> +#include <<a href="qfontdialog-h.html">ntqfontdialog.h</a>> #include <stdlib.h> -<a name="f531"></a>FontRowTable::FontRowTable( <a href="qwidget.html">TQWidget</a>* parent, const char* name ) : - <a href="qframe.html">TQFrame</a>(parent,name) +<a name="f531"></a>FontRowTable::FontRowTable( <a href="ntqwidget.html">TQWidget</a>* parent, const char* name ) : + <a href="ntqframe.html">TQFrame</a>(parent,name) { - <a href="qwidget.html#setBackgroundMode">setBackgroundMode</a>(PaletteBase); - <a href="qframe.html#setFrameStyle">setFrameStyle</a>(Panel|Sunken); - <a href="qframe.html#setMargin">setMargin</a>(8); + <a href="ntqwidget.html#setBackgroundMode">setBackgroundMode</a>(PaletteBase); + <a href="ntqframe.html#setFrameStyle">setFrameStyle</a>(Panel|Sunken); + <a href="ntqframe.html#setMargin">setMargin</a>(8); setRow(0); -<a name="x1979"></a> tablefont = TQApplication::<a href="qapplication.html#font">font</a>(); +<a name="x1979"></a> tablefont = TQApplication::<a href="ntqapplication.html#font">font</a>(); } -<a name="x1996"></a>TQSize FontRowTable::<a href="qwidget.html#sizeHint">sizeHint</a>() const +<a name="x1996"></a>TQSize FontRowTable::<a href="ntqwidget.html#sizeHint">sizeHint</a>() const { - return 24*cellSize()+TQSize(2,2)*(<a href="qframe.html#margin">margin</a>()+frameWidth()); + return 24*cellSize()+TQSize(2,2)*(<a href="ntqframe.html#margin">margin</a>()+frameWidth()); } TQSize <a name="f532"></a>FontRowTable::cellSize() const { - <a href="qfontmetrics.html">TQFontMetrics</a> fm = <a href="qwidget.html#fontMetrics">fontMetrics</a>(); -<a name="x1990"></a><a name="x1989"></a> return TQSize( fm.<a href="qfontmetrics.html#maxWidth">maxWidth</a>(), fm.<a href="qfontmetrics.html#lineSpacing">lineSpacing</a>()+1 ); + <a href="ntqfontmetrics.html">TQFontMetrics</a> fm = <a href="ntqwidget.html#fontMetrics">fontMetrics</a>(); +<a name="x1990"></a><a name="x1989"></a> return TQSize( fm.<a href="ntqfontmetrics.html#maxWidth">maxWidth</a>(), fm.<a href="ntqfontmetrics.html#lineSpacing">lineSpacing</a>()+1 ); } -<a name="x1995"></a>void FontRowTable::<a href="qframe.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a>* e ) +<a name="x1995"></a>void FontRowTable::<a href="ntqframe.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a>* e ) { - TQFrame::<a href="qframe.html#paintEvent">paintEvent</a>(e); - <a href="qpainter.html">TQPainter</a> p(this); -<a name="x2002"></a><a name="x1999"></a> p.<a href="qpainter.html#setClipRegion">setClipRegion</a>(e-><a href="qpaintevent.html#region">region</a>()); -<a name="x2001"></a> <a href="qrect.html">TQRect</a> r = e-><a href="qpaintevent.html#rect">rect</a>(); - <a href="qfontmetrics.html">TQFontMetrics</a> fm = <a href="qwidget.html#fontMetrics">fontMetrics</a>(); -<a name="x1991"></a> int ml = <a href="qframe.html#frameWidth">frameWidth</a>()+margin() + 1 + TQMAX(0,-fm.<a href="qfontmetrics.html#minLeftBearing">minLeftBearing</a>()); - int mt = <a href="qframe.html#frameWidth">frameWidth</a>()+margin(); - <a href="qsize.html">TQSize</a> cell((<a href="qwidget.html#width">width</a>()-15-ml)/16,(<a href="qwidget.html#height">height</a>()-15-mt)/16); - -<a name="x2008"></a><a name="x2007"></a> if ( !cell.<a href="qsize.html#width">width</a>() || !cell.<a href="qsize.html#height">height</a>() ) + TQFrame::<a href="ntqframe.html#paintEvent">paintEvent</a>(e); + <a href="ntqpainter.html">TQPainter</a> p(this); +<a name="x2002"></a><a name="x1999"></a> p.<a href="ntqpainter.html#setClipRegion">setClipRegion</a>(e-><a href="qpaintevent.html#region">region</a>()); +<a name="x2001"></a> <a href="ntqrect.html">TQRect</a> r = e-><a href="qpaintevent.html#rect">rect</a>(); + <a href="ntqfontmetrics.html">TQFontMetrics</a> fm = <a href="ntqwidget.html#fontMetrics">fontMetrics</a>(); +<a name="x1991"></a> int ml = <a href="ntqframe.html#frameWidth">frameWidth</a>()+margin() + 1 + TQMAX(0,-fm.<a href="ntqfontmetrics.html#minLeftBearing">minLeftBearing</a>()); + int mt = <a href="ntqframe.html#frameWidth">frameWidth</a>()+margin(); + <a href="ntqsize.html">TQSize</a> cell((<a href="ntqwidget.html#width">width</a>()-15-ml)/16,(<a href="ntqwidget.html#height">height</a>()-15-mt)/16); + +<a name="x2008"></a><a name="x2007"></a> if ( !cell.<a href="ntqsize.html#width">width</a>() || !cell.<a href="ntqsize.html#height">height</a>() ) return; - int mini = r.<a href="qrect.html#left">left</a>() / cell.<a href="qsize.html#width">width</a>(); - int maxi = (r.<a href="qrect.html#right">right</a>()+cell.<a href="qsize.html#width">width</a>()-1) / cell.<a href="qsize.html#width">width</a>(); - int minj = r.<a href="qrect.html#top">top</a>() / cell.<a href="qsize.html#height">height</a>(); -<a name="x2003"></a> int maxj = (r.<a href="qrect.html#bottom">bottom</a>()+cell.<a href="qsize.html#height">height</a>()-1) / cell.<a href="qsize.html#height">height</a>(); + int mini = r.<a href="ntqrect.html#left">left</a>() / cell.<a href="ntqsize.html#width">width</a>(); + int maxi = (r.<a href="ntqrect.html#right">right</a>()+cell.<a href="ntqsize.html#width">width</a>()-1) / cell.<a href="ntqsize.html#width">width</a>(); + int minj = r.<a href="ntqrect.html#top">top</a>() / cell.<a href="ntqsize.html#height">height</a>(); +<a name="x2003"></a> int maxj = (r.<a href="ntqrect.html#bottom">bottom</a>()+cell.<a href="ntqsize.html#height">height</a>()-1) / cell.<a href="ntqsize.html#height">height</a>(); -<a name="x1986"></a> int h = fm.<a href="qfontmetrics.html#height">height</a>(); +<a name="x1986"></a> int h = fm.<a href="ntqfontmetrics.html#height">height</a>(); - <a href="qcolor.html">TQColor</a> body(255,255,192); - <a href="qcolor.html">TQColor</a> negative(255,192,192); - <a href="qcolor.html">TQColor</a> positive(192,192,255); - <a href="qcolor.html">TQColor</a> rnegative(255,128,128); - <a href="qcolor.html">TQColor</a> rpositive(128,128,255); + <a href="ntqcolor.html">TQColor</a> body(255,255,192); + <a href="ntqcolor.html">TQColor</a> negative(255,192,192); + <a href="ntqcolor.html">TQColor</a> positive(192,192,255); + <a href="ntqcolor.html">TQColor</a> rnegative(255,128,128); + <a href="ntqcolor.html">TQColor</a> rpositive(128,128,255); for (int j = minj; j<=maxj; j++) { for (int i = mini; i<=maxi; i++) { if ( i < 16 && j < 16 ) { - int x = i*cell.<a href="qsize.html#width">width</a>(); - int y = j*cell.<a href="qsize.html#height">height</a>(); + int x = i*cell.<a href="ntqsize.html#width">width</a>(); + int y = j*cell.<a href="ntqsize.html#height">height</a>(); <a href="qchar.html">TQChar</a> ch = TQChar(j*16+i,row); -<a name="x1987"></a> if ( fm.<a href="qfontmetrics.html#inFont">inFont</a>(ch) ) { -<a name="x1994"></a> int w = fm.<a href="qfontmetrics.html#width">width</a>(ch); -<a name="x1988"></a> int l = fm.<a href="qfontmetrics.html#leftBearing">leftBearing</a>(ch); -<a name="x1993"></a> int r = fm.<a href="qfontmetrics.html#rightBearing">rightBearing</a>(ch); +<a name="x1987"></a> if ( fm.<a href="ntqfontmetrics.html#inFont">inFont</a>(ch) ) { +<a name="x1994"></a> int w = fm.<a href="ntqfontmetrics.html#width">width</a>(ch); +<a name="x1988"></a> int l = fm.<a href="ntqfontmetrics.html#leftBearing">leftBearing</a>(ch); +<a name="x1993"></a> int r = fm.<a href="ntqfontmetrics.html#rightBearing">rightBearing</a>(ch); x += ml; y += mt+h; -<a name="x1998"></a> p.<a href="qpainter.html#fillRect">fillRect</a>(x,y,w,-h,body); +<a name="x1998"></a> p.<a href="ntqpainter.html#fillRect">fillRect</a>(x,y,w,-h,body); if ( w ) { if ( l ) { - p.<a href="qpainter.html#fillRect">fillRect</a>(x+(l>0?0:l), y-h/2, abs(l),-h/2, + p.<a href="ntqpainter.html#fillRect">fillRect</a>(x+(l>0?0:l), y-h/2, abs(l),-h/2, l < 0 ? negative : positive); } if ( r ) { - p.<a href="qpainter.html#fillRect">fillRect</a>(x+w-(r>0?r:0),y+2, abs(r),-h/2, + p.<a href="ntqpainter.html#fillRect">fillRect</a>(x+w-(r>0?r:0),y+2, abs(r),-h/2, r < 0 ? rnegative : rpositive); } } - <a href="qstring.html">TQString</a> s; + <a href="ntqstring.html">TQString</a> s; s += ch; - p.<a href="qpainter.html#setPen">setPen</a>(TQPen(TQt::black)); - p.<a href="qpainter.html#drawText">drawText</a>(x,y,s); + p.<a href="ntqpainter.html#setPen">setPen</a>(TQPen(TQt::black)); + p.<a href="ntqpainter.html#drawText">drawText</a>(x,y,s); } } } @@ -200,49 +200,49 @@ void <a name="f533"></a>FontRowTable::setRow(int r) { row = r; - <a href="qfontmetrics.html">TQFontMetrics</a> fm = <a href="qwidget.html#fontMetrics">fontMetrics</a>(); - <a href="qfontinfo.html">TQFontInfo</a> fi = <a href="qwidget.html#fontInfo">fontInfo</a>(); - <a href="qstring.html">TQString</a> str = TQString("%1 %2pt%3%4 mLB=%5 mRB=%6 mW=%7") -<a name="x1983"></a> .arg(fi.<a href="qfontinfo.html#family">family</a>()) -<a name="x1985"></a> .arg(fi.<a href="qfontinfo.html#pointSize">pointSize</a>()) -<a name="x1982"></a> .arg(fi.<a href="qfontinfo.html#bold">bold</a>() ? " bold" : "") -<a name="x1984"></a> .arg(fi.<a href="qfontinfo.html#italic">italic</a>() ? " italic" : "") - .arg(fm.<a href="qfontmetrics.html#minLeftBearing">minLeftBearing</a>()) -<a name="x1992"></a> .arg(fm.<a href="qfontmetrics.html#minRightBearing">minRightBearing</a>()) - .arg(fm.<a href="qfontmetrics.html#maxWidth">maxWidth</a>()); + <a href="ntqfontmetrics.html">TQFontMetrics</a> fm = <a href="ntqwidget.html#fontMetrics">fontMetrics</a>(); + <a href="ntqfontinfo.html">TQFontInfo</a> fi = <a href="ntqwidget.html#fontInfo">fontInfo</a>(); + <a href="ntqstring.html">TQString</a> str = TQString("%1 %2pt%3%4 mLB=%5 mRB=%6 mW=%7") +<a name="x1983"></a> .arg(fi.<a href="ntqfontinfo.html#family">family</a>()) +<a name="x1985"></a> .arg(fi.<a href="ntqfontinfo.html#pointSize">pointSize</a>()) +<a name="x1982"></a> .arg(fi.<a href="ntqfontinfo.html#bold">bold</a>() ? " bold" : "") +<a name="x1984"></a> .arg(fi.<a href="ntqfontinfo.html#italic">italic</a>() ? " italic" : "") + .arg(fm.<a href="ntqfontmetrics.html#minLeftBearing">minLeftBearing</a>()) +<a name="x1992"></a> .arg(fm.<a href="ntqfontmetrics.html#minRightBearing">minRightBearing</a>()) + .arg(fm.<a href="ntqfontmetrics.html#maxWidth">maxWidth</a>()); emit fontInformation(str); - <a href="qwidget.html#update">update</a>(); + <a href="ntqwidget.html#update">update</a>(); } void <a name="f534"></a>FontRowTable::chooseFont() { bool ok; - <a href="qfont.html">TQFont</a> oldfont = tablefont; -<a name="x1981"></a> tablefont = TQFontDialog::<a href="qfontdialog.html#getFont">getFont</a>(&ok, oldfont, this); + <a href="ntqfont.html">TQFont</a> oldfont = tablefont; +<a name="x1981"></a> tablefont = TQFontDialog::<a href="ntqfontdialog.html#getFont">getFont</a>(&ok, oldfont, this); if (ok) - <a href="qwidget.html#setFont">setFont</a>(tablefont); + <a href="ntqwidget.html#setFont">setFont</a>(tablefont); else tablefont = oldfont; } -<a name="f530"></a>FontDisplayer::FontDisplayer( <a href="qwidget.html">TQWidget</a>* parent, const char* name ) : - <a href="qmainwindow.html">TQMainWindow</a>(parent,name) +<a name="f530"></a>FontDisplayer::FontDisplayer( <a href="ntqwidget.html">TQWidget</a>* parent, const char* name ) : + <a href="ntqmainwindow.html">TQMainWindow</a>(parent,name) { FontRowTable* table = new FontRowTable(this); - <a href="qtoolbar.html">TQToolBar</a>* controls = new <a href="qtoolbar.html">TQToolBar</a>(this); - (void) new <a href="qlabel.html">TQLabel</a>(<a href="qobject.html#tr">tr</a>("Row:"), controls); - <a href="qspinbox.html">TQSpinBox</a> *row = new <a href="qspinbox.html">TQSpinBox</a>(0,255,1,controls); -<a name="x2010"></a> controls-><a href="qtoolbar.html#addSeparator">addSeparator</a>(); - <a href="qpushbutton.html">TQPushButton</a> *fontbutton = new <a href="qpushbutton.html">TQPushButton</a>(<a href="qobject.html#tr">tr</a>("Font..."), controls); - -<a name="x2009"></a> <a href="qobject.html#connect">connect</a>(row,SIGNAL(<a href="qspinbox.html#valueChanged">valueChanged</a>(int)),table,SLOT(setRow(int))); - <a href="qobject.html#connect">connect</a>(fontbutton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), table, SLOT(chooseFont())); - <a href="qobject.html#connect">connect</a>(table,SIGNAL(fontInformation(const <a href="qstring.html">TQString</a>&)), - <a href="qmainwindow.html#statusBar">statusBar</a>(),SLOT(message(const <a href="qstring.html">TQString</a>&))); + <a href="ntqtoolbar.html">TQToolBar</a>* controls = new <a href="ntqtoolbar.html">TQToolBar</a>(this); + (void) new <a href="ntqlabel.html">TQLabel</a>(<a href="ntqobject.html#tr">tr</a>("Row:"), controls); + <a href="ntqspinbox.html">TQSpinBox</a> *row = new <a href="ntqspinbox.html">TQSpinBox</a>(0,255,1,controls); +<a name="x2010"></a> controls-><a href="ntqtoolbar.html#addSeparator">addSeparator</a>(); + <a href="ntqpushbutton.html">TQPushButton</a> *fontbutton = new <a href="ntqpushbutton.html">TQPushButton</a>(<a href="ntqobject.html#tr">tr</a>("Font..."), controls); + +<a name="x2009"></a> <a href="ntqobject.html#connect">connect</a>(row,SIGNAL(<a href="ntqspinbox.html#valueChanged">valueChanged</a>(int)),table,SLOT(setRow(int))); + <a href="ntqobject.html#connect">connect</a>(fontbutton, SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()), table, SLOT(chooseFont())); + <a href="ntqobject.html#connect">connect</a>(table,SIGNAL(fontInformation(const <a href="ntqstring.html">TQString</a>&)), + <a href="ntqmainwindow.html#statusBar">statusBar</a>(),SLOT(message(const <a href="ntqstring.html">TQString</a>&))); table->setRow(0); - <a href="qmainwindow.html#setCentralWidget">setCentralWidget</a>(table); + <a href="ntqmainwindow.html#setCentralWidget">setCentralWidget</a>(table); } </pre> @@ -260,26 +260,26 @@ void <a name="f534"></a>FontRowTable::chooseFont() #include "fontdisplayer.h" -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qslider-h.html">qslider.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> -#include <<a href="qstatusbar-h.html">qstatusbar.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qslider-h.html">ntqslider.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> +#include <<a href="qstatusbar-h.html">ntqstatusbar.h</a>> int main(int argc, char** argv) { - <a href="qapplication.html">TQApplication</a> app(argc,argv); + <a href="ntqapplication.html">TQApplication</a> app(argc,argv); FontDisplayer m; -<a name="x2013"></a> <a href="qsize.html">TQSize</a> sh = m.<a href="qmainwindow.html#centralWidget">centralWidget</a>()->sizeHint(); -<a name="x2017"></a> m.<a href="qwidget.html#resize">resize</a>(sh.<a href="qsize.html#width">width</a>(), -<a name="x2016"></a><a name="x2015"></a> sh.<a href="qsize.html#height">height</a>()+3*m.<a href="qmainwindow.html#statusBar">statusBar</a>()->height()); - app.<a href="qapplication.html#setMainWidget">setMainWidget</a>(&m); - m.<a href="qwidget.html#setCaption">setCaption</a>("TQt Example - TQFD"); -<a name="x2014"></a> m.<a href="qwidget.html#show">show</a>(); - - return app.<a href="qapplication.html#exec">exec</a>(); +<a name="x2013"></a> <a href="ntqsize.html">TQSize</a> sh = m.<a href="ntqmainwindow.html#centralWidget">centralWidget</a>()->sizeHint(); +<a name="x2017"></a> m.<a href="ntqwidget.html#resize">resize</a>(sh.<a href="ntqsize.html#width">width</a>(), +<a name="x2016"></a><a name="x2015"></a> sh.<a href="ntqsize.html#height">height</a>()+3*m.<a href="ntqmainwindow.html#statusBar">statusBar</a>()->height()); + app.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>(&m); + m.<a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - TQFD"); +<a name="x2014"></a> m.<a href="ntqwidget.html#show">show</a>(); + + return app.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |