summaryrefslogtreecommitdiffstats
path: root/examples/customlayout/main.cpp
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/customlayout/main.cpp
downloadtqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz
tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'examples/customlayout/main.cpp')
-rw-r--r--examples/customlayout/main.cpp97
1 files changed, 97 insertions, 0 deletions
diff --git a/examples/customlayout/main.cpp b/examples/customlayout/main.cpp
new file mode 100644
index 000000000..694fcf8fb
--- /dev/null
+++ b/examples/customlayout/main.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Main for custom layout example
+**
+** Copyright (C) 1996-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for TQt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include "flow.h"
+#include "border.h"
+#include "card.h"
+
+#include <qapplication.h>
+#include <qlabel.h>
+#include <qcolor.h>
+#include <qgroupbox.h>
+#include <qpushbutton.h>
+#include <qmultilineedit.h>
+#include <qcolor.h>
+
+int main( int argc, char **argv )
+{
+ TQApplication a( argc, argv );
+
+ TQWidget *f = new TQWidget;
+ TQBoxLayout *gm = new TQVBoxLayout( f, 5 );
+
+ SimpleFlow *b1 = new SimpleFlow( gm );
+
+ b1->add( new TQPushButton( "Short", f ) );
+ b1->add( new TQPushButton( "Longer", f ) );
+ b1->add( new TQPushButton( "Different text", f ) );
+ b1->add( new TQPushButton( "More text", f ) );
+ b1->add( new TQPushButton( "Even longer button text", f ) );
+ TQPushButton* qb = new TQPushButton( "Quit", f );
+ a.connect( qb, SIGNAL( clicked() ), SLOT( tquit() ) );
+ b1->add( qb );
+
+ TQWidget *wid = new TQWidget( f );
+
+ BorderLayout *large = new BorderLayout( wid );
+ large->setSpacing( 5 );
+ large->addWidget( new TQPushButton( "North", wid ), BorderLayout::North );
+ large->addWidget( new TQPushButton( "West", wid ), BorderLayout::West );
+ TQMultiLineEdit* m = new TQMultiLineEdit( wid );
+ m->setText( "Central\nWidget" );
+ large->addWidget( m, BorderLayout::Center );
+ TQWidget *east1 = new TQPushButton( "East", wid );
+ large->addWidget( east1, BorderLayout::East );
+ TQWidget *east2 = new TQPushButton( "East 2", wid );
+ large->addWidget( east2 , BorderLayout::East );
+ large->addWidget( new TQPushButton( "South", wid ), BorderLayout::South );
+ //Left-to-right tab order looks better:
+ TQWidget::setTabOrder( east2, east1 );
+ gm->addWidget( wid );
+
+
+ wid = new TQWidget( f );
+ CardLayout *card = new CardLayout( wid, 10 );
+
+ TQWidget *crd = new TQWidget( wid );
+ crd->setBackgroundColor( TQt::red );
+ card->add( crd );
+ crd = new TQWidget( wid );
+ crd->setBackgroundColor( TQt::green );
+ card->add( crd );
+ crd = new TQWidget( wid );
+ crd->setBackgroundColor( TQt::blue );
+ card->add( crd );
+ crd = new TQWidget( wid );
+ crd->setBackgroundColor( TQt::white );
+ card->add( crd );
+ crd = new TQWidget( wid );
+ crd->setBackgroundColor( TQt::black );
+ card->add( crd );
+ crd = new TQWidget( wid );
+ crd->setBackgroundColor( TQt::yellow );
+ card->add( crd );
+
+ gm->addWidget( wid );
+
+ TQLabel* s = new TQLabel( f );
+ s->setText( "outermost box" );
+ s->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
+ s->setAlignment( TQt::AlignVCenter | TQt::AlignHCenter );
+ gm->addWidget( s );
+ a.setMainWidget( f );
+ f->setCaption("TQt Example - Custom Layout");
+ f->show();
+
+ int result = a.exec();
+ delete f;
+ return result;
+}