summaryrefslogtreecommitdiffstats
path: root/examples/table
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/table
downloadtqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz
tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'examples/table')
-rw-r--r--examples/table/bigtable/bigtable.doc19
-rw-r--r--examples/table/bigtable/bigtable.pro10
-rw-r--r--examples/table/bigtable/main.cpp63
-rw-r--r--examples/table/small-table-demo/main.cpp57
-rw-r--r--examples/table/small-table-demo/qtlogo.xpm123
-rw-r--r--examples/table/small-table-demo/small-table-demo.doc15
-rw-r--r--examples/table/small-table-demo/small-table-demo.pro10
-rw-r--r--examples/table/statistics/main.cpp20
-rw-r--r--examples/table/statistics/statistics.cpp171
-rw-r--r--examples/table/statistics/statistics.doc27
-rw-r--r--examples/table/statistics/statistics.h52
-rw-r--r--examples/table/statistics/statistics.pro10
12 files changed, 577 insertions, 0 deletions
diff --git a/examples/table/bigtable/bigtable.doc b/examples/table/bigtable/bigtable.doc
new file mode 100644
index 000000000..7f8a5c2da
--- /dev/null
+++ b/examples/table/bigtable/bigtable.doc
@@ -0,0 +1,19 @@
+/*
+*/
+
+/*! \page bigtable-example.html
+
+ \ingroup table-examples
+
+ \title How to create a large, sparse QTable
+
+ This example shows a sparse table implementation using a QIntDict to
+ keep track of the cells that are actually in use.
+
+ <hr>
+
+ Implementation:
+
+ \include table/bigtable/main.cpp
+
+*/
diff --git a/examples/table/bigtable/bigtable.pro b/examples/table/bigtable/bigtable.pro
new file mode 100644
index 000000000..e059dd953
--- /dev/null
+++ b/examples/table/bigtable/bigtable.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = bigtable
+
+CONFIG += qt warn_on release
+DEPENDPATH = ../../include
+
+REQUIRES = table full-config
+
+HEADERS =
+SOURCES = main.cpp
diff --git a/examples/table/bigtable/main.cpp b/examples/table/bigtable/main.cpp
new file mode 100644
index 000000000..b0d42b22b
--- /dev/null
+++ b/examples/table/bigtable/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-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 <qapplication.h>
+#include <qtable.h>
+
+// Table size
+
+const int numRows = 1000000;
+const int numCols = 1000000;
+
+class MyTable : public TQTable
+{
+public:
+ MyTable( int r, int c ) : TQTable( r, c ) {
+ items.setAutoDelete( TRUE );
+ widgets.setAutoDelete( TRUE );
+ setCaption( tr( "A 1 Million x 1 Million Cell Table" ) );
+ setLeftMargin( fontMetrics().width( "W999999W" ) );
+ }
+
+ void resizeData( int ) {}
+ TQTableItem *item( int r, int c ) const { return items.find( indexOf( r, c ) ); }
+ void setItem( int r, int c, TQTableItem *i ) { items.replace( indexOf( r, c ), i ); }
+ void clearCell( int r, int c ) { items.remove( indexOf( r, c ) ); }
+ void takeItem( TQTableItem *item )
+ {
+ items.setAutoDelete( FALSE );
+ items.remove( indexOf( item->row(), item->col() ) );
+ items.setAutoDelete( TRUE );
+ }
+ void insertWidget( int r, int c, TQWidget *w ) { widgets.replace( indexOf( r, c ), w ); }
+ TQWidget *cellWidget( int r, int c ) const { return widgets.find( indexOf( r, c ) ); }
+ void clearCellWidget( int r, int c )
+ {
+ TQWidget *w = widgets.take( indexOf( r, c ) );
+ if ( w )
+ w->deleteLater();
+ }
+
+private:
+ TQIntDict<TQTableItem> items;
+ TQIntDict<TQWidget> widgets;
+
+};
+
+// The program starts here.
+
+int main( int argc, char **argv )
+{
+ TQApplication app( argc, argv );
+
+ MyTable table( numRows, numCols );
+ app.setMainWidget( &table );
+ table.show();
+ return app.exec();
+}
diff --git a/examples/table/small-table-demo/main.cpp b/examples/table/small-table-demo/main.cpp
new file mode 100644
index 000000000..8039aadf2
--- /dev/null
+++ b/examples/table/small-table-demo/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-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 <qapplication.h>
+#include <qtable.h>
+#include <qimage.h>
+#include <qpixmap.h>
+#include <qstringlist.h>
+
+// TQt logo: static const char *qtlogo_xpm[]
+#include "qtlogo.xpm"
+
+// Table size
+
+const int numRows = 30;
+const int numCols = 10;
+
+// The program starts here.
+
+int main( int argc, char **argv )
+{
+ TQApplication app( argc, argv );
+
+ TQTable table( numRows, numCols );
+
+ TQHeader *header = table.horizontalHeader();
+ header->setLabel( 0, TQObject::tr( "Tiny" ), 40 );
+ header->setLabel( 1, TQObject::tr( "Checkboxes" ) );
+ header->setLabel( 5, TQObject::tr( "Combos" ) );
+ table.setColumnMovingEnabled(TRUE);
+
+ TQImage img( qtlogo_xpm );
+ TQPixmap pix = img.scaleHeight( table.rowHeight(3) );
+ table.setPixmap( 3, 2, pix );
+ table.setText( 3, 2, "A Pixmap" );
+
+ TQStringList comboEntries;
+ comboEntries << "one" << "two" << "three" << "four";
+
+ for ( int i = 0; i < numRows; ++i ){
+ TQComboTableItem * item = new TQComboTableItem( &table, comboEntries, FALSE );
+ item->setCurrentItem( i % 4 );
+ table.setItem( i, 5, item );
+ }
+ for ( int j = 0; j < numRows; ++j )
+ table.setItem( j, 1, new TQCheckTableItem( &table, "Check me" ) );
+
+ app.setMainWidget( &table );
+ table.show();
+ return app.exec();
+}
diff --git a/examples/table/small-table-demo/qtlogo.xpm b/examples/table/small-table-demo/qtlogo.xpm
new file mode 100644
index 000000000..d8aee6add
--- /dev/null
+++ b/examples/table/small-table-demo/qtlogo.xpm
@@ -0,0 +1,123 @@
+/* XPM */
+static const char *qtlogo_xpm[] = {
+/* width height num_colors chars_per_pixel */
+" 100 100 16 1",
+/* colors */
+". c #000000",
+"# c #0b0d01",
+"a c #161a02",
+"b c #202703",
+"c c #2b3505",
+"d c #364206",
+"e c #414f07",
+"f c #4c5c08",
+"g c #566909",
+"h c #61760a",
+"i c #6c830b",
+"j c #77900c",
+"k c #829e0e",
+"l c #8cab0f",
+"m c #97b810",
+"n c #a2c511",
+/* pixels */
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnn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##..#abgmnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnmgd#..............................#chmnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnjd....##..................#.....###..#eimnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnmga...#...............................#..agmnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnke#.......#................................acknnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnjc...#........................##....#.........dinnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnib..#...............................#...........cjnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnhb....#.#......................##......#..........ahnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnib..#..........#.....####aabba#.....#.....##.......#cinnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnjb.................#acehklmmmmljihca..................bjnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnkc..#.............#cfknnnnnnnnnnnnnlkhc#..#.............cknnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnme......##....#..#dhmnnnnnnnnnnnnnnnnnnlhda...##.......##.dmnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnng#.#....#......#bglnnnnnnnnnnnnnnnnnnnnnnlfa...#...#....#.#fnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnja...#.......#.#dknnnnnnnnnnnnnnnnnnnnnnnnnnmda.....#....##.ajnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnmd..#........#.#emnnnnnnnnnnnnnnnnnnnnnnnnnnnnmf#.#...#.......dlnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnf...#....#..#.#hnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnh#.#...........gnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnmd.#..........#hlnnnnnnnnnnnnnnnnnnnnnnnknnnnnnnnmg#............dlnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnng#.#..........fmnnnnnnnnnnnnnnnnnnnnnnnhcgnnnnnnnnme............agnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnmc..#......#..dlnnnnnnnnnnnnnnnnnnnnnnnha.ahnnnnnnnnld.#..........cmnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnni#.#.........bknnnnnnnnnnnnnnnnnnnnnnnha...ahnnnnnnnnkb...........#innnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnd..#........#gnnnnnnnnnnnnnnnnnnnnnnng#...#.#hnnnnnnnnh..........#.ennnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnla.#......#..dlnnnnnnnnnnnnnnnnnnnnnmha..#.##.bhnnnnnnnlc.........#.aknnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnj.........#.#innnnnnnnnnnnnnnnnnnnnnia.#.......ahnnnnnnni............innnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnd...........cmnnnnnnnnnnnnnnnnnnnnnha............hnnnnnnnc.........##dnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnmc..........#fnnnnnnnnnnnnnnnnnnnnnha....#...##...bgmnnnnnf##.........cmnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnk#..........aknnnnnnnnnnnnnnnnnnnnha..#.....#......cknnnnnka#.........aknnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnh...........cnnnnnnnnnnnnnnnnnnnni#..#.....#......ahmnnnnnnc...........innnnnnnnnnnnnn",
+"nnnnnnnnnnnnnng..........#ennnnnnnnnnnnnnnnnnnha.........#..#..#imnnnnnnne........#..gnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnne..........#hnnnnnnnnnnnnnnnnnnha.....#.........ahnnnnnnnnnh#.......#..ennnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnc..........#knnnnnnnnnnnnnnnnnha.#...##........ainnnnnnnnnnk#..........cnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnmb..........#lnnnnnnnnnnnnnnnnia.#.............#hnnnnnnnnnnnma..........bnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnma..........amnnnnnnnnnnnnnnnh#.............#.ainnnnnnnnnnnnna..........bnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnma..........amnnnnnnnnnnnnnnha.............#.#hnnnnnnnnnnnnnna..........bmnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnmb..........bmnnnnnnnnnnnnmha..............#.#hnnnnnnnnnnnnnna..........amnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnmb..........amnnnnnnnnnnnmia.##..#..........#.ahnnnnnnnnnnnnna..........bmnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnc..........alnnnnnnnnnnnha.##..##.............#hnnnnnnnnnnnla..........cmnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnd..........#jnnnnnnnnnnga..#...................ahnnnnnnnnnnj#..........dnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnne...........innnnnnnnnha.#....................#.ahmnnnnnnnnh.#.........ennnnnnnnnnnnnn",
+"nnnnnnnnnnnnnne.........#.hnnnnnnnnia.#...#...#.........#.....#.imnnnnnnng.#......#.#fnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnni....#..#.#.cmnnnnnnh#..#..#...#...#..............#hnnnnnnnb...........innnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnj#......#...aknnnnnkc.....#..##...#..#.............ahnnnnnka........#.#knnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnlb.#.........hnnnnnnga..#...##...#.##...............ahnnnnf.........#.bmnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnne.#.......#.clnnnnnnh#.#..##..#..#hha.............#.ahmnmb.........#.ennnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnni...........#hnnnnnnnh#...#..#..#hnnh#.#.............#ini#..#.....#..innnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnla......#....dlnnnnnnnhb....#..bhmnnnha.............#.bfc...#.....#.alnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnne#.#..#.....afnnnnnnnni#.....binnnnnnha#.........#................#ennnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnha.#....#..#.amnnnnnnnnh#...#hnnnnnnnnh..............#..........#.#hnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnb.#.....#....dmnnnnnnnnha.ainnnnnnnnnmi..........................dlnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnh#......#..#.afnnnnnnnnngdgmnnnnnnnnnnmha.#..#.................#.gnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnmc.#....#..#..#glnnnnnnnmkmnnnnnnnnnnnnnh#......................clnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnh#.............gmnnnnnnnnnnnnnnnnnnnnnnnha.#...................innnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnme..........##.#elnnnnnnnnnnnnnnnnnnnnnnnh#...................elnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnia...........#.#dknnnnnnnnnnnnnnnnnnnnnnmhb.............##.#alnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnmga..............bhlmnnnnnnnnnnnnnnnnnnnnng.#...........##.#bmnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnmc.......###...#..cimnnnnnnnnnnnnnnnnnnmic..........#......ajnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnkd........#........cfknnnnnnnnnnnnnnkfb#..........#........#hnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnic....##...........#bcehklmmnmljhfba.......................agnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnja#...............###.##aaabba#............................ahnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnhc..#..........................#.............##..........#.ahnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnib..##......................................##..........##.ahmnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnjc......................................................#.#emnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnjd#................####.....#.............##............#cjnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnmfa......................................aba.........a#bknnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnjd.................................#..elmj#.......#.clnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnmgda..##................#..........cilnnnha.##..#.elnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnlgc#...#...##...........###..##dglnnnnnng#.##.#clnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnliea##....................behlnnnnnnnnnh#..#blnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnkidca..............#cfilnnnnnnnnnnnnnib#cknnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnmkigecbbbabcdefikmnnnnnnnnnnnnnnnnnhejnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnn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nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn",
+"nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
+};
diff --git a/examples/table/small-table-demo/small-table-demo.doc b/examples/table/small-table-demo/small-table-demo.doc
new file mode 100644
index 000000000..d2ced77b7
--- /dev/null
+++ b/examples/table/small-table-demo/small-table-demo.doc
@@ -0,0 +1,15 @@
+/*! \page small-table-example-example.html
+
+ \ingroup table-examples
+ \title Small Table Example
+
+ This example displays a QTable and some \l{QTableItem}s.
+
+ <hr>
+
+ Implementation:
+
+ \include table/small-table-demo/main.cpp
+*/
+
+
diff --git a/examples/table/small-table-demo/small-table-demo.pro b/examples/table/small-table-demo/small-table-demo.pro
new file mode 100644
index 000000000..c052fa1a8
--- /dev/null
+++ b/examples/table/small-table-demo/small-table-demo.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = smalltable
+
+CONFIG += qt warn_on release
+DEPENDPATH = ../../include
+
+REQUIRES = table full-config
+
+HEADERS =
+SOURCES = main.cpp
diff --git a/examples/table/statistics/main.cpp b/examples/table/statistics/main.cpp
new file mode 100644
index 000000000..0f58c21b8
--- /dev/null
+++ b/examples/table/statistics/main.cpp
@@ -0,0 +1,20 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-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 "statistics.h"
+#include <qapplication.h>
+int main( int argc, char **argv )
+{
+ TQApplication a(argc,argv);
+
+ Table t;
+ a.setMainWidget( &t );
+ t.show();
+ return a.exec();
+}
diff --git a/examples/table/statistics/statistics.cpp b/examples/table/statistics/statistics.cpp
new file mode 100644
index 000000000..f64b67568
--- /dev/null
+++ b/examples/table/statistics/statistics.cpp
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-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 "statistics.h"
+
+#include <qdir.h>
+#include <qstringlist.h>
+#include <qheader.h>
+#include <qcombobox.h>
+#include <stdlib.h>
+
+const char* dirs[] = {
+ "kernel",
+ "tools",
+ "widgets",
+ "dialogs",
+ "xml",
+ "table",
+ "network",
+ "opengl",
+ "canvas",
+ 0
+};
+
+Table::Table()
+ : TQTable( 10, 100, 0, "table" )
+{
+ setSorting( TRUE );
+ horizontalHeader()->setLabel( 0, tr( "File" ) );
+ horizontalHeader()->setLabel( 1, tr( "Size (bytes)" ) );
+ horizontalHeader()->setLabel( 2, tr( "Use in Sum" ) );
+ initTable();
+ adjustColumn( 0 );
+
+ // if the user edited something we might need to recalculate the sum
+ connect( this, SIGNAL( valueChanged( int, int ) ),
+ this, SLOT( recalcSum( int, int ) ) );
+}
+
+void Table::initTable()
+{
+ // read all the TQt source and header files into a list
+ TQStringList all;
+ int i = 0;
+ TQString srcdir( "../../../src/" );
+ while ( dirs[ i ] ) {
+ TQDir dir( srcdir + dirs[ i ] );
+ TQStringList lst = dir.entryList( "*.cpp; *.h" );
+ for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
+ if ( ( *it ).contains( "moc" ) )
+ continue;
+ all << (TQString( dirs[ i ] ) + "/" + *it);
+ }
+ ++i;
+ }
+
+ // set the number of rows we'll need for the table
+ setNumRows( all.count() + 1 );
+ i = 0;
+ int sum = 0;
+
+ // insert the data into the table
+ for ( TQStringList::Iterator it = all.begin(); it != all.end(); ++it ) {
+ setText( i, 0, *it );
+ TQFile f( srcdir + *it );
+ setText( i, 1, TQString::number( (ulong)f.size() ) );
+ ComboItem *ci = new ComboItem( this, TQTableItem::WhenCurrent );
+ setItem( i++, 2, ci );
+ sum += f.size();
+ }
+
+ // last row should show the sum
+ TableItem *i1 = new TableItem( this, TQTableItem::Never, tr( "Sum" ) );
+ setItem( i, 0, i1 );
+ TableItem *i2 = new TableItem( this, TQTableItem::Never, TQString::number( sum ) );
+ setItem( i, 1, i2 );
+}
+
+void Table::recalcSum( int, int col )
+{
+ // only recalc if a value in the second or third column changed
+ if ( col < 1 || col > 2 )
+ return;
+
+ // recalc sum
+ int sum = 0;
+ for ( int i = 0; i < numRows() - 1; ++i ) {
+ if ( text( i, 2 ) == "No" )
+ continue;
+ sum += text( i, 1 ).toInt();
+ }
+
+ // insert calculated data
+ TableItem *i1 = new TableItem( this, TQTableItem::Never, tr( "Sum" ) );
+ setItem( numRows() - 1, 0, i1 );
+ TableItem *i2 = new TableItem( this, TQTableItem::Never, TQString::number( sum ) );
+ setItem( numRows() - 1, 1, i2 );
+}
+
+void Table::sortColumn( int col, bool ascending, bool /*wholeRows*/ )
+{
+ // sum row should not be sorted, so get rid of it for now
+ clearCell( numRows() - 1, 0 );
+ clearCell( numRows() - 1, 1 );
+ // do sort
+ TQTable::sortColumn( col, ascending, TRUE );
+ // re-insert sum row
+ recalcSum( 0, 1 );
+}
+
+
+
+void TableItem::paint( TQPainter *p, const TQColorGroup &cg, const TQRect &cr, bool selected )
+{
+ TQColorGroup g( cg );
+ // last row is the sum row - we want to make it more visible by
+ // using a red background
+ if ( row() == table()->numRows() - 1 )
+ g.setColor( TQColorGroup::Base, red );
+ TQTableItem::paint( p, g, cr, selected );
+}
+
+
+
+
+ComboItem::ComboItem( TQTable *t, EditType et )
+ : TQTableItem( t, et, "Yes" ), cb( 0 )
+{
+ // we do not want this item to be replaced
+ setReplaceable( FALSE );
+}
+
+TQWidget *ComboItem::createEditor() const
+{
+ // create an editor - a combobox in our case
+ ( (ComboItem*)this )->cb = new TQComboBox( table()->viewport() );
+ TQObject::connect( cb, SIGNAL( activated( int ) ), table(), SLOT( doValueChanged() ) );
+ cb->insertItem( "Yes" );
+ cb->insertItem( "No" );
+ // and initialize it
+ cb->setCurrentItem( text() == "No" ? 1 : 0 );
+ return cb;
+}
+
+void ComboItem::setContentFromEditor( TQWidget *w )
+{
+ // the user changed the value of the combobox, so synchronize the
+ // value of the item (its text), with the value of the combobox
+ if ( w->inherits( "TQComboBox" ) )
+ setText( ( (TQComboBox*)w )->currentText() );
+ else
+ TQTableItem::setContentFromEditor( w );
+}
+
+void ComboItem::setText( const TQString &s )
+{
+ if ( cb ) {
+ // initialize the combobox from the text
+ if ( s == "No" )
+ cb->setCurrentItem( 1 );
+ else
+ cb->setCurrentItem( 0 );
+ }
+ TQTableItem::setText( s );
+}
diff --git a/examples/table/statistics/statistics.doc b/examples/table/statistics/statistics.doc
new file mode 100644
index 000000000..4cd47d897
--- /dev/null
+++ b/examples/table/statistics/statistics.doc
@@ -0,0 +1,27 @@
+/*! \page statistics-example.html
+
+ \ingroup table-examples
+ \title Table Example
+
+ Another QTable example.
+
+ <hr>
+
+ Header file:
+
+ \include table/statistics/statistics.h
+
+ <hr>
+
+ Implementation:
+
+ \include table/statistics/statistics.cpp
+
+ <hr>
+
+ Main:
+
+ \include table/statistics/main.cpp
+*/
+
+
diff --git a/examples/table/statistics/statistics.h b/examples/table/statistics/statistics.h
new file mode 100644
index 000000000..efb0358a6
--- /dev/null
+++ b/examples/table/statistics/statistics.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-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.
+**
+*****************************************************************************/
+
+#ifndef STATISTICS_H
+#define STATISTICS_H
+
+#include <qtable.h>
+#include <qcombobox.h>
+
+class TableItem : public TQTableItem
+{
+public:
+ TableItem( TQTable *t, EditType et, const TQString &txt ) : TQTableItem( t, et, txt ) {}
+ void paint( TQPainter *p, const TQColorGroup &cg, const TQRect &cr, bool selected );
+};
+
+class ComboItem : public TQTableItem
+{
+public:
+ ComboItem( TQTable *t, EditType et );
+ TQWidget *createEditor() const;
+ void setContentFromEditor( TQWidget *w );
+ void setText( const TQString &s );
+
+private:
+ TQComboBox *cb;
+
+};
+
+class Table : public TQTable
+{
+ Q_OBJECT
+
+public:
+ Table();
+ void sortColumn( int col, bool ascending, bool wholeRows );
+
+private slots:
+ void recalcSum( int row, int col );
+
+private:
+ void initTable();
+
+};
+
+#endif
diff --git a/examples/table/statistics/statistics.pro b/examples/table/statistics/statistics.pro
new file mode 100644
index 000000000..d172d5266
--- /dev/null
+++ b/examples/table/statistics/statistics.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = statistics
+
+CONFIG += qt warn_on release
+DEPENDPATH = ../../include
+
+REQUIRES = table full-config
+
+HEADERS = statistics.h
+SOURCES = statistics.cpp main.cpp