From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/qfd-example.html | 204 +++++++++++++++++++++++----------------------- 1 file changed, 102 insertions(+), 102 deletions(-) (limited to 'doc/html/qfd-example.html') 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 <qframe.h> -#include <qmainwindow.h> +#include <ntqframe.h> +#include <ntqmainwindow.h> class TQSlider; -class FontRowTable : public TQFrame { +class FontRowTable : public TQFrame { Q_OBJECT public: - FontRowTable( TQWidget* parent=0, const char* name=0 ); + FontRowTable( TQWidget* parent=0, const char* name=0 ); - TQSize sizeHint() const; + TQSize sizeHint() const; signals: - void fontInformation(const TQString&); + void fontInformation(const TQString&); public slots: void setRow(int); @@ -70,17 +70,17 @@ public slots: protected: - TQSize cellSize() const; + TQSize cellSize() const; void paintEvent( TQPaintEvent* ); private: - TQFont tablefont; + TQFont tablefont; int row; }; -class FontDisplayer : public TQMainWindow { +class FontDisplayer : public TQMainWindow { Q_OBJECT public: - FontDisplayer( TQWidget* parent=0, const char* name=0 ); + FontDisplayer( TQWidget* parent=0, const char* name=0 ); }; #endif @@ -99,97 +99,97 @@ public: *****************************************************************************/ #include "fontdisplayer.h" -#include <qapplication.h> -#include <qslider.h> -#include <qspinbox.h> -#include <qpainter.h> -#include <qtoolbar.h> -#include <qstatusbar.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qfontdialog.h> +#include <ntqapplication.h> +#include <ntqslider.h> +#include <ntqspinbox.h> +#include <ntqpainter.h> +#include <ntqtoolbar.h> +#include <ntqstatusbar.h> +#include <ntqlabel.h> +#include <ntqpushbutton.h> +#include <ntqfontdialog.h> #include <stdlib.h> -FontRowTable::FontRowTable( TQWidget* parent, const char* name ) : - TQFrame(parent,name) +FontRowTable::FontRowTable( TQWidget* parent, const char* name ) : + TQFrame(parent,name) { - setBackgroundMode(PaletteBase); - setFrameStyle(Panel|Sunken); - setMargin(8); + setBackgroundMode(PaletteBase); + setFrameStyle(Panel|Sunken); + setMargin(8); setRow(0); - tablefont = TQApplication::font(); + tablefont = TQApplication::font(); } -TQSize FontRowTable::sizeHint() const +TQSize FontRowTable::sizeHint() const { - return 24*cellSize()+TQSize(2,2)*(margin()+frameWidth()); + return 24*cellSize()+TQSize(2,2)*(margin()+frameWidth()); } TQSize FontRowTable::cellSize() const { - TQFontMetrics fm = fontMetrics(); - return TQSize( fm.maxWidth(), fm.lineSpacing()+1 ); + TQFontMetrics fm = fontMetrics(); + return TQSize( fm.maxWidth(), fm.lineSpacing()+1 ); } -void FontRowTable::paintEvent( TQPaintEvent* e ) +void FontRowTable::paintEvent( TQPaintEvent* e ) { - TQFrame::paintEvent(e); - TQPainter p(this); - p.setClipRegion(e->region()); - TQRect r = e->rect(); - TQFontMetrics fm = fontMetrics(); - int ml = frameWidth()+margin() + 1 + TQMAX(0,-fm.minLeftBearing()); - int mt = frameWidth()+margin(); - TQSize cell((width()-15-ml)/16,(height()-15-mt)/16); - - if ( !cell.width() || !cell.height() ) + TQFrame::paintEvent(e); + TQPainter p(this); + p.setClipRegion(e->region()); + TQRect r = e->rect(); + TQFontMetrics fm = fontMetrics(); + int ml = frameWidth()+margin() + 1 + TQMAX(0,-fm.minLeftBearing()); + int mt = frameWidth()+margin(); + TQSize cell((width()-15-ml)/16,(height()-15-mt)/16); + + if ( !cell.width() || !cell.height() ) return; - int mini = r.left() / cell.width(); - int maxi = (r.right()+cell.width()-1) / cell.width(); - int minj = r.top() / cell.height(); - int maxj = (r.bottom()+cell.height()-1) / cell.height(); + int mini = r.left() / cell.width(); + int maxi = (r.right()+cell.width()-1) / cell.width(); + int minj = r.top() / cell.height(); + int maxj = (r.bottom()+cell.height()-1) / cell.height(); - int h = fm.height(); + int h = fm.height(); - TQColor body(255,255,192); - TQColor negative(255,192,192); - TQColor positive(192,192,255); - TQColor rnegative(255,128,128); - TQColor rpositive(128,128,255); + TQColor body(255,255,192); + TQColor negative(255,192,192); + TQColor positive(192,192,255); + TQColor rnegative(255,128,128); + TQColor 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.width(); - int y = j*cell.height(); + int x = i*cell.width(); + int y = j*cell.height(); TQChar ch = TQChar(j*16+i,row); - if ( fm.inFont(ch) ) { - int w = fm.width(ch); - int l = fm.leftBearing(ch); - int r = fm.rightBearing(ch); + if ( fm.inFont(ch) ) { + int w = fm.width(ch); + int l = fm.leftBearing(ch); + int r = fm.rightBearing(ch); x += ml; y += mt+h; - p.fillRect(x,y,w,-h,body); + p.fillRect(x,y,w,-h,body); if ( w ) { if ( l ) { - p.fillRect(x+(l>0?0:l), y-h/2, abs(l),-h/2, + p.fillRect(x+(l>0?0:l), y-h/2, abs(l),-h/2, l < 0 ? negative : positive); } if ( r ) { - p.fillRect(x+w-(r>0?r:0),y+2, abs(r),-h/2, + p.fillRect(x+w-(r>0?r:0),y+2, abs(r),-h/2, r < 0 ? rnegative : rpositive); } } - TQString s; + TQString s; s += ch; - p.setPen(TQPen(TQt::black)); - p.drawText(x,y,s); + p.setPen(TQPen(TQt::black)); + p.drawText(x,y,s); } } } @@ -200,49 +200,49 @@ void FontRowTable::setRow(int r) { row = r; - TQFontMetrics fm = fontMetrics(); - TQFontInfo fi = fontInfo(); - TQString str = TQString("%1 %2pt%3%4 mLB=%5 mRB=%6 mW=%7") - .arg(fi.family()) - .arg(fi.pointSize()) - .arg(fi.bold() ? " bold" : "") - .arg(fi.italic() ? " italic" : "") - .arg(fm.minLeftBearing()) - .arg(fm.minRightBearing()) - .arg(fm.maxWidth()); + TQFontMetrics fm = fontMetrics(); + TQFontInfo fi = fontInfo(); + TQString str = TQString("%1 %2pt%3%4 mLB=%5 mRB=%6 mW=%7") + .arg(fi.family()) + .arg(fi.pointSize()) + .arg(fi.bold() ? " bold" : "") + .arg(fi.italic() ? " italic" : "") + .arg(fm.minLeftBearing()) + .arg(fm.minRightBearing()) + .arg(fm.maxWidth()); emit fontInformation(str); - update(); + update(); } void FontRowTable::chooseFont() { bool ok; - TQFont oldfont = tablefont; - tablefont = TQFontDialog::getFont(&ok, oldfont, this); + TQFont oldfont = tablefont; + tablefont = TQFontDialog::getFont(&ok, oldfont, this); if (ok) - setFont(tablefont); + setFont(tablefont); else tablefont = oldfont; } -FontDisplayer::FontDisplayer( TQWidget* parent, const char* name ) : - TQMainWindow(parent,name) +FontDisplayer::FontDisplayer( TQWidget* parent, const char* name ) : + TQMainWindow(parent,name) { FontRowTable* table = new FontRowTable(this); - TQToolBar* controls = new TQToolBar(this); - (void) new TQLabel(tr("Row:"), controls); - TQSpinBox *row = new TQSpinBox(0,255,1,controls); - controls->addSeparator(); - TQPushButton *fontbutton = new TQPushButton(tr("Font..."), controls); - - connect(row,SIGNAL(valueChanged(int)),table,SLOT(setRow(int))); - connect(fontbutton, SIGNAL(clicked()), table, SLOT(chooseFont())); - connect(table,SIGNAL(fontInformation(const TQString&)), - statusBar(),SLOT(message(const TQString&))); + TQToolBar* controls = new TQToolBar(this); + (void) new TQLabel(tr("Row:"), controls); + TQSpinBox *row = new TQSpinBox(0,255,1,controls); + controls->addSeparator(); + TQPushButton *fontbutton = new TQPushButton(tr("Font..."), controls); + + connect(row,SIGNAL(valueChanged(int)),table,SLOT(setRow(int))); + connect(fontbutton, SIGNAL(clicked()), table, SLOT(chooseFont())); + connect(table,SIGNAL(fontInformation(const TQString&)), + statusBar(),SLOT(message(const TQString&))); table->setRow(0); - setCentralWidget(table); + setCentralWidget(table); } @@ -260,26 +260,26 @@ void FontRowTable::chooseFont() #include "fontdisplayer.h" -#include <qapplication.h> -#include <qslider.h> -#include <qpainter.h> -#include <qstatusbar.h> +#include <ntqapplication.h> +#include <ntqslider.h> +#include <ntqpainter.h> +#include <ntqstatusbar.h> int main(int argc, char** argv) { - TQApplication app(argc,argv); + TQApplication app(argc,argv); FontDisplayer m; - TQSize sh = m.centralWidget()->sizeHint(); - m.resize(sh.width(), - sh.height()+3*m.statusBar()->height()); - app.setMainWidget(&m); - m.setCaption("TQt Example - TQFD"); - m.show(); - - return app.exec(); + TQSize sh = m.centralWidget()->sizeHint(); + m.resize(sh.width(), + sh.height()+3*m.statusBar()->height()); + app.setMainWidget(&m); + m.setCaption("TQt Example - TQFD"); + m.show(); + + return app.exec(); } -- cgit v1.2.1