summaryrefslogtreecommitdiffstats
path: root/examples/tux
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-08 12:31:36 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-08 12:31:36 -0600
commitd796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch)
tree6e3dcca4f77e20ec8966c666aac7c35bd4704053 /examples/tux
downloadtqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz
tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'examples/tux')
-rw-r--r--examples/tux/tux.cpp71
-rw-r--r--examples/tux/tux.pngbin0 -> 13849 bytes
-rw-r--r--examples/tux/tux.pro10
3 files changed, 81 insertions, 0 deletions
diff --git a/examples/tux/tux.cpp b/examples/tux/tux.cpp
new file mode 100644
index 000000000..e0d482b79
--- /dev/null
+++ b/examples/tux/tux.cpp
@@ -0,0 +1,71 @@
+#include <qapplication.h>
+#include <qwidget.h>
+#include <qimage.h>
+#include <qpixmap.h>
+#include <qbitmap.h>
+#include <qfile.h>
+
+#include <stdlib.h>
+
+class MoveMe : public TQWidget
+{
+public:
+ MoveMe( TQWidget *parent=0, const char *name=0, WFlags f = 0)
+ :TQWidget(parent,name, f) {}
+
+protected:
+ void mousePressEvent( TQMouseEvent *);
+ void mouseMoveEvent( TQMouseEvent *);
+private:
+ TQPoint clickPos;
+};
+
+void MoveMe::mousePressEvent( TQMouseEvent *e )
+{
+ clickPos = e->pos();
+}
+
+void MoveMe::mouseMoveEvent( TQMouseEvent *e )
+{
+ move( e->globalPos() - clickPos );
+}
+
+
+
+int main( int argc, char **argv )
+{
+ TQApplication a( argc, argv );
+
+ TQString fn="tux.png";
+
+ if ( argc >= 2 )
+ fn = argv[1];
+
+ if ( ! TQFile::exists( fn ) )
+ exit( 1 );
+
+ TQImage img( fn );
+ TQPixmap p;
+ p.convertFromImage( img );
+ if ( !p.mask() )
+ if ( img.hasAlphaBuffer() ) {
+ TQBitmap bm;
+ bm = img.createAlphaMask();
+ p.setMask( bm );
+ } else {
+ TQBitmap bm;
+ bm = img.createHeuristicMask();
+ p.setMask( bm );
+ }
+ MoveMe w(0,0,TQt::WStyle_Customize|TQt::WStyle_NoBorder);
+ w.setBackgroundPixmap( p );
+ w.setFixedSize( p.size() );
+ if ( p.mask() )
+ w.setMask( *p.mask() );
+ w.show();
+ a.setMainWidget(&w);
+
+
+ return a.exec();
+
+}
diff --git a/examples/tux/tux.png b/examples/tux/tux.png
new file mode 100644
index 000000000..384f5bb3c
--- /dev/null
+++ b/examples/tux/tux.png
Binary files differ
diff --git a/examples/tux/tux.pro b/examples/tux/tux.pro
new file mode 100644
index 000000000..26842eb96
--- /dev/null
+++ b/examples/tux/tux.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = tux
+
+CONFIG += qt warn_on release
+
+REQUIRES = small-config
+
+HEADERS =
+SOURCES = tux.cpp
+INTERFACES =