summaryrefslogtreecommitdiffabout
path: root/qtcompat
Side-by-side diff
Diffstat (limited to 'qtcompat') (more/less context) (show whitespace changes)
-rw-r--r--qtcompat/qcombotableitem.cpp481
-rw-r--r--qtcompat/qcombotableitem.h571
-rw-r--r--qtcompat/qgridview.cpp362
-rw-r--r--qtcompat/qgridview.h138
-rw-r--r--qtcompat/qinputdialog.cpp495
-rw-r--r--qtcompat/qinputdialog.h105
-rw-r--r--qtcompat/qinputdialog.h.wech14
-rw-r--r--qtcompat/qksplitter.h23
-rw-r--r--qtcompat/qmemarray.h8
-rw-r--r--qtcompat/qpair.h96
-rw-r--r--qtcompat/qptrlist.h10
-rw-r--r--qtcompat/qptrstack.h9
-rw-r--r--qtcompat/qptrvector.h8
-rw-r--r--qtcompat/qtcompat.pro31
-rw-r--r--qtcompat/qtcompat.pro.back19
-rw-r--r--qtcompat/qtooltipcompat.cpp42
-rw-r--r--qtcompat/qtooltipcompat.h34
17 files changed, 2446 insertions, 0 deletions
diff --git a/qtcompat/qcombotableitem.cpp b/qtcompat/qcombotableitem.cpp
new file mode 100644
index 0000000..348ea24
--- a/dev/null
+++ b/qtcompat/qcombotableitem.cpp
@@ -0,0 +1,481 @@
+/****************************************************************************
+**
+** Implementation of QTable widget class
+**
+** Created : 000607
+**
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
+**
+** This file is part of the table module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition licenses may use this
+** file in accordance with the Qt Commercial License Agreement provided
+** with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+/*US
+#include "qglobal.h"
+#if defined(Q_CC_BOR)
+// needed for qsort() because of a std namespace problem on Borland
+#include "qplatformdefs.h"
+#endif
+*/
+#include "qcombotableitem.h"
+
+#include "qcombobox.h"
+#include "qstyle.h"
+
+/*US
+
+#ifndef QT_NO_TABLE
+
+#include "qpainter.h"
+#include "qlineedit.h"
+#include "qcursor.h"
+#include "qapplication.h"
+#include "qtimer.h"
+#include "qobjectlist.h"
+#include "qiconset.h"
+#include "qcombobox.h"
+#include "qcheckbox.h"
+#include "qdragobject.h"
+#include "qevent.h"
+#include "qlistbox.h"
+#include "qstyle.h"
+
+#include <stdlib.h>
+#include <limits.h>
+
+static bool qt_update_cell_widget = TRUE;
+
+class QM_EXPORT_TABLE QTableHeader : public QHeader
+{
+ friend class QTable;
+ Q_OBJECT
+
+public:
+ enum SectionState {
+ Normal,
+ Bold,
+ Selected
+ };
+
+ QTableHeader( int, QTable *t, QWidget* parent=0, const char* name=0 );
+ ~QTableHeader() {};
+ void addLabel( const QString &s, int size );
+ void setLabel( int section, const QString & s, int size = -1 );
+ void setLabel( int section, const QIconSet & iconset, const QString & s,
+ int size = -1 );
+ void removeLabel( int section );
+
+ void setSectionState( int s, SectionState state );
+ void setSectionStateToAll( SectionState state );
+ SectionState sectionState( int s ) const;
+
+ int sectionSize( int section ) const;
+ int sectionPos( int section ) const;
+ int sectionAt( int section ) const;
+
+ void setSectionStretchable( int s, bool b );
+ bool isSectionStretchable( int s ) const;
+
+ void updateCache();
+
+signals:
+ void sectionSizeChanged( int s );
+
+protected:
+ void paintEvent( QPaintEvent *e );
+ void paintSection( QPainter *p, int index, const QRect& fr );
+ void mousePressEvent( QMouseEvent *e );
+ void mouseMoveEvent( QMouseEvent *e );
+ void mouseReleaseEvent( QMouseEvent *e );
+ void mouseDoubleClickEvent( QMouseEvent *e );
+ void resizeEvent( QResizeEvent *e );
+
+private slots:
+ void doAutoScroll();
+ void sectionWidthChanged( int col, int os, int ns );
+ void indexChanged( int sec, int oldIdx, int newIdx );
+ void updateStretches();
+ void updateWidgetStretches();
+
+private:
+ void updateSelections();
+ void saveStates();
+ void setCaching( bool b );
+ void swapSections( int oldIdx, int newIdx, bool swapTable = TRUE );
+ bool doSelection( QMouseEvent *e );
+ void sectionLabelChanged( int section );
+ void resizeArrays( int n );
+
+private:
+ QMemArray<int> states, oldStates;
+ QMemArray<bool> stretchable;
+ QMemArray<int> sectionSizes, sectionPoses;
+ bool mousePressed;
+ int pressPos, startPos, endPos;
+ QTable *table;
+ QTimer *autoScrollTimer;
+ QWidget *line1, *line2;
+ bool caching;
+ int resizedSection;
+ bool isResizing;
+ int numStretches;
+ QTimer *stretchTimer, *widgetStretchTimer;
+ QTableHeaderPrivate *d;
+
+};
+
+#ifdef _WS_QWS_
+# define NO_LINE_WIDGET
+#endif
+
+
+
+struct QTablePrivate
+{
+ QTablePrivate() : hasRowSpan( FALSE ), hasColSpan( FALSE ),
+ redirectMouseEvent( FALSE )
+ {
+ hiddenRows.setAutoDelete( TRUE );
+ hiddenCols.setAutoDelete( TRUE );
+ }
+ uint hasRowSpan : 1;
+ uint hasColSpan : 1;
+ uint redirectMouseEvent : 1;
+ QIntDict<int> hiddenRows, hiddenCols;
+ QTimer *geomTimer;
+};
+
+struct QTableHeaderPrivate
+{
+#ifdef NO_LINE_WIDGET
+ int oldLinePos;
+#endif
+};
+
+static bool isRowSelection( QTable::SelectionMode selMode )
+{
+ return selMode == QTable::SingleRow || selMode == QTable::MultiRow;
+}
+*/
+
+
+/*!
+ \class QComboTableItem
+ \brief The QComboTableItem class provides a means of using
+ comboboxes in QTables.
+
+ \ingroup advanced
+ \module table
+
+ A QComboTableItem is a table item which looks and behaves like a
+ combobox. The advantage of using QComboTableItems rather than real
+ comboboxes is that a QComboTableItem uses far less resources than
+ real comboboxes in \l{QTable}s. When the cell has the focus it
+ displays a real combobox which the user can interact with. When
+ the cell does not have the focus the cell \e looks like a
+ combobox. Only text items (i.e. no pixmaps) may be used in
+ QComboTableItems.
+
+ QComboTableItem items have the edit type \c WhenCurrent (see
+ \l{EditType}). The QComboTableItem's list of items is provided by
+ a QStringList passed to the constructor.
+
+ The list of items may be changed using setStringList(). The
+ current item can be set with setCurrentItem() and retrieved with
+ currentItem(). The text of the current item can be obtained with
+ currentText(), and the text of a particular item can be retrieved
+ with text().
+
+ If isEditable() is TRUE the QComboTableItem will permit the user
+ to either choose an existing list item, or create a new list item
+ by entering their own text; otherwise the user may only choose one
+ of the existing list items.
+
+ To populate a table cell with a QComboTableItem use
+ QTable::setItem().
+
+ QComboTableItems may be deleted with QTable::clearCell().
+
+ QComboTableItems can be distinguished from \l{QTableItem}s and
+ \l{QCheckTableItem}s using their Run Time Type Identification
+ number (see rtti()).
+
+ \img qtableitems.png Table Items
+
+ \sa QCheckTableItem QTableItem QComboBox
+*/
+
+QComboBox *QComboTableItem::fakeCombo = 0;
+QWidget *fakeComboWidget = 0;
+
+/*!
+ Creates a combo table item for the table \a table. The combobox's
+ list of items is passed in the \a list argument. If \a editable is
+ TRUE the user may type in new list items; if \a editable is FALSE
+ the user may only select from the list of items provided.
+
+ By default QComboTableItems cannot be replaced by other table
+ items since isReplaceable() returns FALSE by default.
+
+ \sa QTable::clearCell() EditType
+*/
+
+QComboTableItem::QComboTableItem( QTable *table, const QStringList &list, bool editable )
+ : QTableItem( table, WhenCurrent, "" ), entries( list ), current( 0 ), edit( editable )
+{
+ setReplaceable( FALSE );
+ if ( !fakeCombo ) {
+ fakeComboWidget = new QWidget( 0, 0 );
+ fakeCombo = new QComboBox( FALSE, fakeComboWidget, 0 );
+ fakeCombo->hide();
+ }
+}
+
+/*!
+ Sets the list items of this QComboTableItem to the strings in the
+ string list \a l.
+*/
+
+void QComboTableItem::setStringList( const QStringList &l )
+{
+ entries = l;
+ current = 0;
+ if ( table()->cellWidget( row(), col() ) ) {
+ cb->clear();
+ cb->insertStringList( entries );
+ }
+ table()->updateCell( row(), col() );
+}
+
+/*! \reimp */
+
+QWidget *QComboTableItem::createEditor() const
+{
+ // create an editor - a combobox in our case
+ ( (QComboTableItem*)this )->cb = new QComboBox( edit, table()->viewport(), "qt_editor_cb" );
+ cb->insertStringList( entries );
+ cb->setCurrentItem( current );
+ QObject::connect( cb, SIGNAL( activated( int ) ), table(), SLOT( doValueChanged() ) );
+ return cb;
+}
+
+/*! \reimp */
+
+void QComboTableItem::setContentFromEditor( QWidget *w )
+{
+ if ( w->inherits( "QComboBox" ) ) {
+ QComboBox *cb = (QComboBox*)w;
+ entries.clear();
+ for ( int i = 0; i < cb->count(); ++i )
+ entries << cb->text( i );
+ current = cb->currentItem();
+ setText( *entries.at( current ) );
+ }
+}
+
+/*! \reimp */
+
+void QComboTableItem::paint( QPainter *p, const QColorGroup &cg,
+ const QRect &cr, bool selected )
+{
+ fakeCombo->resize( cr.width(), cr.height() );
+
+ QColorGroup c( cg );
+ if ( selected ) {
+ c.setBrush( QColorGroup::Base, cg.brush( QColorGroup::Highlight ) );
+ c.setColor( QColorGroup::Text, cg.highlightedText() );
+ }
+
+/*US QStyle::SFlags flags = QStyle::Style_Default;
+ if(isEnabled() && table()->isEnabled())
+ flags |= QStyle::Style_Enabled;
+*/
+//US table()->style().drawComplexControl( QStyle::CC_ComboBox, p, fakeCombo, fakeCombo->rect(), c, flags );
+
+ table()->style().drawComboButton(p, fakeCombo->x(), fakeCombo->y(), fakeCombo->width(), fakeCombo->height(), c, FALSE, FALSE, (/*US isEnabled() && */table()->isEnabled()), 0);
+ p->save();
+/*US
+ QRect textR = table()->style().querySubControlMetrics(QStyle::CC_ComboBox, fakeCombo,
+ QStyle::SC_ComboBoxEditField);
+
+*/
+ int align = alignment(); // alignment() changes entries
+//US p->drawText( textR, wordWrap() ? ( align | WordBreak ) : align, *entries.at( current ) );
+ QRect textR = QRect( fakeCombo->x()+2, fakeCombo->y(), fakeCombo->width()- 17, fakeCombo->height() );
+ //qDebug("x %d -- %d wid %d -- %d ", cr.x(),fakeCombo->x(), cr.width(), fakeCombo->width() );
+ p->drawText( textR, wordWrap() ? ( align | WordBreak ) : align, *entries.at( current ) );
+ p->restore();
+}
+
+/*!
+ Sets the list item \a i to be the combo table item's current list
+ item.
+
+ \sa currentItem()
+*/
+
+void QComboTableItem::setCurrentItem( int i )
+{
+ QWidget *w = table()->cellWidget( row(), col() );
+ if ( w && w->inherits( "QComboBox" ) ) {
+ ( (QComboBox*)w )->setCurrentItem( i );
+ current = i;
+ setText( ( (QComboBox*)w )->currentText() );
+ } else {
+ current = i;
+ setText( *entries.at( i ) );
+ table()->updateCell( row(), col() );
+ }
+}
+
+/*!
+ \overload
+
+ Sets the list item whose text is \a s to be the combo table item's
+ current list item. Does nothing if no list item has the text \a s.
+
+ \sa currentItem()
+*/
+
+void QComboTableItem::setCurrentItem( const QString &s )
+{
+ int i = entries.findIndex( s );
+ if ( i != -1 )
+ setCurrentItem( i );
+}
+
+/*!
+ Returns the index of the combo table item's current list item.
+
+ \sa setCurrentItem()
+*/
+
+int QComboTableItem::currentItem() const
+{
+ QWidget *w = table()->cellWidget( row(), col() );
+ if ( w && w->inherits( "QComboBox" ) )
+ return ( (QComboBox*)w )->currentItem();
+ return current;
+}
+
+/*!
+ Returns the text of the combo table item's current list item.
+
+ \sa currentItem() text()
+*/
+
+QString QComboTableItem::currentText() const
+{
+ QWidget *w = table()->cellWidget( row(), col() );
+ if ( w && w->inherits( "QComboBox" ) )
+ return ( (QComboBox*)w )->currentText();
+ return *entries.at( current );
+}
+
+/*!
+ Returns the total number of list items in the combo table item.
+*/
+
+int QComboTableItem::count() const
+{
+ QWidget *w = table()->cellWidget( row(), col() );
+ if ( w && w->inherits( "QComboBox" ) )
+ return ( (QComboBox*)w )->count();
+ return (int)entries.count(); //### size_t/int cast
+}
+
+/*!
+ Returns the text of the combo's list item at index \a i.
+
+ \sa currentText()
+*/
+
+QString QComboTableItem::text( int i ) const
+{
+ QWidget *w = table()->cellWidget( row(), col() );
+ if ( w && w->inherits( "QComboBox" ) )
+ return ( (QComboBox*)w )->text( i );
+ return *entries.at( i );
+}
+
+/*!
+ If \a b is TRUE the combo table item can be edited, i.e. the user
+ may enter a new text item themselves. If \a b is FALSE the user may
+ may only choose one of the existing items.
+
+ \sa isEditable()
+*/
+
+void QComboTableItem::setEditable( bool b )
+{
+ edit = b;
+}
+
+/*!
+ Returns TRUE if the user can add their own list items to the
+ combobox's list of items; otherwise returns FALSE.
+
+ \sa setEditable()
+*/
+
+bool QComboTableItem::isEditable() const
+{
+ return edit;
+}
+
+int QComboTableItem::RTTI = 1;
+
+/*!
+ \fn int QComboTableItem::rtti() const
+
+ Returns 1.
+
+ Make your derived classes return their own values for rtti()to
+ distinguish between different table item subclasses. You should
+ use values greater than 1000, preferably a large random number, to
+ allow for extensions to this class.
+
+
+ \sa QTableItem::rtti()
+*/
+
+int QComboTableItem::rtti() const
+{
+ return RTTI;
+}
+
+/*! \reimp */
+
+QSize QComboTableItem::sizeHint() const
+{
+ fakeCombo->insertItem( currentText() );
+ fakeCombo->setCurrentItem( fakeCombo->count() - 1 );
+ QSize sh = fakeCombo->sizeHint();
+ fakeCombo->removeItem( fakeCombo->count() - 1 );
+//US return sh.expandedTo( QApplication::globalStrut() );
+ return sh;
+}
+
diff --git a/qtcompat/qcombotableitem.h b/qtcompat/qcombotableitem.h
new file mode 100644
index 0000000..5688c1c
--- a/dev/null
+++ b/qtcompat/qcombotableitem.h
@@ -0,0 +1,571 @@
+/****************************************************************************
+**
+** Definition of QTable widget class
+**
+** Created : 000607
+**
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
+**
+** This file is part of the table module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition licenses may use this
+** file in accordance with the Qt Commercial License Agreement provided
+** with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QTCOMPAT_QCOMBOTABLEITEM_H
+#define QTCOMPAT_QCOMBOTABLEITEM_H
+
+#include "qtable.h"
+#include "qstringlist.h"
+
+class QComboBox;
+class QWidget;
+class QPainter;
+
+#define QM_EXPORT_TABLE Q_EXPORT
+
+/*US
+
+#ifndef QT_H
+#include "qscrollview.h"
+#include "qpixmap.h"
+#include "qptrvector.h"
+#include "qheader.h"
+#include "qmemarray.h"
+#include "qptrlist.h"
+#include "qguardedptr.h"
+#include "qshared.h"
+#include "qintdict.h"
+#include "qstringlist.h"
+#endif // QT_H
+
+#ifndef QT_NO_TABLE
+
+#if !defined( QT_MODULE_TABLE ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_TABLE )
+#define QM_EXPORT_TABLE
+#ifndef QM_TEMPLATE_EXTERN_TABLE
+# define QM_TEMPLATE_EXTERN_TABLE
+#endif
+#else
+#define QM_EXPORT_TABLE Q_EXPORT
+#define QM_TEMPLATE_EXTERN_TABLE Q_TEMPLATE_EXTERN
+#endif
+
+class QTableHeader;
+class QValidator;
+class QTable;
+class QPaintEvent;
+class QTimer;
+class QResizeEvent;
+class QComboBox;
+class QCheckBox;
+class QDragObject;
+
+struct QTablePrivate;
+struct QTableHeaderPrivate;
+
+
+class QM_EXPORT_TABLE QTableSelection
+{
+public:
+ QTableSelection();
+ QTableSelection( int start_row, int start_col, int end_row, int end_col );
+ void init( int row, int col );
+ void expandTo( int row, int col );
+ bool operator==( const QTableSelection &s ) const;
+ bool operator!=( const QTableSelection &s ) const { return !(operator==(s)); }
+
+ int topRow() const { return tRow; }
+ int bottomRow() const { return bRow; }
+ int leftCol() const { return lCol; }
+ int rightCol() const { return rCol; }
+ int anchorRow() const { return aRow; }
+ int anchorCol() const { return aCol; }
+ int numRows() const;
+ int numCols() const;
+
+ bool isActive() const { return active; }
+ bool isEmpty() const { return numRows() == 0; }
+
+private:
+ uint active : 1;
+ uint inited : 1;
+ int tRow, lCol, bRow, rCol;
+ int aRow, aCol;
+};
+
+#define Q_DEFINED_QTABLE_SELECTION
+#include "qwinexport.h"
+
+
+class QM_EXPORT_TABLE QTableItem : public Qt
+{
+ friend class QTable;
+
+public:
+ enum EditType { Never, OnTyping, WhenCurrent, Always };
+
+ QTableItem( QTable *table, EditType et );
+ QTableItem( QTable *table, EditType et, const QString &text );
+ QTableItem( QTable *table, EditType et, const QString &text,
+ const QPixmap &p );
+ virtual ~QTableItem();
+
+ virtual QPixmap pixmap() const;
+ virtual QString text() const;
+ virtual void setPixmap( const QPixmap &p );
+ virtual void setText( const QString &t );
+ QTable *table() const { return t; }
+
+ virtual int alignment() const;
+ virtual void setWordWrap( bool b );
+ bool wordWrap() const;
+
+ EditType editType() const;
+ virtual QWidget *createEditor() const;
+ virtual void setContentFromEditor( QWidget *w );
+ virtual void setReplaceable( bool );
+ bool isReplaceable() const;
+
+ virtual QString key() const;
+ virtual QSize sizeHint() const;
+
+ virtual void setSpan( int rs, int cs );
+ int rowSpan() const;
+ int colSpan() const;
+
+ virtual void setRow( int r );
+ virtual void setCol( int c );
+ int row() const;
+ int col() const;
+
+ virtual void paint( QPainter *p, const QColorGroup &cg,
+ const QRect &cr, bool selected );
+
+ void updateEditor( int oldRow, int oldCol );
+
+ virtual void setEnabled( bool b );
+ bool isEnabled() const;
+
+ virtual int rtti() const;
+ static int RTTI;
+
+private:
+ QString txt;
+ QPixmap pix;
+ QTable *t;
+ EditType edType;
+ uint wordwrap : 1;
+ uint tcha : 1;
+ uint enabled : 1;
+ int rw, cl;
+ int rowspan, colspan;
+#if (QT_VERSION >= 0x040000)
+#error "Add a setAlignment() function in 4.0 (but no d pointer)"
+#endif
+};
+
+#define Q_DEFINED_QTABLE_ITEM
+#include "qwinexport.h"
+*/
+class QM_EXPORT_TABLE QComboTableItem : public QTableItem
+{
+public:
+ QComboTableItem( QTable *table, const QStringList &list, bool editable = FALSE );
+ virtual QWidget *createEditor() const;
+ virtual void setContentFromEditor( QWidget *w );
+ virtual void paint( QPainter *p, const QColorGroup &cg,
+ const QRect &cr, bool selected );
+ virtual void setCurrentItem( int i );
+ virtual void setCurrentItem( const QString &i );
+ int currentItem() const;
+ QString currentText() const;
+ int count() const;
+#if !defined(Q_NO_USING_KEYWORD)
+ //using QTableItem::text;
+#endif
+
+
+ QString text( int i ) const;
+ virtual void setEditable( bool b );
+ bool isEditable() const;
+ virtual void setStringList( const QStringList &l );
+
+ int rtti() const;
+ static int RTTI;
+
+ QSize sizeHint() const;
+
+private:
+ QComboBox *cb;
+ QStringList entries;
+ int current;
+ bool edit;
+ static QComboBox *fakeCombo;
+
+};
+/*US
+
+class QM_EXPORT_TABLE QCheckTableItem : public QTableItem
+{
+public:
+ QCheckTableItem( QTable *table, const QString &txt );
+ void setText( const QString &t );
+ virtual QWidget *createEditor() const;
+ virtual void setContentFromEditor( QWidget *w );
+ virtual void paint( QPainter *p, const QColorGroup &cg,
+ const QRect &cr, bool selected );
+ virtual void setChecked( bool b );
+ bool isChecked() const;
+
+ int rtti() const;
+ static int RTTI;
+
+ QSize sizeHint() const;
+
+private:
+ QCheckBox *cb;
+ bool checked;
+
+};
+
+class QM_EXPORT_TABLE QTable : public QScrollView
+{
+ Q_OBJECT
+ Q_ENUMS( SelectionMode FocusStyle )
+ Q_PROPERTY( int numRows READ numRows WRITE setNumRows )
+ Q_PROPERTY( int numCols READ numCols WRITE setNumCols )
+ Q_PROPERTY( bool showGrid READ showGrid WRITE setShowGrid )
+ Q_PROPERTY( bool rowMovingEnabled READ rowMovingEnabled WRITE setRowMovingEnabled )
+ Q_PROPERTY( bool columnMovingEnabled READ columnMovingEnabled WRITE setColumnMovingEnabled )
+ Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
+ Q_PROPERTY( bool sorting READ sorting WRITE setSorting )
+ Q_PROPERTY( SelectionMode selectionMode READ selectionMode WRITE setSelectionMode )
+ Q_PROPERTY( FocusStyle focusStyle READ focusStyle WRITE setFocusStyle )
+ Q_PROPERTY( int numSelections READ numSelections )
+
+ friend class QTableHeader;
+ friend class QComboTableItem;
+ friend class QCheckTableItem;
+ friend class QTableItem;
+
+public:
+ QTable( QWidget* parent=0, const char* name=0 );
+ QTable( int numRows, int numCols,
+ QWidget* parent=0, const char* name=0 );
+ ~QTable();
+
+ QHeader *horizontalHeader() const;
+ QHeader *verticalHeader() const;
+
+ enum SelectionMode { Single, Multi, SingleRow, MultiRow, NoSelection };
+ virtual void setSelectionMode( SelectionMode mode );
+ SelectionMode selectionMode() const;
+
+ virtual void setItem( int row, int col, QTableItem *item );
+ virtual void setText( int row, int col, const QString &text );
+ virtual void setPixmap( int row, int col, const QPixmap &pix );
+ virtual QTableItem *item( int row, int col ) const;
+ virtual QString text( int row, int col ) const;
+ virtual QPixmap pixmap( int row, int col ) const;
+ virtual void clearCell( int row, int col );
+
+ virtual QRect cellGeometry( int row, int col ) const;
+ virtual int columnWidth( int col ) const;
+ virtual int rowHeight( int row ) const;
+ virtual int columnPos( int col ) const;
+ virtual int rowPos( int row ) const;
+ virtual int columnAt( int x ) const;
+ virtual int rowAt( int y ) const;
+
+ virtual int numRows() const;
+ virtual int numCols() const;
+
+ void updateCell( int row, int col );
+
+ bool eventFilter( QObject * o, QEvent * );
+
+ int currentRow() const { return curRow; }
+ int currentColumn() const { return curCol; }
+ void ensureCellVisible( int row, int col );
+
+ bool isSelected( int row, int col ) const;
+ bool isRowSelected( int row, bool full = FALSE ) const;
+ bool isColumnSelected( int col, bool full = FALSE ) const;
+ int numSelections() const;
+ QTableSelection selection( int num ) const;
+ virtual int addSelection( const QTableSelection &s );
+ virtual void removeSelection( const QTableSelection &s );
+ virtual void removeSelection( int num );
+ virtual int currentSelection() const;
+
+ void selectCells( int start_row, int start_col, int end_row, int end_col );
+ void selectRow( int row );
+ void selectColumn( int col );
+
+ bool showGrid() const;
+
+ bool columnMovingEnabled() const;
+ bool rowMovingEnabled() const;
+
+ virtual void sortColumn( int col, bool ascending = TRUE,
+ bool wholeRows = FALSE );
+ bool sorting() const;
+
+ virtual void takeItem( QTableItem *i );
+
+ virtual void setCellWidget( int row, int col, QWidget *e );
+ virtual QWidget *cellWidget( int row, int col ) const;
+ virtual void clearCellWidget( int row, int col );
+
+ virtual QRect cellRect( int row, int col ) const;
+
+ virtual void paintCell( QPainter *p, int row, int col,
+ const QRect &cr, bool selected );
+ virtual void paintCell( QPainter *p, int row, int col,
+ const QRect &cr, bool selected, const QColorGroup &cg );
+ virtual void paintFocus( QPainter *p, const QRect &r );
+ QSize sizeHint() const;
+
+ bool isReadOnly() const;
+ bool isRowReadOnly( int row ) const;
+ bool isColumnReadOnly( int col ) const;
+
+ void setEnabled( bool b );
+
+ void repaintSelections();
+
+ enum FocusStyle { FollowStyle, SpreadSheet };
+ virtual void setFocusStyle( FocusStyle fs );
+ FocusStyle focusStyle() const;
+
+ void updateHeaderStates();
+
+public slots:
+ virtual void setNumRows( int r );
+ virtual void setNumCols( int r );
+ virtual void setShowGrid( bool b );
+ virtual void hideRow( int row );
+ virtual void hideColumn( int col );
+ virtual void showRow( int row );
+ virtual void showColumn( int col );
+
+ virtual void setColumnWidth( int col, int w );
+ virtual void setRowHeight( int row, int h );
+
+ virtual void adjustColumn( int col );
+ virtual void adjustRow( int row );
+
+ virtual void setColumnStretchable( int col, bool stretch );
+ virtual void setRowStretchable( int row, bool stretch );
+ bool isColumnStretchable( int col ) const;
+ bool isRowStretchable( int row ) const;
+ virtual void setSorting( bool b );
+ virtual void swapRows( int row1, int row2, bool swapHeader = FALSE );
+ virtual void swapColumns( int col1, int col2, bool swapHeader = FALSE );
+ virtual void swapCells( int row1, int col1, int row2, int col2 );
+
+ virtual void setLeftMargin( int m );
+ virtual void setTopMargin( int m );
+ virtual void setCurrentCell( int row, int col );
+ void clearSelection( bool repaint = TRUE );
+ virtual void setColumnMovingEnabled( bool b );
+ virtual void setRowMovingEnabled( bool b );
+
+ virtual void setReadOnly( bool b );
+ virtual void setRowReadOnly( int row, bool ro );
+ virtual void setColumnReadOnly( int col, bool ro );
+
+ virtual void setDragEnabled( bool b );
+ bool dragEnabled() const;
+
+ virtual void insertRows( int row, int count = 1 );
+ virtual void insertColumns( int col, int count = 1 );
+ virtual void removeRow( int row );
+ virtual void removeRows( const QMemArray<int> &rows );
+ virtual void removeColumn( int col );
+ virtual void removeColumns( const QMemArray<int> &cols );
+
+ virtual void editCell( int row, int col, bool replace = FALSE );
+
+ void setRowLabels( const QStringList &labels );
+ void setColumnLabels( const QStringList &labels );
+
+protected:
+ enum EditMode { NotEditing, Editing, Replacing };
+ void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
+ void contentsMousePressEvent( QMouseEvent* );
+ void contentsMouseMoveEvent( QMouseEvent* );
+ void contentsMouseDoubleClickEvent( QMouseEvent* );
+ void contentsMouseReleaseEvent( QMouseEvent* );
+ void contentsContextMenuEvent( QContextMenuEvent * e );
+ void keyPressEvent( QKeyEvent* );
+ void focusInEvent( QFocusEvent* );
+ void focusOutEvent( QFocusEvent* );
+ void viewportResizeEvent( QResizeEvent * );
+ void showEvent( QShowEvent *e );
+ void paintEvent( QPaintEvent *e );
+ void setEditMode( EditMode mode, int row, int col );
+#ifndef QT_NO_DRAGANDDROP
+ virtual void contentsDragEnterEvent( QDragEnterEvent *e );
+ virtual void contentsDragMoveEvent( QDragMoveEvent *e );
+ virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
+ virtual void contentsDropEvent( QDropEvent *e );
+ virtual QDragObject *dragObject();
+ virtual void startDrag();
+#endif
+
+ virtual void paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch );
+ virtual void activateNextCell();
+ virtual QWidget *createEditor( int row, int col, bool initFromCell ) const;
+ virtual void setCellContentFromEditor( int row, int col );
+ virtual QWidget *beginEdit( int row, int col, bool replace );
+ virtual void endEdit( int row, int col, bool accept, bool replace );
+
+ virtual void resizeData( int len );
+ virtual void insertWidget( int row, int col, QWidget *w );
+ int indexOf( int row, int col ) const;
+
+ void windowActivationChange( bool );
+ bool isEditing() const;
+ EditMode editMode() const;
+ int currEditRow() const;
+ int currEditCol() const;
+
+protected slots:
+ virtual void columnWidthChanged( int col );
+ virtual void rowHeightChanged( int row );
+ virtual void columnIndexChanged( int section, int fromIndex, int toIndex );
+ virtual void rowIndexChanged( int section, int fromIndex, int toIndex );
+ virtual void columnClicked( int col );
+
+signals:
+ void currentChanged( int row, int col );
+ void clicked( int row, int col, int button, const QPoint &mousePos );
+ void doubleClicked( int row, int col, int button, const QPoint &mousePos );
+ void pressed( int row, int col, int button, const QPoint &mousePos );
+ void selectionChanged();
+ void valueChanged( int row, int col );
+ void contextMenuRequested( int row, int col, const QPoint &pos );
+#ifndef QT_NO_DRAGANDDROP
+ void dropped( QDropEvent *e );
+#endif
+
+private slots:
+ void doAutoScroll();
+ void doValueChanged();
+ void updateGeometriesSlot();
+
+private:
+ void contentsMousePressEventEx( QMouseEvent* );
+ void drawContents( QPainter* );
+ void updateGeometries();
+ void repaintSelections( QTableSelection *oldSelection,
+ QTableSelection *newSelection,
+ bool updateVertical = TRUE,
+ bool updateHorizontal = TRUE );
+ QRect rangeGeometry( int topRow, int leftCol,
+ int bottomRow, int rightCol, bool &optimize );
+ void fixRow( int &row, int y );
+ void fixCol( int &col, int x );
+
+ void init( int numRows, int numCols );
+ QSize tableSize() const;
+ void repaintCell( int row, int col );
+ void contentsToViewport2( int x, int y, int& vx, int& vy );
+ QPoint contentsToViewport2( const QPoint &p );
+ void viewportToContents2( int vx, int vy, int& x, int& y );
+ QPoint viewportToContents2( const QPoint &p );
+
+ void updateRowWidgets( int row );
+ void updateColWidgets( int col );
+ bool isSelected( int row, int col, bool includeCurrent ) const;
+ void setCurrentCell( int row, int col, bool updateSelections );
+ void fixCell( int &row, int &col, int key );
+ void delayedUpdateGeometries();
+ struct TableWidget
+ {
+ TableWidget( QWidget *w, int r, int c ) : wid( w ), row( r ), col ( c ) {}
+ QWidget *wid;
+ int row, col;
+ };
+ void saveContents( QPtrVector<QTableItem> &tmp,
+ QPtrVector<TableWidget> &tmp2 );
+ void updateHeaderAndResizeContents( QTableHeader *header,
+ int num, int colRow,
+ int width, bool &updateBefore );
+ void restoreContents( QPtrVector<QTableItem> &tmp,
+ QPtrVector<TableWidget> &tmp2 );
+ void finishContentsResze( bool updateBefore );
+
+private:
+ QPtrVector<QTableItem> contents;
+ QPtrVector<QWidget> widgets;
+ int curRow;
+ int curCol;
+ QTableHeader *leftHeader, *topHeader;
+ EditMode edMode;
+ int editCol, editRow;
+ QPtrList<QTableSelection> selections;
+ QTableSelection *currentSel;
+ QTimer *autoScrollTimer;
+ int lastSortCol;
+ bool sGrid : 1;
+ bool mRows : 1;
+ bool mCols : 1;
+ bool asc : 1;
+ bool doSort : 1;
+ bool mousePressed : 1;
+ bool readOnly : 1;
+ bool shouldClearSelection : 1;
+ bool dEnabled : 1;
+ bool context_menu : 1;
+ bool drawActiveSelection : 1;
+ bool was_visible : 1;
+ SelectionMode selMode;
+ int pressedRow, pressedCol;
+ QTablePrivate *d;
+ QIntDict<int> roRows;
+ QIntDict<int> roCols;
+ int startDragRow;
+ int startDragCol;
+ QPoint dragStartPos;
+ int oldCurrentRow, oldCurrentCol;
+ QWidget *unused_topLeftCorner; //### remove in 4.0
+ FocusStyle focusStl;
+ QSize unused_cachedSizeHint; // ### remove in 4.0
+
+#if defined(Q_DISABLE_COPY)
+ QTable( const QTable & );
+ QTable &operator=( const QTable & );
+#endif
+};
+
+#define Q_DEFINED_QTABLE
+#include "qwinexport.h"
+#endif // QT_NO_TABLE
+
+*/
+#endif // QTCOMPAT_QCOMBOTABLEITEM_H
diff --git a/qtcompat/qgridview.cpp b/qtcompat/qgridview.cpp
new file mode 100644
index 0000000..bee3698
--- a/dev/null
+++ b/qtcompat/qgridview.cpp
@@ -0,0 +1,362 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of QGridView class
+**
+** Created: 010523
+**
+** Copyright (C) 1992-2001 Trolltech AS. All rights reserved.
+**
+** This file is part of the widgets module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+
+#include "qgridview.h"
+
+#ifndef QT_NO_GRIDVIEW
+
+#include "qpainter.h"
+
+/*!
+ \class QGridView qgridview.h
+ \brief The QGridView class provides an abstract base for fixed-size
+ grids.
+
+ \ingroup abstractwidgets
+
+ A grid view consists of a number of abstract cells organized in rows
+ and columns. The cells have a fixed size and are identified with a
+ row index and a column index. The top-left cell is in row 0, column
+ 0. The bottom-right cell is in row numRows()-1, column numCols()-1.
+
+ You can define \l numRows, \l numCols, \l cellWidth and
+ \l cellHeight. Reimplement the pure virtual function paintCell() to
+ draw the content of a cell.
+
+ With ensureCellVisible(), you can ensure a certain cell is
+ visible. With rowAt() and columnAt() you can find a cell based on
+ the given x- and y-coordinates.
+
+ If you need to monitor changes to the grid's dimensions (i.e. when
+ numRows or numCols is changed), reimplement the dimensionChange()
+ change handler.
+
+ Note: the row, column indices are always given in the order, row
+ (vertical offset) then column (horizontal offset). This order is the
+ opposite of all pixel operations, which are given in the order x
+ (horizontal offset), y (vertical offset).
+
+ QGridView is a very simple abstract class based on QScrollView. It
+ is designed to simplify the task of drawing many cells of the same
+ size in a potentially scrollable canvas. If you need rows and
+ columns in different sizes, use a QTable instead. If you need a
+ simple list of items, use a QListBox. If you need to present
+ hierachical data use a QListView, and if you need random objects at
+ random positions, consider using either a QIconView or a QCanvas.
+
+*/
+
+
+/*!
+ Constructs a grid view.
+
+ The \a parent, \a name and widget flag, \a f, arguments are passed to the
+ QScrollView constructor.
+*/
+QGridView::QGridView( QWidget *parent, const char *name, WFlags f )
+ :QScrollView( parent, name ,f ),nrows(5),ncols(5),cellw(12),cellh(12)
+{
+ viewport()->setBackgroundMode( PaletteBase );
+ setBackgroundMode( PaletteBackground );
+ viewport()->setFocusProxy( this );
+}
+
+/*!
+ Destroys the grid view.
+*/
+QGridView::~QGridView()
+{
+}
+
+void QGridView::updateGrid()
+{
+ resizeContents( ncols * cellw, nrows * cellh );
+}
+
+/*! \property QGridView::numRows
+ \brief The number of rows in the grid
+
+ \sa numCols
+*/
+void QGridView::setNumRows( int numRows )
+{
+ int oldnrows = nrows;
+ nrows = numRows;
+ dimensionChange( oldnrows, ncols );
+ updateGrid();
+}
+
+/*! \property QGridView::numCols
+ \brief The number of columns in the grid
+
+ \sa numRows
+*/
+void QGridView::setNumCols( int numCols )
+{
+ int oldncols = ncols;
+ ncols = numCols;
+ dimensionChange( nrows, oldncols );
+ updateGrid();
+}
+
+/*! \property QGridView::cellWidth
+ \brief The width of a grid column
+
+ All columns in a grid view have the same width.
+
+ \sa cellHeight
+*/
+void QGridView::setCellWidth( int cellWidth )
+{
+ cellw = cellWidth;
+ updateGrid();
+ updateContents( contentsX(), contentsY(), visibleWidth(), visibleHeight() );
+}
+
+/*! \property QGridView::cellHeight
+ \brief The height of a grid row
+
+ All rows in a grid view have the same height.
+
+ \sa cellWidth
+*/
+void QGridView::setCellHeight( int cellHeight )
+{
+ cellh = cellHeight;
+ updateGrid();
+ updateContents( contentsX(), contentsY(), visibleWidth(), visibleHeight() );
+}
+
+/*!
+ Returns the geometry of cell (\a row, \a column) in the content
+ coordinate system.
+
+ \sa cellRect()
+ */
+QRect QGridView::cellGeometry( int row, int column )
+{
+ QRect r;
+ if ( row >= 0 && row < nrows && column >= 0 && column < ncols )
+ r.setRect( cellw * column, cellh * row, cellw, cellh );
+ return r;
+}
+
+/*! Repaints cell (\a row, \a column).
+
+ If \a erase is TRUE, Qt erases the area of the cell before the
+ paintCell() call; otherwise no erasing takes place.
+
+ \sa QWidget::repaint()
+ */
+void QGridView::repaintCell( int row, int column, bool erase )
+{
+ QScrollView::repaintContents( cellGeometry( row, column ), erase );
+}
+
+/*! Updates cell (\a row, \a column).
+
+ \sa QWidget::update()
+ */
+void QGridView::updateCell( int row, int column )
+{
+ updateContents( cellGeometry( row, column ) );
+}
+
+/*!
+ Ensure cell (\a row, \a column) is visible, scrolling the grid view
+ if necessary.
+ */
+void QGridView::ensureCellVisible( int row, int column )
+{
+ QRect r = cellGeometry( row, column );
+ ensureVisible( r.x(), r.y(), r.width(), r.height() );
+}
+
+/*! This function fills the \a cw pixels wide and \a ch pixels high
+ rectangle starting at position (\a cx, \a cy) with the
+ background color using the painter \a p.
+
+ paintEmptyArea() is invoked by drawContents() to erase
+ or fill unused areas.
+*/
+
+void QGridView::paintEmptyArea( QPainter *p, int cx ,int cy, int cw, int ch)
+{
+ if ( gridSize().width() >= contentsWidth() && gridSize().height() >= contentsHeight() )
+ return;
+ // Region of the rect we should draw
+ contentsToViewport( cx, cy, cx, cy );
+ QRegion reg( QRect( cx, cy, cw, ch ) );
+ // Subtract the table from it
+ reg = reg.subtract( QRect( contentsToViewport( QPoint( 0, 0 ) ), gridSize() ) );
+
+ // And draw the rectangles (transformed as needed)
+ QArray<QRect> r = reg.rects();
+ QBrush brush = colorGroup().brush( QColorGroup::Background );
+ for ( int i = 0; i < (int)r.count(); ++i)
+ p->fillRect( r[ i ], brush );
+}
+
+/*!\reimp
+ */
+void QGridView::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
+{
+ int colfirst = columnAt( cx );
+ int collast = columnAt( cx + cw );
+ int rowfirst = rowAt( cy );
+ int rowlast = rowAt( cy + ch );
+
+ if ( rowfirst == -1 || colfirst == -1 ) {
+ paintEmptyArea( p, cx, cy, cw, ch );
+ return;
+ }
+
+ if ( collast < 0 || collast >= ncols )
+ collast = ncols-1;
+ if ( rowlast < 0 || rowlast >= nrows )
+ rowlast = nrows-1;
+
+ // Go through the rows
+ for ( int r = rowfirst; r <= rowlast; ++r ) {
+ // get row position and height
+ int rowp = r * cellh;
+
+ // Go through the columns in the row r
+ // if we know from where to where, go through [colfirst, collast],
+ // else go through all of them
+ for ( int c = colfirst; c <= collast; ++c ) {
+ // get position and width of column c
+ int colp = c * cellw;
+ // Translate painter and draw the cell
+ p->translate( colp, rowp );
+ paintCell( p, r, c );
+ p->translate( -colp, -rowp );
+ }
+ }
+
+ // Paint empty rects
+ paintEmptyArea( p, cx, cy, cw, ch );
+}
+
+/*!
+ \reimp
+
+ (Implemented to get rid of a compiler warning.)
+*/
+void QGridView::drawContents( QPainter * )
+{
+}
+
+/*! \fn void QGridView::dimensionChange( int oldNumRows, int oldNumCols )
+
+ This change handler is called whenever any of the grid's dimensions
+ changes. \a oldNumRows and \a oldNumCols contain the old dimensions,
+ numRows() and numCols() contain the new dimensions.
+ */
+void QGridView::dimensionChange( int, int ) {}
+
+
+
+/*! \fn int QGridView::rowAt( int y ) const
+
+ Returns the number of the row at position \a y. \a y must be given in
+ content coordinates.
+
+ \sa columnAt()
+ */
+
+/*! \fn int QGridView::columnAt( int x ) const
+
+ Returns the number of the column at position \a x. \a x must be
+ given in content coordinates.
+
+ \sa rowAt()
+ */
+
+/*!
+ \fn void QGridView::paintCell( QPainter *p, int row, int col )
+
+ This pure virtual function is called to paint the single cell at
+ (\a row, \a col) using painter \a p. The painter must be open when
+ paintCell() is called and must remain open.
+
+ The coordinate system is \link QPainter::translate() translated \endlink
+ so that the origin is at the top-left corner of the cell to be
+ painted, i.e. \e cell coordinates. Do not scale or shear the coordinate
+ system (or if you do, restore the transformation matrix before you
+ return).
+
+ The painter is not clipped by default in order to get maximum
+ efficiency. If you want clipping, use
+
+ \code
+ p->setClipRect( cellRect(), QPainter::CoordPainter );
+ //... your drawing code
+ p->setClipping( FALSE );
+
+ \endcode
+
+*/
+
+/*! \fn QRect QGridView::cellRect() const
+
+ Returns the geometry of a cell in a cell's coordinate system. This
+ is a convenience function useful in paintCell(). It is equivalent to
+ QRect( 0, 0, cellWidth(), cellHeight() ).
+
+ \sa cellGeometry()
+
+ */
+
+/*!\fn QSize QGridView::gridSize() const
+
+ Returns the size of the grid in pixels.
+
+ */
+
+/*!
+ \overload
+ Repaints the contents. If \a erase is TRUE the
+ background is cleared using the background color.
+*/
+void QGridView::repaintContents( bool erase )
+{
+ QScrollView::repaintContents( contentsX(), contentsY(), visibleWidth(), visibleHeight(), erase );
+}
+
+#endif // QT_NO_GRIDVIEW
diff --git a/qtcompat/qgridview.h b/qtcompat/qgridview.h
new file mode 100644
index 0000000..e9d6ca1
--- a/dev/null
+++ b/qtcompat/qgridview.h
@@ -0,0 +1,138 @@
+/**********************************************************************
+** $Id$
+**
+** Definition of QGridView class
+**
+** Created: 2001.05.23
+**
+** Copyright (C) 1992-2001 Trolltech AS. All rights reserved.
+**
+** This file is part of the widgets module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QGRIDVIEW_H
+#define QGRIDVIEW_H
+
+#ifndef QT_H
+#include "qscrollview.h"
+#endif // QT_H
+
+#ifndef QT_NO_GRIDVIEW
+
+class QGridViewPrivate;
+
+class Q_EXPORT QGridView : public QScrollView
+{
+ Q_OBJECT
+ Q_PROPERTY( int numRows READ numRows WRITE setNumRows )
+ Q_PROPERTY( int numCols READ numCols WRITE setNumCols )
+ Q_PROPERTY( int cellWidth READ cellWidth WRITE setCellWidth )
+ Q_PROPERTY( int cellHeight READ cellHeight WRITE setCellHeight )
+public:
+
+ QGridView( QWidget *parent=0, const char *name=0, WFlags f=0 );
+ ~QGridView();
+
+ int numRows() const;
+ virtual void setNumRows( int );
+ int numCols() const;
+ virtual void setNumCols( int );
+
+ int cellWidth() const;
+ virtual void setCellWidth( int );
+ int cellHeight() const;
+ virtual void setCellHeight( int );
+
+ QRect cellRect() const;
+ QRect cellGeometry( int row, int column );
+ QSize gridSize() const;
+
+ int rowAt( int y ) const;
+ int columnAt( int x ) const;
+
+ void repaintCell( int row, int column, bool erase=TRUE );
+ void updateCell( int row, int column );
+ void ensureCellVisible( int row, int column );
+
+ void repaintContents( bool erase=TRUE );
+
+protected:
+ virtual void paintCell( QPainter *, int row, int col ) = 0;
+ virtual void paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch );
+
+ void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
+
+ virtual void dimensionChange( int, int );
+
+private:
+ void drawContents( QPainter* );
+ void updateGrid();
+
+ int nrows;
+ int ncols;
+ int cellw;
+ int cellh;
+ QGridViewPrivate* d;
+
+private: // Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+ QGridView( const QGridView & );
+ QGridView &operator=( const QGridView & );
+#endif
+};
+
+inline int QGridView::cellWidth() const
+{ return cellw; }
+
+inline int QGridView::cellHeight() const
+{ return cellh; }
+
+inline int QGridView::rowAt( int y ) const
+{ return y / cellh; }
+
+inline int QGridView::columnAt( int x ) const
+{ return x / cellw; }
+
+inline int QGridView::numRows() const
+{ return nrows; }
+
+inline int QGridView::numCols() const
+{return ncols; }
+
+inline QRect QGridView::cellRect() const
+{ return QRect( 0, 0, cellw, cellh ); }
+
+inline QSize QGridView::gridSize() const
+{ return QSize( ncols * cellw, nrows * cellh ); }
+
+
+
+#endif // QT_NO_GRIDVIEW
+
+
+#endif // QTABLEVIEW_H
diff --git a/qtcompat/qinputdialog.cpp b/qtcompat/qinputdialog.cpp
new file mode 100644
index 0000000..770b281
--- a/dev/null
+++ b/qtcompat/qinputdialog.cpp
@@ -0,0 +1,495 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of QInputDialog class
+**
+** Created : 991212
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the dialogs module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "qinputdialog.h"
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qwidgetstack.h>
+#include <qvalidator.h>
+#include <qapplication.h>
+
+class QInputDialogPrivate
+{
+public:
+ friend class QInputDialog;
+ QLineEdit *lineEdit;
+ QSpinBox *spinBox;
+ QComboBox *comboBox, *editComboBox;
+ QPushButton *ok;
+ QWidgetStack *stack;
+ QInputDialog::Type type;
+};
+
+/*!
+ \class QInputDialog qinputdialog.h
+ \brief A convenience dialog to get a simple input from the user
+ \ingroup dialogs
+
+ The QInputDialog is a simple dialog which can be used if you
+ need a simple input from the user. This can be text, a number or
+ an item from a list. Also a label has to be set to tell the user
+ what he/she should input.
+
+ In this Qt version only the 4 static convenience functions
+ getText(), getInteger(), getDouble() and getItem() of QInputDialog
+ are available.
+
+ Use it like this:
+
+ \code
+ bool ok = FALSE;
+ QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this );
+ if ( ok && !text.isEmpty() )
+ ;// user entered something and pressed ok
+ else
+ ;// user entered nothing or pressed cancel
+ \endcode
+
+ There are more static convenience methods!
+
+ \sa getText(), getInteger(), getDouble(), getItem()
+*/
+
+/*!
+ \enum QInputDialog::Type
+
+ This enum type specifies the type of the dialog
+ (which kind of input can be done):
+
+ <ul>
+ <li>\c LineEdit - A QLineEdit is used for taking the input, so a textual or
+ (e.g. using a QValidator) a numerical input can be done. Using lineEdit()
+ the QLineEdit can be accessed.
+ <li>\c SpinBox - A QSpinBox is used for taking the input, so a decimal
+ input can be done. Using spinBox() the QSpinBox can be accessed.
+ <li>\c ComboBox - A read-only QComboBox is used for taking the input,
+ so one item of a list can be chosen. Using comboBox() the QComboBox
+ can be accessed.
+ <li>\c EditableComboBox - An editable QComboBox is used for taking the input,
+ so either one item of a list can be chosen or a text can be entered. Using
+ editableComboBox() the QComboBox can be accessed.
+ </ul>
+*/
+
+/*!
+ Constructs the dialog. \a label is the text which is shown to the user (it should mention
+ to the user what he/she should input), \a parent the parent widget of the dialog, \a name
+ the name of it and if you set \a modal to TRUE, the dialog pops up modally, else it pops
+ up modeless. With \a type you specify the type of the dialog.
+
+ \sa getText(), getInteger(), getDouble(), getItem()
+*/
+
+QInputDialog::QInputDialog( const QString &label, QWidget* parent, const char* name,
+ bool modal, Type type)
+ : QDialog( parent, name, modal )
+{
+ if ( parent && parent->icon() &&!parent->icon()->isNull() )
+ setIcon( *parent->icon() );
+ else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
+ QDialog::setIcon( *qApp->mainWidget()->icon() );
+
+ d = new QInputDialogPrivate;
+ d->lineEdit = 0;
+ d->spinBox = 0;
+ d->comboBox = 0;
+
+ QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
+
+ QLabel* l = new QLabel( label, this );
+ vbox->addWidget( l );
+
+ d->stack = new QWidgetStack( this );
+ vbox->addWidget( d->stack );
+ d->lineEdit = new QLineEdit( d->stack );
+ d->spinBox = new QSpinBox( d->stack );
+ d->comboBox = new QComboBox( FALSE, d->stack );
+ d->editComboBox = new QComboBox( TRUE, d->stack );
+
+ QHBoxLayout *hbox = new QHBoxLayout( 6 );
+ vbox->addLayout( hbox, AlignRight );
+
+ d->ok = new QPushButton( tr( "&OK" ), this );
+ d->ok->setDefault( TRUE );
+ QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this );
+
+ QSize bs( d->ok->sizeHint() );
+ if ( cancel->sizeHint().width() > bs.width() )
+ bs.setWidth( cancel->sizeHint().width() );
+
+ d->ok->setFixedSize( bs );
+ cancel->setFixedSize( bs );
+
+ hbox->addWidget( new QWidget( this ) );
+ hbox->addWidget( d->ok );
+ hbox->addWidget( cancel );
+
+ connect( d->lineEdit, SIGNAL( returnPressed() ),
+ this, SLOT( tryAccept() ) );
+ connect( d->lineEdit, SIGNAL( textChanged( const QString & ) ),
+ this, SLOT( textChanged( const QString & ) ) );
+
+ connect( d->ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+//US ToDo make size dependent of targetplatform
+//US resize( QMAX( sizeHint().width(), 400 ), sizeHint().height() );
+ resize( sizeHint().width(), sizeHint().height() );
+
+ setType( type );
+}
+
+/*!
+ Returns the line edit, which is used in the LineEdit mode
+*/
+
+QLineEdit *QInputDialog::lineEdit() const
+{
+ return d->lineEdit;
+}
+
+/*!
+ Returns the spinbox, which is used in the SpinBox mode
+*/
+
+QSpinBox *QInputDialog::spinBox() const
+{
+ return d->spinBox;
+}
+
+/*!
+ Returns the combobox, which is used in the ComboBox mode
+*/
+
+QComboBox *QInputDialog::comboBox() const
+{
+ return d->comboBox;
+}
+
+/*!
+ Returns the combobox, which is used in the EditableComboBox mode
+*/
+
+QComboBox *QInputDialog::editableComboBox() const
+{
+ return d->editComboBox;
+}
+
+/*!
+ Sets the input type of the dialog to \a t.
+*/
+
+void QInputDialog::setType( Type t )
+{
+ switch ( t ) {
+ case LineEdit:
+ d->stack->raiseWidget( d->lineEdit );
+ d->lineEdit->setFocus();
+ break;
+ case SpinBox:
+ d->stack->raiseWidget( d->spinBox );
+ d->spinBox->setFocus();
+ break;
+ case ComboBox:
+ d->stack->raiseWidget( d->comboBox );
+ d->comboBox->setFocus();
+ break;
+ case EditableComboBox:
+ d->stack->raiseWidget( d->editComboBox );
+ d->editComboBox->setFocus();
+ break;
+ }
+
+ d->type = t;
+}
+
+/*!
+ Returns the input type of the dialog.
+
+ \sa setType()
+*/
+
+QInputDialog::Type QInputDialog::type() const
+{
+ return d->type;
+}
+
+/*!
+ Destructor.
+*/
+
+QInputDialog::~QInputDialog()
+{
+ delete d;
+}
+
+/*!
+ Static convenience function to get a textual input from the user. \a caption is the text
+ which is displayed in the title bar of the dialog. \a label is the text which
+ is shown to the user (it should mention to the user what he/she should input), \a text
+ the default text which will be initially set to the line edit, \a ok a pointer to
+ a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
+ user pressed cancel, \a parent the parent widget of the dialog and \a name
+ the name of it. The dialogs pops up modally!
+
+ This method returns the text which has been entered in the line edit.
+
+ You will use this static method like this:
+
+ \code
+ bool ok = FALSE;
+ QString text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this );
+ if ( ok && !text.isEmpty() )
+ ;// user entered something and pressed ok
+ else
+ ;// user entered nothing or pressed cancel
+ \endcode
+*/
+
+QString QInputDialog::getText( const QString &caption, const QString &label, const QString &text,
+ bool *ok, QWidget *parent, const char *name )
+{
+ return getText( caption, label, QLineEdit::Normal, text, ok, parent, name );
+}
+
+/*!
+ Like above, but accepts an a \a mode which the line edit will use to display text.
+
+ \sa getText()
+*/
+
+QString QInputDialog::getText( const QString &caption, const QString &label, QLineEdit::EchoMode mode,
+ const QString &text, bool *ok, QWidget *parent, const char *name )
+{
+ QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit );
+ dlg->setCaption( caption );
+ dlg->lineEdit()->setText( text );
+ dlg->lineEdit()->setEchoMode( mode );
+ if ( !text.isEmpty() )
+ dlg->lineEdit()->selectAll();
+
+ bool ok_ = FALSE;
+ QString result;
+ ok_ = dlg->exec() == QDialog::Accepted;
+ if ( ok )
+ *ok = ok_;
+ if ( ok_ )
+ result = dlg->lineEdit()->text();
+
+ delete dlg;
+ return result;
+}
+
+/*!
+ Static convenience function to get an integral input from the user. \a caption is the text
+ which is displayed in the title bar of the dialog. \a label is the text which
+ is shown to the user (it should mention to the user what he/she should input), \a num
+ the default number which will be initially set to the spinbox, \a from and \a to the
+ range in which the entered number has to be, \a step the step in which the number can
+ be increased/decreased by the spinbox, \a ok a pointer to
+ a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
+ user pressed cancel, \a parent the parent widget of the dialog and \a name
+ the name of it. The dialogs pops up modally!
+
+ This method returns the number which has been entered by the user.
+
+ You will use this static method like this:
+
+ \code
+ bool ok = FALSE;
+ int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this );
+ if ( ok )
+ ;// user entered something and pressed ok
+ else
+ ;// user pressed cancel
+ \endcode
+*/
+
+int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step,
+ bool *ok, QWidget *parent, const char *name )
+{
+ QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox );
+ dlg->setCaption( caption );
+ dlg->spinBox()->setRange( from, to );
+ dlg->spinBox()->setSteps( step, 0 );
+ dlg->spinBox()->setValue( num );
+
+ bool ok_ = FALSE;
+ int result;
+ ok_ = dlg->exec() == QDialog::Accepted;
+ if ( ok )
+ *ok = ok_;
+ result = dlg->spinBox()->value();
+
+ delete dlg;
+ return result;
+}
+
+/*!
+ Static convenience function to get a decimal input from the user. \a caption is the text
+ which is displayed in the title bar of the dialog. \a label is the text which
+ is shown to the user (it should mention to the user what he/she should input), \a num
+ the default decimal number which will be initially set to the line edit, \a from and \a to the
+ range in which the entered number has to be, \a decimals the number of decimal which
+ the number may have, \a ok a pointer to
+ a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
+ user pressed cancel, \a parent the parent widget of the dialog and \a name
+ the name of it. The dialogs pops up modally!
+
+ This method returns the number which has been entered by the user.
+
+ You will use this static method like this:
+
+ \code
+ bool ok = FALSE;
+ double res = QInputDialog::getDouble( tr( "Please enter a decimal number" ), 33.7, 0, 1000, 2, &ok, this );
+ if ( ok )
+ ;// user entered something and pressed ok
+ else
+ ;// user pressed cancel
+ \endcode
+*/
+
+double QInputDialog::getDouble( const QString &caption, const QString &label, double num,
+ double from, double to, int decimals,
+ bool *ok, QWidget *parent, const char *name )
+{
+ QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit );
+ dlg->setCaption( caption );
+ dlg->lineEdit()->setValidator( new QDoubleValidator( from, to, decimals, dlg->lineEdit() ) );
+ dlg->lineEdit()->setText( QString::number( num, 'f', decimals ) );
+ dlg->lineEdit()->selectAll();
+
+ bool accepted = ( dlg->exec() == QDialog::Accepted );
+ if ( ok )
+ *ok = accepted;
+
+ double result = dlg->lineEdit()->text().toDouble();
+
+ delete dlg;
+ return result;
+}
+
+/*!
+ Static convenience function to let the user select an item from a string list. \a caption is the text
+ which is displayed in the title bar of the dialog. \a label is the text which
+ is shown to the user (it should mention to the user what he/she should input), \a list the
+ string list which is inserted into the combobox, \a current the number of the item which should
+ be initially the current item, \a editable specifies if the combobox should be editable (if it is TRUE)
+ or read-only (if \a editable is FALSE), \a ok a pointer to
+ a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
+ user pressed cancel, \a parent the parent widget of the dialog and \a name
+ the name of it. The dialogs pops up modally!
+
+ This method returns the text of the current item, or if \a editable was TRUE, the current
+ text of the combobox.
+
+ You will use this static method like this:
+
+ \code
+ QStringList lst;
+ lst << "First" << "Second" << "Third" << "Fourth" << "Fifth";
+ bool ok = FALSE;
+ QString res = QInputDialog::getItem( tr( "Please select an item" ), lst, 1, TRUE, &ok, this );
+ if ( ok )
+ ;// user selected an item and pressed ok
+ else
+ ;// user pressed cancel
+ \endcode
+*/
+
+QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list,
+ int current, bool editable,
+ bool *ok, QWidget *parent, const char *name )
+{
+ QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, editable ? EditableComboBox : ComboBox );
+ dlg->setCaption( caption );
+ if ( editable ) {
+ dlg->editableComboBox()->insertStringList( list );
+ dlg->editableComboBox()->setCurrentItem( current );
+ } else {
+ dlg->comboBox()->insertStringList( list );
+ dlg->comboBox()->setCurrentItem( current );
+ }
+
+ bool ok_ = FALSE;
+ QString result;
+ ok_ = dlg->exec() == QDialog::Accepted;
+ if ( ok )
+ *ok = ok_;
+ if ( editable )
+ result = dlg->editableComboBox()->currentText();
+ else
+ result = dlg->comboBox()->currentText();
+
+ delete dlg;
+ return result;
+}
+
+/*!
+ \internal
+*/
+
+void QInputDialog::textChanged( const QString &s )
+{
+ bool on;
+ if ( d->lineEdit->validator() ) {
+ QString str = d->lineEdit->text();
+ int index = d->lineEdit->cursorPosition();
+ on = ( d->lineEdit->validator()->validate(str, index) ==
+ QValidator::Acceptable );
+ } else {
+ on = !s.isEmpty();
+ }
+ d->ok->setEnabled( on );
+}
+
+/*!
+ \internal
+*/
+
+void QInputDialog::tryAccept()
+{
+ if ( !d->lineEdit->text().isEmpty() )
+ accept();
+}
+
diff --git a/qtcompat/qinputdialog.h b/qtcompat/qinputdialog.h
new file mode 100644
index 0000000..3ff5b58
--- a/dev/null
+++ b/qtcompat/qinputdialog.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QInputDialog class
+**
+** Created : 991212
+**
+** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+**
+** This file is part of the dialogs module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef QTCOMPAT_QINPUTDIALOG_H
+#define QTCOMPAT_QINPUTDIALOG_H
+
+#ifndef QT_H
+#include <qdialog.h>
+#include <qstring.h>
+#include <qlineedit.h>
+#endif // QT_H
+
+class QInputDialogPrivate;
+
+class QSpinBox;
+class QComboBox;
+
+class Q_EXPORT QInputDialog : public QDialog
+{
+#if defined(_CC_MSVC_)
+ friend class QInputDialog;
+#endif
+ Q_OBJECT
+
+private:
+ enum Type { LineEdit, SpinBox, ComboBox, EditableComboBox };
+
+ QInputDialog( const QString &label, QWidget* parent = 0, const char* name = 0,
+ bool modal = TRUE, Type type = LineEdit );
+ ~QInputDialog();
+
+ QLineEdit *lineEdit() const;
+ QSpinBox *spinBox() const;
+ QComboBox *comboBox() const;
+ QComboBox *editableComboBox() const;
+
+ void setType( Type t );
+ Type type() const;
+
+public:
+ static QString getText( const QString &caption, const QString &label, const QString &text = QString::null,
+ bool *ok = 0, QWidget *parent = 0, const char *name = 0 ); // ### merge with below in 3.0
+ static QString getText( const QString &caption, const QString &label, QLineEdit::EchoMode echo, //### make default Normal in 3.0
+ const QString &text = QString::null, bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
+
+ static int getInteger( const QString &caption, const QString &label, int num = 0, int from = -2147483647,
+ int to = 2147483647,
+ int step = 1, bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
+ static double getDouble( const QString &caption, const QString &label, double num = 0,
+ double from = -2147483647, double to = 2147483647,
+ int decimals = 1, bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
+ static QString getItem( const QString &caption, const QString &label, const QStringList &list,
+ int current = 0, bool editable = TRUE,
+ bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
+
+private slots:
+ void textChanged( const QString &s );
+ void tryAccept();
+
+private:
+ QInputDialogPrivate *d;
+ // just to avoid warnings...
+ friend class QInputDialogPrivate;
+
+private: // Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+ QInputDialog( const QInputDialog & );
+ QInputDialog &operator=( const QInputDialog & );
+#endif
+};
+
+#endif // QTCOMPAT_QINPUTDIALOG_H
diff --git a/qtcompat/qinputdialog.h.wech b/qtcompat/qinputdialog.h.wech
new file mode 100644
index 0000000..47a332b
--- a/dev/null
+++ b/qtcompat/qinputdialog.h.wech
@@ -0,0 +1,14 @@
+#ifndef MICROKDE_QINPUTDIALOG_H
+#define MICROKDE_QINPUTDIALOG_H
+
+class QInputDialog
+{
+ public:
+
+ static QString getText( const QString &, const QString & )
+ {
+ return QString::null;
+ }
+};
+
+#endif
diff --git a/qtcompat/qksplitter.h b/qtcompat/qksplitter.h
new file mode 100644
index 0000000..b62c65e
--- a/dev/null
+++ b/qtcompat/qksplitter.h
@@ -0,0 +1,23 @@
+#ifndef QTCOMPAT_QSPLITTER_H
+#define QTCOMPAT_QSPLITTER_H
+
+#include <qwidget.h>
+
+class QKSplitter : public QWidget
+{
+ public:
+ enum { KeepSize };
+
+ QKSplitter (int, QWidget *parent=0, const char *name=0) :
+ QWidget( parent, name ) {}
+ QKSplitter( QWidget *parent=0, const char *name=0 ) :
+ QWidget( parent, name ) {}
+
+ void setResizeMode( QWidget *, int ) {}
+ void setOpaqueResize() {}
+
+ void setSizes (const QValueList<int> &) {}
+ QValueList<int> sizes() { QValueList<int> ret; return ret; }
+};
+
+#endif
diff --git a/qtcompat/qmemarray.h b/qtcompat/qmemarray.h
new file mode 100644
index 0000000..05adc6a
--- a/dev/null
+++ b/qtcompat/qmemarray.h
@@ -0,0 +1,8 @@
+#ifndef QTCOMPAT_QMEMARRAY_H
+#define QTCOMPAT_QMEMARRAY_H
+
+#include <qarray.h>
+
+#define QMemArray QArray
+
+#endif
diff --git a/qtcompat/qpair.h b/qtcompat/qpair.h
new file mode 100644
index 0000000..9518179
--- a/dev/null
+++ b/qtcompat/qpair.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Definition of QPair class
+**
+**
+** Copyright (C) 1992-2001 Trolltech AS. All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QPAIR_H
+#define QPAIR_H
+
+#ifndef QT_H
+#include "qglobal.h"
+#include "qdatastream.h"
+#endif // QT_H
+
+template <class T1, class T2>
+struct QPair
+{
+ typedef T1 first_type;
+ typedef T2 second_type;
+
+ QPair()
+ : first( T1() ), second( T2() )
+ {}
+ QPair( const T1& t1, const T2& t2 )
+ : first( t1 ), second( t2 )
+ {}
+
+ T1 first;
+ T2 second;
+};
+
+template <class T1, class T2>
+inline bool operator==( const QPair<T1, T2>& x, const QPair<T1, T2>& y )
+{
+ return x.first == y.first && x.second == y.second;
+}
+
+template <class T1, class T2>
+inline bool operator<( const QPair<T1, T2>& x, const QPair<T1, T2>& y )
+{
+ return x.first < y.first ||
+ ( !( y.first < x.first ) && x.second < y.second );
+}
+
+template <class T1, class T2>
+inline QPair<T1, T2> qMakePair( const T1& x, const T2& y )
+{
+ return QPair<T1, T2>( x, y );
+}
+
+#ifndef QT_NO_DATASTREAM
+template <class T1, class T2>
+inline QDataStream& operator>>( QDataStream& s, QPair<T1, T2>& p )
+{
+ s >> p.first >> p.second;
+ return s;
+}
+
+template <class T1, class T2>
+inline QDataStream& operator<<( QDataStream& s, const QPair<T1, T2>& p )
+{
+ s << p.first << p.second;
+ return s;
+}
+#endif
+
+#endif
diff --git a/qtcompat/qptrlist.h b/qtcompat/qptrlist.h
new file mode 100644
index 0000000..8ce6868
--- a/dev/null
+++ b/qtcompat/qptrlist.h
@@ -0,0 +1,10 @@
+#ifndef QTCOMPAT_QPTRLIST_H
+#define QTCOMPAT_QPTRLIST_H
+
+#include <qlist.h>
+
+#define QPtrList QList
+#define QPtrListIterator QListIterator
+#define QPtrCollection QCollection
+
+#endif
diff --git a/qtcompat/qptrstack.h b/qtcompat/qptrstack.h
new file mode 100644
index 0000000..92070b3
--- a/dev/null
+++ b/qtcompat/qptrstack.h
@@ -0,0 +1,9 @@
+#ifndef QTCOMPAT_QPTRSTACK_H
+#define QTCOMPAT_QPTRSTACK_H
+
+#include <qstack.h>
+
+#define QPtrStack QStack
+#define QPtrStackIterator QStackIterator
+
+#endif
diff --git a/qtcompat/qptrvector.h b/qtcompat/qptrvector.h
new file mode 100644
index 0000000..c869f36
--- a/dev/null
+++ b/qtcompat/qptrvector.h
@@ -0,0 +1,8 @@
+#ifndef QTCOMPAT_QPTRVECTOR_H
+#define QTCOMPAT_QPTRVECTOR_H
+
+#include <qvector.h>
+
+#define QPtrVector QVector
+
+#endif
diff --git a/qtcompat/qtcompat.pro b/qtcompat/qtcompat.pro
new file mode 100644
index 0000000..f985bb4
--- a/dev/null
+++ b/qtcompat/qtcompat.pro
@@ -0,0 +1,31 @@
+TEMPLATE = lib
+CONFIG += qt warn_on
+OBJECTS_DIR = obj/$(PLATFORM)
+MOC_DIR = moc/$(PLATFORM)
+TARGET = microqtcompat
+DESTDIR=$(QPEDIR)/lib
+
+
+INTERFACES = \
+
+HEADERS = \
+ qcombotableitem.h \
+ qgridview.h \
+ qmemarray.h \
+ qptrlist.h \
+ qksplitter.h \
+ qptrvector.h \
+ qinputdialog.h \
+ qtooltipcompat.h
+
+# qsplitter.h
+
+
+
+
+SOURCES = \
+ qinputdialog.cpp \
+ qcombotableitem.cpp \
+ qgridview.cpp \
+ qtooltipcompat.cpp
+
diff --git a/qtcompat/qtcompat.pro.back b/qtcompat/qtcompat.pro.back
new file mode 100644
index 0000000..6da7ce0
--- a/dev/null
+++ b/qtcompat/qtcompat.pro.back
@@ -0,0 +1,19 @@
+TEMPLATE = lib
+CONFIG = qt warn_on release
+OBJECTS_DIR = obj/$(PLATFORM)
+MOC_DIR = moc
+DESTDIR=$(QPEDIR)/lib
+
+INTERFACES = \
+
+HEADERS = \
+ qgridview.h \
+ qinputdialog.h \
+ qmemarray.h \
+ qptrlist.h \
+ qptrvector.h \
+ qsplitter.h \
+
+SOURCES = \
+ qgridview.cpp \
+
diff --git a/qtcompat/qtooltipcompat.cpp b/qtcompat/qtooltipcompat.cpp
new file mode 100644
index 0000000..a2de608
--- a/dev/null
+++ b/qtcompat/qtooltipcompat.cpp
@@ -0,0 +1,42 @@
+
+
+/******
+ *
+ * rob's QToolTip class
+ *
+ * Apparently Sharp concluded that ToolTips were not useful on the Zaurus and
+ * left them out of their Qtopia. Unfortunately, QWhatsThis uses the
+ * QToolTips::palette(), that function returns all 0's, and that means that
+ * QWhatsThis windows come up with black background and black foreground. By
+ * re-implementing this class, QWhatsThis calls this QToolTip::palette(), and
+ * gets a useful result.
+ *
+ * Include this class in your own Zaurus application and QWhatsThis should work
+ * for you as well.
+ *
+ * The contents of this file are released without restriction to the public
+ * domain.
+ *
+ * Copyright (c) rob miller October, 2003
+ *
+ *****/
+#ifdef ADD_TOOLTIP
+
+#include "qtooltipcompat.h"
+QPalette QToolTip::palette() {
+ static bool init = false;
+ static QPalette pt;
+ if (! init) { // only initialise once
+ init=true;
+ //rDebug("initialising my qtt-palette()"); //rDebug() is just qDebug() with a compile switch
+ QColor fg = QColor(0x00,0x00,0x00);
+ QColor bg = QColor(0xff,0xff,0xdc);
+
+ pt.setColor(QColorGroup::Background,bg);
+ pt.setBrush(QColorGroup::Foreground,fg);
+ }
+
+ return pt;
+}
+#endif
+
diff --git a/qtcompat/qtooltipcompat.h b/qtcompat/qtooltipcompat.h
new file mode 100644
index 0000000..4d44146
--- a/dev/null
+++ b/qtcompat/qtooltipcompat.h
@@ -0,0 +1,34 @@
+#ifndef QTCOMPAT_QTOOLTIP_H
+#define QTCOMPAT_QTOOLTIP_H
+
+/******
+ *
+ * rob's QToolTip class
+ *
+ * Apparently Sharp concluded that ToolTips were not useful on the Zaurus and
+ * left them out of their Qtopia. Unfortunately, QWhatsThis uses the
+ * QToolTips::palette(), that function returns all 0's, and that means that
+ * QWhatsThis windows come up with black background and black foreground. By
+ * re-implementing this class, QWhatsThis calls this QToolTip::palette(), and
+ * gets a useful result.
+ *
+ * Include this class in your own Zaurus application and QWhatsThis should work
+ * for you as well.
+ *
+ * The contents of this file are released without restriction to the public
+ * domain.
+ *
+ * Copyright (c) rob miller October, 2003
+ *
+ *****/
+#ifdef ADD_TOOLTIP
+
+#include <qpalette.h>
+class QToolTip: public Qt {
+ public:
+ static QPalette palette();
+};
+
+#endif
+
+#endif