diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtjava/javalib/examples/picture | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtjava/javalib/examples/picture')
-rw-r--r-- | qtjava/javalib/examples/picture/PictureDisplay.java | 36 | ||||
-rw-r--r-- | qtjava/javalib/examples/picture/car_orig.pic | bin | 1872 -> 1874 bytes |
2 files changed, 18 insertions, 18 deletions
diff --git a/qtjava/javalib/examples/picture/PictureDisplay.java b/qtjava/javalib/examples/picture/PictureDisplay.java index 34b026b4..2f311d51 100644 --- a/qtjava/javalib/examples/picture/PictureDisplay.java +++ b/qtjava/javalib/examples/picture/PictureDisplay.java @@ -10,28 +10,28 @@ import org.kde.qt.*; -class PictureDisplay extends QWidget // picture display widget +class PictureDisplay extends TQWidget // picture display widget { -static void paintCar( QPainter p ) // paint a car +static void paintCar( TQPainter p ) // paint a car { - QPointArray a = new QPointArray(); - QBrush brush = new QBrush( Qt.yellow(), Qt.SolidPattern ); + TQPointArray a = new TQPointArray(); + TQBrush brush = new TQBrush( Qt.yellow(), Qt.SolidPattern ); p.setBrush( brush ); // use solid, yellow brush a.setPoints( 5, new short[] { 50,50, 350,50, 450,120, 450,250, 50,250 } ); p.drawPolygon( a ); // draw car body - QFont f = new QFont( "courier", 12, QFont.Bold, false ); + TQFont f = new TQFont( "courier", 12, TQFont.Bold, false ); p.setFont( f ); - QColor windowColor = new QColor( 120, 120, 255 ); // a light blue color + TQColor windowColor = new TQColor( 120, 120, 255 ); // a light blue color brush.setColor( windowColor ); // set this brush color p.setBrush( brush ); // set brush p.drawRect( 80, 80, 250, 70 ); // car window p.drawText( 180, 80, 150, 70, Qt.AlignCenter, "-- Qt --\nTrolltech AS" ); - QPixmap pixmap = new QPixmap(); + TQPixmap pixmap = new TQPixmap(); if ( pixmap.load("flag.bmp") ) // load and draw image p.drawPixmap( 100, 90, pixmap ); @@ -44,12 +44,12 @@ static void paintCar( QPainter p ) // paint a car -private QPicture pict; +private TQPicture pict; private String name; public PictureDisplay( String fileName ) { - pict = new QPicture(); + pict = new TQPicture(); name = fileName; if ( !pict.load(fileName) ) { // cannot load picture pict = null; @@ -57,16 +57,16 @@ public PictureDisplay( String fileName ) } } -protected void paintEvent( QPaintEvent event ) +protected void paintEvent( TQPaintEvent event ) { - QPainter paint = new QPainter( this ); // paint widget + TQPainter paint = new TQPainter( this ); // paint widget if ( pict != null ) paint.drawPicture( pict ); // draw picture else paint.drawText( rect(), AlignCenter, name ); } -protected void keyPressEvent( QKeyEvent k ) +protected void keyPressEvent( TQKeyEvent k ) { // switch ( tolower(k.ascii()) ) { switch ( k.ascii() ) { @@ -75,7 +75,7 @@ protected void keyPressEvent( QKeyEvent k ) update(); break; case 'q': // quit - QApplication.exit(); + TQApplication.exit(); break; } } @@ -83,23 +83,23 @@ protected void keyPressEvent( QKeyEvent k ) static public void main( String[] args ) { - QApplication a = new QApplication( args ); // QApplication required! + TQApplication a = new TQApplication( args ); // TQApplication retquired! String fileName = "car.pic"; // default picture file name if ( args.length == 1 ) // use argument as file name fileName = args[0]; - if ( !QFile.exists(fileName) ) { - QPicture pict = new QPicture(); // our picture - QPainter paint = new QPainter(); // our painter + if ( !TQFile.exists(fileName) ) { + TQPicture pict = new TQPicture(); // our picture + TQPainter paint = new TQPainter(); // our painter paint.begin( pict ); // begin painting onto picture paintCar( paint ); // paint! paint.end(); // painting done pict.save( fileName ); // save picture - QMessageBox.information(null, "Qt picture example", "Saved. Run me again!"); + TQMessageBox.information(null, "Qt picture example", "Saved. Run me again!"); return; } else { PictureDisplay test = new PictureDisplay( fileName ); // create picture display diff --git a/qtjava/javalib/examples/picture/car_orig.pic b/qtjava/javalib/examples/picture/car_orig.pic Binary files differindex a0141b75..806053d7 100644 --- a/qtjava/javalib/examples/picture/car_orig.pic +++ b/qtjava/javalib/examples/picture/car_orig.pic |